35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
-
|
*/
void
TclpFindExecutable(
CONST char *argv0) /* The value of the application's argv[0]
* (native). */
{
int length;
#ifdef __CYGWIN__
char buf[PATH_MAX * TCL_UTF_MAX + 1];
char name[PATH_MAX * TCL_UTF_MAX + 1];
#else
CONST char *name, *p;
Tcl_StatBuf statBuf;
Tcl_DString buffer, nameString, cwd, utfName;
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
-
+
|
length -= 4;
}
tclNativeExecutableName = (char *) ckalloc(length + 1);
memcpy(tclNativeExecutableName, name, length);
buf[length] = '\0';
#else
if (argv0 == NULL) {
return NULL;
return;
}
Tcl_DStringInit(&buffer);
name = argv0;
for (p = name; *p != '\0'; p++) {
if (*p == '/') {
/*
|