summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/tclUnixInit.c')
-rw-r--r--unix/tclUnixInit.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 53853df..ea9b95a 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.35 2003/05/13 08:40:31 das Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.36 2003/11/10 20:34:15 dgp Exp $
*/
#if defined(HAVE_CFBUNDLE)
@@ -338,7 +338,25 @@ CONST char *path; /* Path to the executable in native
*/
if (path != NULL) {
- Tcl_SplitPath(path, &pathc, &pathv);
+ int i, origc;
+ CONST char **origv;
+
+ Tcl_SplitPath(path, &origc, &origv);
+ pathc = 0;
+ pathv = (CONST char **) ckalloc((unsigned int)(origc * sizeof(char *)));
+ for (i=0; i< origc; i++) {
+ if (origv[i][0] == '.') {
+ if (strcmp(origv[i], ".") == 0) {
+ /* do nothing */
+ } else if (strcmp(origv[i], "..") == 0) {
+ pathc--;
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ } else {
+ pathv[pathc++] = origv[i];
+ }
+ }
if (pathc > 2) {
str = pathv[pathc - 2];
pathv[pathc - 2] = installLib;
@@ -393,6 +411,7 @@ CONST char *path; /* Path to the executable in native
Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
Tcl_DStringFree(&ds);
}
+ ckfree((char *) origv);
ckfree((char *) pathv);
}