255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
-
-
+
+
|
matchResult = NativeMatchType(interp, native, nativeTail, types);
if (matchResult == 1) {
Tcl_ListObjAppendElement(interp, resultPtr, pathPtr);
}
Tcl_DecrRefCount(tailPtr);
Tcl_DecrRefCount(fileNamePtr);
} else {
TclDIR *d;
Tcl_DirEntry *entryPtr;
DIR *d;
struct dirent *entryPtr;
const char *dirName;
size_t dirLength, nativeDirLen;
int matchHidden, matchHiddenPat;
Tcl_StatBuf statBuf;
Tcl_DString ds; /* native encoding of dir */
Tcl_DString dsOrig; /* utf-8 encoding of dir */
|
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
-
+
|
|| !S_ISDIR(statBuf.st_mode)) {
Tcl_DStringFree(&dsOrig);
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(fileNamePtr);
return TCL_OK;
}
d = TclOSopendir(native); /* INTL: Native. */
d = opendir(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)));
}
|
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
-
+
|
* Check to see if -type or the pattern requests hidden files.
*/
matchHiddenPat = (pattern[0] == '.')
|| ((pattern[0] == '\\') && (pattern[1] == '.'));
matchHidden = matchHiddenPat
|| (types && (types->perm & TCL_GLOB_PERM_HIDDEN));
while ((entryPtr = TclOSreaddir(d)) != NULL) { /* INTL: Native. */
while ((entryPtr = readdir(d)) != NULL) { /* INTL: Native. */
Tcl_DString utfDs;
const char *utfname;
/*
* Skip this file if it doesn't agree with the hidden parameters
* requested by the user (via -type or pattern).
*/
|
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
-
+
|
}
Tcl_DStringFree(&utfDs);
if (matchResult < 0) {
break;
}
}
TclOSclosedir(d);
closedir(d);
Tcl_DStringFree(&ds);
Tcl_DStringFree(&dsOrig);
Tcl_DecrRefCount(fileNamePtr);
}
if (matchResult < 0) {
return TCL_ERROR;
}
|