313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
|| !S_ISDIR(statBuf.st_mode)) {
Tcl_DStringFree(&dsOrig);
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(fileNamePtr);
return TCL_OK;
}
d = TclOSopendir(native); /* INTL: Native. */
if (d == NULL) {
Tcl_DStringFree(&ds);
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read directory \"%s\": %s",
Tcl_DStringValue(&dsOrig), Tcl_PosixError(interp)));
}
|
|
|
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
|| !S_ISDIR(statBuf.st_mode)) {
Tcl_DStringFree(&dsOrig);
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(fileNamePtr);
return TCL_OK;
}
d = TclOSopendir(native); /* INTL: Native. */
if (d == NULL) {
Tcl_DStringFree(&ds);
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"couldn't read directory \"%s\": %s",
Tcl_DStringValue(&dsOrig), Tcl_PosixError(interp)));
}
|
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
* None.
*
*----------------------------------------------------------------------
*/
static int
NativeMatchType(
Tcl_Interp *interp, /* Interpreter to receive errors. */
const char *nativeEntry, /* Native path to check. */
const char *nativeName, /* Native filename to check. */
Tcl_GlobTypeData *types) /* Type description to match against. */
{
Tcl_StatBuf buf;
if (types == NULL) {
/*
* Simply check for the file's existence, but do it with lstat, in
* case it is a link to a file which doesn't exist (since that case
|
|
|
|
|
|
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
* None.
*
*----------------------------------------------------------------------
*/
static int
NativeMatchType(
Tcl_Interp *interp, /* Interpreter to receive errors. */
const char *nativeEntry, /* Native path to check. */
const char *nativeName, /* Native filename to check. */
Tcl_GlobTypeData *types) /* Type description to match against. */
{
Tcl_StatBuf buf;
if (types == NULL) {
/*
* Simply check for the file's existence, but do it with lstat, in
* case it is a link to a file which doesn't exist (since that case
|
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
|
int fd,
void *cygstat)
{
struct stat buf;
Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat;
int result = fstat(fd, &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
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 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
|
int fd,
void *cygstat)
{
struct stat buf;
Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat;
int result = fstat(fd, &buf);
statBuf->st_mode = (unsigned short)buf.st_mode;
statBuf->st_ino = (unsigned short)buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = (short)buf.st_uid;
statBuf->st_gid = (short)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
TclOSstat(
const char *name,
void *cygstat)
{
struct stat buf;
Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat;
int result = stat(name, &buf);
statBuf->st_mode = (unsigned short)buf.st_mode;
statBuf->st_ino = (unsigned short)buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = (short)buf.st_uid;
statBuf->st_gid = (short)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 = (unsigned short)buf.st_mode;
statBuf->st_ino = (unsigned short)buf.st_ino;
statBuf->st_dev = buf.st_dev;
statBuf->st_rdev = buf.st_rdev;
statBuf->st_nlink = buf.st_nlink;
statBuf->st_uid = (short)buf.st_uid;
statBuf->st_gid = (short)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 */
|