summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile.in2
-rwxr-xr-xunix/configure6
-rw-r--r--unix/configure.ac6
-rw-r--r--unix/tclUnixInit.c66
4 files changed, 35 insertions, 45 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 0dd9dda..a4bb907 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -1101,7 +1101,7 @@ install-libraries: libraries
done
@if [ -n "$(TCL_MODULE_PATH)" -a -f $(TOP_DIR)/library/tm.tcl ] ; then \
echo "Customizing tcl module path"; \
- echo "if {![interp issafe]} { ::tcl::tm::roots {$(TCL_MODULE_PATH)} }" >> \
+ echo "if {![interp issafe]} { ::tcl::tm::roots [list $(TCL_MODULE_PATH)] }" >> \
"$(SCRIPT_INSTALL_DIR)/tm.tcl"; \
fi
diff --git a/unix/configure b/unix/configure
index 10e947a..946e512 100755
--- a/unix/configure
+++ b/unix/configure
@@ -11400,13 +11400,13 @@ fi
if test "$FRAMEWORK_BUILD" = "1" ; then
test -z "$TCL_PACKAGE_PATH" && \
- TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl ~/Library/Frameworks /Library/Frameworks"
+ TCL_PACKAGE_PATH="~/Library/Tcl:/Library/Tcl:~/Library/Frameworks:/Library/Frameworks"
test -z "$TCL_MODULE_PATH" && \
TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl"
elif test "$prefix/lib" != "$libdir"; then
- test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib} ${TCL_PACKAGE_PATH}"
+ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib"
else
- test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${prefix}/lib} ${TCL_PACKAGE_PATH}"
+ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib"
fi
#--------------------------------------------------------------------
diff --git a/unix/configure.ac b/unix/configure.ac
index cf1eb87..03d7e5a 100644
--- a/unix/configure.ac
+++ b/unix/configure.ac
@@ -889,13 +889,13 @@ AC_SUBST(TCL_BUILDTIME_LIBRARY)
if test "$FRAMEWORK_BUILD" = "1" ; then
test -z "$TCL_PACKAGE_PATH" && \
- TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl ~/Library/Frameworks /Library/Frameworks"
+ TCL_PACKAGE_PATH="~/Library/Tcl:/Library/Tcl:~/Library/Frameworks:/Library/Frameworks"
test -z "$TCL_MODULE_PATH" && \
TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl"
elif test "$prefix/lib" != "$libdir"; then
- test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib} ${TCL_PACKAGE_PATH}"
+ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir}:${prefix}/lib"
else
- test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="{${prefix}/lib} ${TCL_PACKAGE_PATH}"
+ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib"
fi
#--------------------------------------------------------------------
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 982c36b..c7bc463 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -100,7 +100,7 @@ typedef struct {
* defined by Makefile.
*/
-static char defaultLibraryDir[sizeof(TCL_LIBRARY)+200] = TCL_LIBRARY;
+static const char defaultLibraryDir[] = TCL_LIBRARY;
/*
* Directory in which to look for packages (each package is typically
@@ -108,7 +108,7 @@ static char defaultLibraryDir[sizeof(TCL_LIBRARY)+200] = TCL_LIBRARY;
* Makefile.
*/
-static char pkgPath[sizeof(TCL_PACKAGE_PATH)+200] = TCL_PACKAGE_PATH;
+static const char pkgPath[] = TCL_PACKAGE_PATH;
/*
* The following table is used to map from Unix locale strings to encoding
@@ -790,7 +790,8 @@ TclpSetVariables(
struct utsname name;
#endif
int unameOK;
- Tcl_DString ds;
+ const char *p, *q;
+ Tcl_Obj *pkgListObj = Tcl_NewObj();
#ifdef HAVE_COREFOUNDATION
char tclLibPath[MAXPATHLEN + 1];
@@ -806,29 +807,20 @@ TclpSetVariables(
if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) {
const char *str;
CFBundleRef bundleRef;
+ Tcl_DString ds;
Tcl_SetVar2(interp, "tclDefaultLibrary", NULL, tclLibPath, TCL_GLOBAL_ONLY);
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath, TCL_GLOBAL_ONLY);
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
-
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(tclLibPath, -1));
str = TclGetEnv("DYLD_FRAMEWORK_PATH", &ds);
if ((str != NULL) && (str[0] != '\0')) {
- char *p = Tcl_DStringValue(&ds);
-
- /*
- * Convert DYLD_FRAMEWORK_PATH from colon to space separated.
- */
-
- do {
- if (*p == ':') {
- *p = ' ';
- }
- } while (*p++);
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, Tcl_DStringValue(&ds),
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ p = Tcl_DStringValue(&ds);
+ while ((q = strchr(p, ':')) != NULL) {
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p));
+ p = q+1;
+ }
+ if (*p) {
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1));
+ }
Tcl_DStringFree(&ds);
}
bundleRef = CFBundleGetMainBundle();
@@ -842,10 +834,7 @@ TclpSetVariables(
(unsigned char*) tclLibPath, MAXPATHLEN) &&
! TclOSstat(tclLibPath, &statBuf) &&
S_ISDIR(statBuf.st_mode)) {
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath,
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(tclLibPath, -1));
}
CFRelease(frameworksURL);
}
@@ -855,22 +844,22 @@ TclpSetVariables(
(unsigned char*) tclLibPath, MAXPATHLEN) &&
! TclOSstat(tclLibPath, &statBuf) &&
S_ISDIR(statBuf.st_mode)) {
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, tclLibPath,
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, " ",
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(tclLibPath, -1));
}
CFRelease(frameworksURL);
}
}
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, pkgPath,
- TCL_GLOBAL_ONLY | TCL_APPEND_VALUE);
- } else
+ }
#endif /* HAVE_COREFOUNDATION */
- {
- Tcl_SetVar2(interp, "tcl_pkgPath", NULL, pkgPath, TCL_GLOBAL_ONLY);
+ p = pkgPath;
+ while ((q = strchr(p, ':')) != NULL) {
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p));
+ p = q+1;
}
-
+ if (*p) {
+ Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1));
+ }
+ Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_pkgPath", -1), NULL, pkgListObj, TCL_GLOBAL_ONLY);
{
/* Some platforms build configure scripts expect ~ expansion so do that */
Tcl_Obj *origPaths;
@@ -878,8 +867,7 @@ TclpSetVariables(
origPaths = Tcl_GetVar2Ex(interp, "tcl_pkgPath", NULL, TCL_GLOBAL_ONLY);
resolvedPaths = TclResolveTildePathList(origPaths);
if (resolvedPaths != origPaths && resolvedPaths != NULL) {
- Tcl_SetVar2Ex(interp, "tcl_pkgPath", NULL,
- resolvedPaths, TCL_GLOBAL_ONLY);
+ Tcl_SetVar2Ex(interp, "tcl_pkgPath", NULL, resolvedPaths, TCL_GLOBAL_ONLY);
}
}
@@ -920,6 +908,7 @@ TclpSetVariables(
#elif !defined NO_UNAME
if (uname(&name) >= 0) {
const char *native;
+ Tcl_DString ds;
unameOK = 1;
@@ -981,6 +970,7 @@ TclpSetVariables(
{
struct passwd *pwEnt = TclpGetPwUid(getuid());
const char *user;
+ Tcl_DString ds;
if (pwEnt == NULL) {
user = "";