summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFile.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-11 09:42:02 (GMT)
committerhobbs <hobbs>2003-02-11 09:42:02 (GMT)
commit28874513024e2087054c3fcbdb08a7fead506bc8 (patch)
treee29a080d055b574393eb2537438bc57e9a67cc77 /unix/tclUnixFile.c
parent63ac9ae8f0c55210a985fccf6b5320a726745fa8 (diff)
downloadtcl-28874513024e2087054c3fcbdb08a7fead506bc8.zip
tcl-28874513024e2087054c3fcbdb08a7fead506bc8.tar.gz
tcl-28874513024e2087054c3fcbdb08a7fead506bc8.tar.bz2
* unix/tclUnixFile.c (TclpMatchInDirectory): simplify the hidden
file match check.
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r--unix/tclUnixFile.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 62f9a3a..4e89ee1 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFile.c,v 1.30 2003/02/10 10:26:26 vincentdarley Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.31 2003/02/11 09:42:02 hobbs Exp $
*/
#include "tclInt.h"
@@ -283,34 +283,24 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types)
nativeDirLen = Tcl_DStringLength(&ds);
/*
- * Check to see if the pattern needs to compare with hidden files.
+ * Check to see if -type or the pattern requests hidden files.
*/
-
- if ((pattern[0] == '.')
- || ((pattern[0] == '\\') && (pattern[1] == '.'))) {
- matchHidden = 1;
- } else {
- matchHidden = 0;
- }
+ matchHidden = ((types && (types->perm & TCL_GLOB_PERM_HIDDEN)) ||
+ ((pattern[0] == '.')
+ || ((pattern[0] == '\\') && (pattern[1] == '.'))));
while ((entryPtr = TclOSreaddir(d)) != NULL) { /* INTL: Native. */
Tcl_DString utfDs;
CONST char *utfname;
-
- if (types != NULL && (types->perm & TCL_GLOB_PERM_HIDDEN)) {
- /*
- * We explicitly asked for hidden files, so turn around
- * and ignore any file which isn't hidden.
- */
- if (*entryPtr->d_name != '.') {
- continue;
- }
- } else if (!matchHidden && (*entryPtr->d_name == '.')) {
- /*
- * Don't match names starting with "." unless the "." is
- * present in the pattern.
- */
- continue;
+
+ /*
+ * Skip this file if it doesn't agree with the hidden
+ * parameters requested by the user (via -type or pattern).
+ */
+ if (*entryPtr->d_name == '.') {
+ if (!matchHidden) continue;
+ } else {
+ if (matchHidden) continue;
}
/*