Diff
Not logged in

Differences From Artifact [4b52fbaac8]:

To Artifact [72aef34f6d]:


1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19











-
+







/* 
 * tclUnixFile.c --
 *
 *      This file contains wrappers around UNIX file handling functions.
 *      These wrappers mask differences between Windows and UNIX.
 *
 * Copyright (c) 1995-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * SCCS: @(#) tclUnixFile.c 1.58 98/01/17 00:01:01
 * RCS: @(#) $Id: tclUnixFile.c,v 1.1.2.2 1998/09/24 23:59:45 stanton Exp $
 */

#include "tclInt.h"
#include "tclPort.h"


/*
73
74
75
76
77
78
79






80
81
82
83
84
85
86
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92







+
+
+
+
+
+







    if (p == NULL) {
	/*
	 * There's no PATH environment variable; use the default that
	 * is used by sh.
	 */

	p = ":/bin:/usr/bin";
    } else if (*p == '\0') {
	/*
	 * An empty path is equivalent to ".".
	 */

	p = "./";
    }

    /*
     * Search through all the directories named in the PATH variable
     * to see if argv[0] is in one of them.  If so, use that file
     * name.
     */
97
98
99
100
101
102
103
104
105


106
107
108
109
110


111
112



113
114
115
116
117
118
119
103
104
105
106
107
108
109


110
111
112
113
114
115
116
117
118


119
120
121
122
123
124
125
126
127
128







-
-
+
+





+
+
-
-
+
+
+







	if (p != name) {
	    Tcl_DStringAppend(&buffer, name, p - name);
	    if (p[-1] != '/') {
		Tcl_DStringAppend(&buffer, "/", 1);
	    }
	}
	name = Tcl_DStringAppend(&buffer, argv0, -1);
	if ((access(name, X_OK) == 0)			/* INTL: Native. */
		&& (stat(name, &statBuf) == 0)		/* INTL: Native. */
	if ((TclAccess(name, X_OK) == 0)		/* INTL: Native. */
		&& (TclStat(name, &statBuf) == 0)	/* INTL: Native. */
		&& S_ISREG(statBuf.st_mode)) {
	    goto gotName;
	}
	if (*p == '\0') {
	    break;
	} else if (*(p+1) == 0) {
	    p = "./";
	}
	p++;
	} else {
	    p++;
	}
    }
    goto done;

    /*
     * If the name starts with "/" then just copy it to tclExecutableName.
     */

202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
211
212
213
214
215
216
217

218
219
220
221
222
223
224
225







-
+







    if (Tcl_DStringLength(dirPtr) == 0) {
	dirName = ".";
    } else {
	dirName = dirPtr->string;
    }

    native = Tcl_UtfToExternalDString(NULL, dirName, -1, &ds);
    if ((stat(native, &statBuf) != 0)			/* INTL: Native. */
    if ((TclStat(native, &statBuf) != 0)		/* INTL: Native. */
	    || !S_ISDIR(statBuf.st_mode)) {
	Tcl_DStringFree(&ds);
	return TCL_OK;
    }

    /*
     * Check to see if the pattern needs to compare with hidden files.
295
296
297
298
299
300
301
302



303
304
305
306
307
308
309
304
305
306
307
308
309
310

311
312
313
314
315
316
317
318
319
320







-
+
+
+








	utf = Tcl_ExternalToUtfDString(NULL, entryPtr->d_name, -1, &ds);
	if (Tcl_StringMatch(utf, pattern) != 0) {
	    Tcl_DStringSetLength(dirPtr, baseLength);
	    Tcl_DStringAppend(dirPtr, utf, -1);
	    if (tail == NULL) {
		Tcl_AppendElement(interp, Tcl_DStringValue(dirPtr));
	    } else if ((TclpStat(Tcl_DStringValue(dirPtr), &statBuf) == 0)
	    } else if ((TclStat(Tcl_DStringValue(dirPtr), &statBuf) == 0)
		Tcl_AppendElement(interp, dirPtr->string);
	    } else if ((TclStat(dirPtr->string, &statBuf) == 0)
		    && S_ISDIR(statBuf.st_mode)) {
		Tcl_DStringAppend(dirPtr, "/", 1);
		result = TclDoGlob(interp, separators, dirPtr, tail);
		if (result != TCL_OK) {
		    Tcl_DStringFree(&ds);
		    break;
		}