38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
TclpFindExecutable(
CONST char *argv0) /* The value of the application's argv[0]
* (native). */
{
Tcl_Encoding encoding;
#ifdef __CYGWIN__
int length;
char buf[PATH_MAX * 2];
char name[PATH_MAX * 3 + 1];
GetModuleFileNameW(NULL, buf, sizeof(buf)/2);
cygwin_conv_path(3, buf, name, sizeof(name));
length = strlen(name);
if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) {
/* Strip '.exe' part. */
length -= 4;
}
encoding = Tcl_GetEncoding(NULL, NULL);
|
|
>
>
|
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
TclpFindExecutable(
CONST char *argv0) /* The value of the application's argv[0]
* (native). */
{
Tcl_Encoding encoding;
#ifdef __CYGWIN__
int length;
wchar_t buf[PATH_MAX] = L"";
char name[PATH_MAX * 3 + 1];
(void)argv0;
GetModuleFileNameW(NULL, (void *)buf, sizeof(buf)/sizeof(wchar_t));
cygwin_conv_path(3, buf, name, sizeof(name));
length = strlen(name);
if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) {
/* Strip '.exe' part. */
length -= 4;
}
encoding = Tcl_GetEncoding(NULL, NULL);
|
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
|
*/
int
TclpUtime(
Tcl_Obj *pathPtr, /* File to modify */
struct utimbuf *tval) /* New modification date structure */
{
return utime(Tcl_FSGetNativePath(pathPtr), tval);
}
#ifdef __CYGWIN__
int TclOSstat(const char *name, void *cygstat) {
struct stat buf;
Tcl_StatBuf *statBuf = cygstat;
int result = stat(name, &buf);
statBuf->st_mode = buf.st_mode;
statBuf->st_ino = buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = buf.st_uid;
statBuf->st_gid = buf.st_gid;
statBuf->st_size = buf.st_size;
statBuf->st_atime = buf.st_atime;
statBuf->st_mtime = buf.st_mtime;
statBuf->st_ctime = buf.st_ctime;
return result;
}
int TclOSlstat(const char *name, void *cygstat) {
struct stat buf;
Tcl_StatBuf *statBuf = cygstat;
int result = lstat(name, &buf);
statBuf->st_mode = buf.st_mode;
statBuf->st_ino = buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = buf.st_uid;
statBuf->st_gid = buf.st_gid;
statBuf->st_size = buf.st_size;
statBuf->st_atime = buf.st_atime;
statBuf->st_mtime = buf.st_mtime;
statBuf->st_ctime = buf.st_ctime;
return result;
}
#endif
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|
|
>
>
|
>
>
|
>
>
>
>
|
>
>
|
>
|
|
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
|
*/
int
TclpUtime(
Tcl_Obj *pathPtr, /* File to modify */
struct utimbuf *tval) /* New modification date structure */
{
return utime((const char *)Tcl_FSGetNativePath(pathPtr), tval);
}
#ifdef __CYGWIN__
int
TclOSstat(
const char *name,
void *cygstat)
{
struct stat buf;
Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat;
int result = stat(name, &buf);
statBuf->st_mode = buf.st_mode;
statBuf->st_ino = buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = buf.st_uid;
statBuf->st_gid = buf.st_gid;
statBuf->st_size = buf.st_size;
statBuf->st_atime = buf.st_atime;
statBuf->st_mtime = buf.st_mtime;
statBuf->st_ctime = buf.st_ctime;
return result;
}
int
TclOSlstat(
const char *name,
void *cygstat)
{
struct stat buf;
Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat;
int result = lstat(name, &buf);
statBuf->st_mode = buf.st_mode;
statBuf->st_ino = buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = buf.st_uid;
statBuf->st_gid = buf.st_gid;
statBuf->st_size = buf.st_size;
statBuf->st_atime = buf.st_atime;
statBuf->st_mtime = buf.st_mtime;
statBuf->st_ctime = buf.st_ctime;
return result;
}
#endif /* CYGWIN */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|