summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-20 16:28:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-20 16:28:37 (GMT)
commit45c406a3db22a0349dfabba2c0c9edfb924a6ea9 (patch)
treec2a20757f437e8ff2c1f3a73b0397a091ed006f1
parent7aa855f962a06be0007a47a5330934a4fa4b110a (diff)
parent8ac4aee0fc7e4d4020c874ab41fecad788d1c848 (diff)
downloadtcl-45c406a3db22a0349dfabba2c0c9edfb924a6ea9.zip
tcl-45c406a3db22a0349dfabba2c0c9edfb924a6ea9.tar.gz
tcl-45c406a3db22a0349dfabba2c0c9edfb924a6ea9.tar.bz2
Merge trunk.
Implementation simplifications
-rw-r--r--generic/tcl.h26
-rw-r--r--generic/tclCmdIL.c2
-rw-r--r--generic/tclCmdMZ.c2
-rw-r--r--generic/tclInt.h5
-rw-r--r--generic/tclScan.c2
-rw-r--r--generic/tclStubCall.c38
-rw-r--r--generic/tclStubMainEx.c73
-rw-r--r--generic/tclStubStaticPackage.c74
-rw-r--r--macosx/GNUmakefile2
-rw-r--r--unix/Makefile.in13
-rwxr-xr-xunix/install-sh412
-rw-r--r--win/Makefile.in8
-rw-r--r--win/makefile.vc8
13 files changed, 248 insertions, 417 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index fb96e3c..ab2b0a8 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -2202,11 +2202,7 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv);
#endif
extern void TclStubMainEx(int index, int argc, const void *argv,
Tcl_AppInitProc *appInitProc, Tcl_Interp *interp);
-extern const char *TclStubStaticPackage(Tcl_Interp *interp,
- const char *pkgName,
- Tcl_PackageInitProc *initProc,
- Tcl_PackageInitProc *safeInitProc);
-extern const char *TclStubCall(int flags, void *arg1, void *arg2);
+extern void *TclStubCall(int flags, void *arg1);
#if defined(_WIN32) && defined(UNICODE)
#ifndef USE_TCL_STUBS
# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg)))
@@ -2217,18 +2213,24 @@ extern const char *TclStubCall(int flags, void *arg1, void *arg2);
#endif
#ifdef USE_TCL_STUBS
#define Tcl_InitSubsystems() \
- TclInitStubTable(TclStubCall(0, NULL, NULL))
+ TclInitStubTable(((const char *(*)(void))TclStubCall(0, NULL))())
#define Tcl_FindExecutable(argv0) \
- TclInitStubTable(TclStubCall(1, (void *)argv0, NULL))
+ TclInitStubTable(((const char *(*)(const char *))TclStubCall(1, NULL))(argv0))
#define Tcl_SetPanicProc(panicProc) \
- TclInitStubTable(TclStubCall(2, (void *)panicProc, NULL))
+ TclInitStubTable(((const char *(*)(Tcl_PanicProc *))TclStubCall(1, (void *)panicProc))(panicProc))
#define TclZipfs_AppHook(argcp, argvp) \
- TclInitStubTable(TclStubCall(3, (void *)argcp, (void *)argvp))
+ TclInitStubTable(((const char *(*)(int *, void *))TclStubCall(1, NULL))(argcp, argvp))
+#define Tcl_StaticPackage(interp, pkgName, initProc, safeInitProc) \
+ ((void(*)(Tcl_Interp *, const char *, Tcl_PackageInitProc *, Tcl_PackageInitProc *)) \
+ TclStubCall(4, NULL))(interp, pkgName, initProc, safeInitProc)
#if !defined(_WIN32) || !defined(UNICODE)
-#define Tcl_MainEx(argc, argv, appInitProc, interp) TclStubMainEx(0, argc, argv, appInitProc, interp)
+#define Tcl_MainEx(argc, argv, appInitProc, interp) \
+ ((void(*)(int, const void *, Tcl_AppInitProc *, Tcl_Interp *)) \
+ TclStubCall(5, NULL))(argc, argv, appInitProc, interp)
#endif
-#define Tcl_MainExW(argc, argv, appInitProc, interp) TclStubMainEx(1, argc, argv, appInitProc, interp)
-#define Tcl_StaticPackage TclStubStaticPackage
+#define Tcl_MainExW(argc, argv, appInitProc, interp) \
+ ((void(*)(int, const void *, Tcl_AppInitProc *, Tcl_Interp *)) \
+ TclStubCall(6, NULL))(argc, argv, appInitProc, interp)
#endif
/*
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index b2f1216..5a8ef22 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -3518,7 +3518,7 @@ Tcl_LsearchObjCmd(
if (allMatches || inlineReturn) {
Tcl_ResetResult(interp);
} else {
- TclNewIndexObj(itemPtr, -1);
+ TclNewIndexObj(itemPtr, TCL_INDEX_NONE);
Tcl_SetObjResult(interp, itemPtr);
}
goto done;
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index ae4f25f..d5828cd 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -3789,7 +3789,7 @@ TclNRSwitchObjCmd(
TclNewIndexObj(rangeObjAry[0], info.matches[j].start);
TclNewIndexObj(rangeObjAry[1], info.matches[j].end-1);
} else {
- TclNewIndexObj(rangeObjAry[1], -1);
+ TclNewIndexObj(rangeObjAry[1], TCL_INDEX_NONE);
rangeObjAry[0] = rangeObjAry[1];
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 2e88348..2a0dfa6 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4816,11 +4816,12 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
#define TclNewIndexObj(objPtr, w) \
do { \
+ size_t _w = (w); \
TclIncrObjsAllocated(); \
TclAllocObjStorage(objPtr); \
(objPtr)->refCount = 0; \
(objPtr)->bytes = NULL; \
- (objPtr)->internalRep.wideValue = (Tcl_WideInt)((w) + 1) - 1; \
+ (objPtr)->internalRep.wideValue = ((_w) == TCL_INDEX_NONE) ? -1 : (Tcl_WideInt)(_w); \
(objPtr)->typePtr = &tclIntType; \
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
@@ -4851,7 +4852,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
(objPtr) = Tcl_NewWideIntObj(w)
#define TclNewIndexObj(objPtr, w) \
- (objPtr) = Tcl_NewWideIntObj((Tcl_WideInt)((w) + 1) - 1)
+ (objPtr) = ((w) == TCL_INDEX_NONE) ? Tcl_NewWideIntObj(-1) : Tcl_NewWideIntObj(w)
#define TclNewDoubleObj(objPtr, d) \
(objPtr) = Tcl_NewDoubleObj(d)
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 468d5bb..3387f34 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -1089,7 +1089,7 @@ Tcl_ScanObjCmd(
if (code == TCL_OK) {
if (underflow && (nconversions == 0)) {
if (numVars) {
- TclNewIndexObj(objPtr, -1);
+ TclNewIndexObj(objPtr, TCL_INDEX_NONE);
} else {
if (objPtr) {
Tcl_SetListObj(objPtr, 0, NULL);
diff --git a/generic/tclStubCall.c b/generic/tclStubCall.c
index 82cd60a..ae6566f 100644
--- a/generic/tclStubCall.c
+++ b/generic/tclStubCall.c
@@ -33,23 +33,33 @@ MODULE_SCOPE void *tclStubsHandle;
*/
static const char PROCNAME[][24] = {
- "_Tcl_InitSubsystems",
- "_Tcl_FindExecutable",
- "_Tcl_SetPanicProc",
- "_TclZipfs_AppHook"
+ "_Tcl_InitSubsystems",
+ "_Tcl_FindExecutable",
+ "_Tcl_SetPanicProc",
+ "_TclZipfs_AppHook",
+ "_Tcl_StaticPackage",
+ "_Tcl_MainEx",
+ "_Tcl_MainExW"
};
-MODULE_SCOPE const char *
-TclStubCall(int index, void *arg1, void *arg2)
+MODULE_SCOPE const void *nullVersionProc(void) {
+ return NULL;
+}
+
+static const char CANNOTCALL[] = "Cannot call %s from stubbed extension\n";
+static const char CANNOTFIND[] = "Cannot find %s: %s\n";
+
+MODULE_SCOPE void *
+TclStubCall(int index, void *arg1)
{
- static void *stubFn[] = {NULL,NULL,NULL,NULL};
- static const char *version = NULL;
+ static void *stubFn[] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL};
+ const char *(*versionProc)(void) = (const char *(*)(void))nullVersionProc;
if (tclStubsHandle == (void *)-1) {
if (index == 2 && arg1 != NULL) {
- ((Tcl_PanicProc *)arg1)("Cannot call %s from stubbed extension\n", PROCNAME[index] + 1);
+ ((Tcl_PanicProc *)arg1)(CANNOTCALL, PROCNAME[index] + 1);
} else {
- fprintf(stderr, "Cannot call %s from stubbed extension\n", PROCNAME[index] + 1);
+ fprintf(stderr, CANNOTCALL, PROCNAME[index] + 1);
abort();
}
}
@@ -58,9 +68,9 @@ TclStubCall(int index, void *arg1, void *arg2)
tclStubsHandle = dlopen(TCL_DLL_FILE, RTLD_NOW|RTLD_LOCAL);
if (!tclStubsHandle) {
if (index == 2 && arg1 != NULL) {
- ((Tcl_PanicProc *)arg1)("Cannot find " TCL_DLL_FILE ": %s\n", dlerror());
+ ((Tcl_PanicProc *)arg1)(CANNOTFIND, TCL_DLL_FILE, dlerror());
} else {
- fprintf(stderr, "Cannot find " TCL_DLL_FILE ": %s\n", dlerror());
+ fprintf(stderr, CANNOTFIND, TCL_DLL_FILE, dlerror());
abort();
}
}
@@ -70,10 +80,10 @@ TclStubCall(int index, void *arg1, void *arg2)
stubFn[index] = dlsym(tclStubsHandle, PROCNAME[index]);
}
if (stubFn[index]) {
- version = ((const char *(*)(void *,void *))stubFn[index])(arg1, arg2);
+ versionProc = ((const char *(*)(void))stubFn[index]);
}
}
- return version;
+ return versionProc;
}
/*
diff --git a/generic/tclStubMainEx.c b/generic/tclStubMainEx.c
deleted file mode 100644
index df807a7..0000000
--- a/generic/tclStubMainEx.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * tclStubMainEx.c --
- *
- * See the file "license.terms" for information on usage and redistribution of
- * this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tclInt.h"
-#ifndef _WIN32
-# include <dlfcn.h>
-#else
-# define dlopen(a,b) (void *)LoadLibraryW(JOIN(L,a))
-# define dlsym(a,b) (void *)GetProcAddress((HMODULE)(a),b)
-# define dlerror() ""
-#endif
-
-MODULE_SCOPE void *tclStubsHandle;
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_InitSubsystems --
- *
- * Load the Tcl core dynamically, version "9.0" (or higher, in future versions)
- *
- * Results:
- * Outputs the value of the "version" argument.
- *
- * Side effects:
- * Sets the stub table pointers.
- *
- *----------------------------------------------------------------------
- */
-
-static const char PROCNAME[][24] = {
- "_Tcl_MainEx",
- "_Tcl_MainExW"
-};
-
-MODULE_SCOPE void
-TclStubMainEx(int index, int argc, const void *argv,
- Tcl_AppInitProc *appInitProc, Tcl_Interp *interp)
-{
- static void *stubFn[] = {NULL,NULL};
-
- if (!stubFn[index]) {
- if (tclStubsHandle == (void *)-1) {
- fprintf(stderr, "Cannot call %s from stubbed extension\n", PROCNAME[index] + 1);
- abort();
- }
- if (!tclStubsHandle) {
- tclStubsHandle = dlopen(TCL_DLL_FILE, RTLD_NOW|RTLD_LOCAL);
- if (!tclStubsHandle) {
- tclStubsPtr->tcl_Panic("Cannot find " TCL_DLL_FILE ": %s\n", dlerror());
- }
- }
- stubFn[index] = dlsym(tclStubsHandle, PROCNAME[index] + 1);
- if (!stubFn[index]) {
- stubFn[index] = dlsym(tclStubsHandle, PROCNAME[index]);
- }
- if (stubFn[index]) {
- ((void(*)(int, const void *, Tcl_AppInitProc *, Tcl_Interp *))stubFn[index])(argc, argv, appInitProc, interp);
- }
- }
-}
-
-/*
- * Local Variables:
- * mode: c
- * c-basic-offset: 4
- * fill-column: 78
- * End:
- */
diff --git a/generic/tclStubStaticPackage.c b/generic/tclStubStaticPackage.c
deleted file mode 100644
index 2765b3b..0000000
--- a/generic/tclStubStaticPackage.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * tclStubStaticPackage.c --
- *
- * See the file "license.terms" for information on usage and redistribution of
- * this file, and for a DISCLAIMER OF ALL WARRANTIES.
- */
-
-#include "tclInt.h"
-#ifndef _WIN32
-# include <dlfcn.h>
-#else
-# define dlopen(a,b) (void *)LoadLibraryW(JOIN(L,a))
-# define dlsym(a,b) (void *)GetProcAddress((HMODULE)(a),b)
-# define dlerror() ""
-#endif
-
-MODULE_SCOPE void *tclStubsHandle;
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_InitSubsystems --
- *
- * Load the Tcl core dynamically, version "9.0" (or higher, in future versions)
- *
- * Results:
- * Outputs the value of the "version" argument.
- *
- * Side effects:
- * Sets the stub table pointers.
- *
- *----------------------------------------------------------------------
- */
-
-static const char PROCNAME[] = "_Tcl_StaticPackage";
-
-MODULE_SCOPE const char *
-TclStubStaticPackage(Tcl_Interp *interp,
- const char *pkgName,
- Tcl_PackageInitProc *initProc,
- Tcl_PackageInitProc *safeInitProc)
-{
- static void *stubFn = NULL;
- static const char *version = NULL;
-
- if (tclStubsHandle == (void *)-1) {
- fprintf(stderr, "Cannot call %s from stubbed extension\n", PROCNAME + 1);
- abort();
- }
- if (!stubFn) {
- if (!tclStubsHandle) {
- tclStubsHandle = dlopen(TCL_DLL_FILE, RTLD_NOW|RTLD_LOCAL);
- if (!tclStubsHandle) {
- tclStubsPtr->tcl_Panic("Cannot find " TCL_DLL_FILE ": %s\n", dlerror());
- }
- }
- stubFn = dlsym(tclStubsHandle, PROCNAME + 1);
- if (!stubFn) {
- stubFn = dlsym(tclStubsHandle, PROCNAME);
- }
- if (stubFn) {
- version = ((const char *(*)(Tcl_Interp *, const char *, Tcl_PackageInitProc *, Tcl_PackageInitProc *))stubFn)(interp, pkgName, initProc, safeInitProc);
- }
- }
- return version;
-}
-
-/*
- * Local Variables:
- * mode: c
- * c-basic-offset: 4
- * fill-column: 78
- * End:
- */
diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile
index 9d82e42..04c2230 100644
--- a/macosx/GNUmakefile
+++ b/macosx/GNUmakefile
@@ -76,7 +76,7 @@ space := ${empty} ${empty}
objdir = $(subst ${space},\ ,${OBJ_DIR})
develop_make_args := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
-deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip \
+deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install \
EXTRA_CFLAGS=-DNDEBUG
embedded_make_args := EMBEDDED_BUILD=1
install_make_args := INSTALL_BUILD=1
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 75ff0fc..de4d8ee 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -348,8 +348,6 @@ TOMMATH_OBJS = bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o \
STUB_LIB_OBJS = tclStubLib.o \
tclStubCall.o \
- tclStubStaticPackage.o \
- tclStubMainEx.o \
tclStubLibTbl.o \
tclTomMathStubLib.o \
tclOOStubLib.o \
@@ -494,8 +492,6 @@ OO_SRCS = \
STUB_SRCS = \
$(GENERIC_DIR)/tclStubLib.c \
$(GENERIC_DIR)/tclStubCall.c \
- $(GENERIC_DIR)/tclStubStaticPackage.c \
- $(GENERIC_DIR)/tclStubMainEx.c \
$(GENERIC_DIR)/tclStubLibTbl.c \
$(GENERIC_DIR)/tclTomMathStubLib.c \
$(GENERIC_DIR)/tclOOStubLib.c
@@ -970,7 +966,8 @@ install: $(INSTALL_TARGETS)
install-strip:
$(MAKE) $(INSTALL_TARGETS) \
- INSTALL_PROGRAM="$(INSTALL_PROGRAM) ${INSTALL_STRIP_PROGRAM}"
+ INSTALL_PROGRAM="$(INSTALL_PROGRAM) ${INSTALL_STRIP_PROGRAM}" \
+ INSTALL_LIBRARY="$(INSTALL_LIBRARY) ${INSTALL_STRIP_LIBRARY}"
install-binaries: binaries
@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" \
@@ -1920,12 +1917,6 @@ tclStubLib.o: $(GENERIC_DIR)/tclStubLib.c
tclStubCall.o: $(GENERIC_DIR)/tclStubCall.c
$(CC) -c $(STUB_CC_SWITCHES) -DSTATIC_BUILD -DTCL_DLL_FILE="\"$(TCL_LIB_FILE)\"" $(GENERIC_DIR)/tclStubCall.c
-tclStubStaticPackage.o: $(GENERIC_DIR)/tclStubStaticPackage.c
- $(CC) -c $(STUB_CC_SWITCHES) -DSTATIC_BUILD -DTCL_DLL_FILE="\"$(TCL_LIB_FILE)\"" $(GENERIC_DIR)/tclStubStaticPackage.c
-
-tclStubMainEx.o: $(GENERIC_DIR)/tclStubMainEx.c
- $(CC) -c $(STUB_CC_SWITCHES) -DSTATIC_BUILD -DTCL_DLL_FILE="\"$(TCL_LIB_FILE)\"" $(GENERIC_DIR)/tclStubMainEx.c
-
tclStubLibTbl.o: $(GENERIC_DIR)/tclStubLibTbl.c
$(CC) -c $(STUB_CC_SWITCHES) -DSTATIC_BUILD $(GENERIC_DIR)/tclStubLibTbl.c
diff --git a/unix/install-sh b/unix/install-sh
index 7c34c3f..21b733a 100755
--- a/unix/install-sh
+++ b/unix/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-04-20.01; # UTC
+scriptversion=2020-07-26.22; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,25 +35,21 @@ scriptversion=2011-04-20.01; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
+tab=' '
nl='
'
-IFS=" "" $nl"
+IFS=" $tab$nl"
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
-# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -68,22 +64,15 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
-posix_glob='?'
-initialize_posix_glob='
- test "$posix_glob" != "?" || {
- if (set -f) 2>/dev/null; then
- posix_glob=
- else
- posix_glob=:
- fi
- }
-'
-
posix_mkdir=
# Desired mode of installed file.
mode=0755
+# Create dirs (including intermediate dirs) using mode 755.
+# This is like GNU 'install' as of coreutils 8.32 (2020).
+mkdir_umask=22
+
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
@@ -97,7 +86,7 @@ dir_arg=
dst_arg=
copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -120,7 +109,7 @@ Options:
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
- -S $stripprog installed files.
+ -S OPTION $stripprog installed files using OPTION.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
@@ -138,45 +127,60 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
-S) stripcmd="$stripprog $2"
- shift;;
+ shift;;
- -t) dst_arg=$2
- shift;;
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
- -T) no_target_directory=true;;
+ -T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
shift
done
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
@@ -190,6 +194,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
done
fi
@@ -198,12 +206,21 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call `install-sh -d' without argument.
+ # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
@@ -219,16 +236,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -236,9 +253,9 @@ fi
for src
do
- # Protect names starting with `-'.
+ # Protect names problematic for 'test' and other utilities.
case $src in
- -*) src=./$src;;
+ -* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -260,185 +277,150 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
-
dst=$dst_arg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst;;
- esac
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
+ # If destination is a directory, append the input filename.
if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
fi
dstdir=$dst
- dst=$dstdir/`basename "$src"`
+ dstbase=`basename "$src"`
+ case $dst in
+ */) dst=$dst$dstbase;;
+ *) dst=$dst/$dstbase;;
+ esac
dstdir_status=0
else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
+ dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
+ case $dstdir in
+ */) dstdirslash=$dstdir;;
+ *) dstdirslash=$dstdir/;;
+ esac
+
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ # The $RANDOM variable is not portable (e.g., dash). Use it
+ # here however when possible just to lower collision chance.
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+
+ trap '
+ ret=$?
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
+ exit $ret
+ ' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p'.
+ if (umask $mkdir_umask &&
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
- mkdir_mode=
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
+ trap '' 0;;
esac
if
$posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
- # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
- /*) prefix='/';;
- -*) prefix='./';;
- *) prefix='';;
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
esac
- eval "$initialize_posix_glob"
-
oIFS=$IFS
IFS=/
- $posix_glob set -f
+ set -f
set fnord $dstdir
shift
- $posix_glob set +f
+ set +f
IFS=$oIFS
prefixes=
for d
do
- test -z "$d" && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
done
if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
fi
fi
@@ -451,14 +433,25 @@ do
else
# Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
+ dsttmp=${dstdirslash}_inst.$$_
+ rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+ (umask $cp_umask &&
+ { test -z "$stripcmd" || {
+ # Create $dsttmp read-write so that cp doesn't create it read-only,
+ # which would cause strip to fail.
+ if test -z "$doit"; then
+ : >"$dsttmp" # No need to fork-exec 'touch'.
+ else
+ $doit touch "$dsttmp"
+ fi
+ }
+ } &&
+ $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
@@ -473,15 +466,12 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
-
- eval "$initialize_posix_glob" &&
- $posix_glob set -f &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
- $posix_glob set +f &&
-
+ set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
@@ -494,24 +484,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
@@ -520,9 +510,9 @@ do
done
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
-# End:
+# End: \ No newline at end of file
diff --git a/win/Makefile.in b/win/Makefile.in
index 192b1a9..35639f4 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -454,8 +454,6 @@ REG_OBJS = tclWinReg.$(OBJEXT)
STUB_OBJS = \
tclStubLib.$(OBJEXT) \
tclStubCall.$(OBJEXT) \
- tclStubStaticPackage.$(OBJEXT) \
- tclStubMainEx.$(OBJEXT) \
tclStubLibTbl.$(OBJEXT) \
tclTomMathStubLib.$(OBJEXT) \
tclOOStubLib.$(OBJEXT) \
@@ -696,12 +694,6 @@ tclStubLib.${OBJEXT}: tclStubLib.c
tclStubCall.${OBJEXT}: tclStubCall.c
$(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD -DTCL_DLL_FILE="\"$(TCL_DLL_FILE)\"" @DEPARG@ $(CC_OBJNAME)
-tclStubStaticPackage.${OBJEXT}: tclStubStaticPackage.c
- $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD -DTCL_DLL_FILE="\"$(TCL_DLL_FILE)\"" @DEPARG@ $(CC_OBJNAME)
-
-tclStubMainEx.${OBJEXT}: tclStubMainEx.c
- $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD -DTCL_DLL_FILE="\"$(TCL_DLL_FILE)\"" @DEPARG@ $(CC_OBJNAME)
-
tclStubLibTbl.${OBJEXT}: tclStubLibTbl.c
$(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME)
diff --git a/win/makefile.vc b/win/makefile.vc
index 1c51974..a9727b8 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -420,8 +420,6 @@ TCLOBJS = $(COREOBJS) $(ZLIBOBJS) $(TOMMATHOBJS) $(PLATFORMOBJS)
TCLSTUBOBJS = \
$(TMP_DIR)\tclStubLib.obj \
$(TMP_DIR)\tclStubCall.obj \
- $(TMP_DIR)\tclStubStaticPackage.obj \
- $(TMP_DIR)\tclStubMainEx.obj \
$(TMP_DIR)\tclStubLibTbl.obj \
$(TMP_DIR)\tclTomMathStubLib.obj \
$(TMP_DIR)\tclOOStubLib.obj \
@@ -809,12 +807,6 @@ $(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c
$(TMP_DIR)\tclStubCall.obj: $(GENERICDIR)\tclStubCall.c
$(cc32) $(stubscflags) -DTCL_DLL_FILE="\"tcl$(TCL_VERSION)$(SUFX:t=).dll\"" $(TCL_INCLUDES) -Fo$@ $?
-$(TMP_DIR)\tclStubStaticPackage.obj: $(GENERICDIR)\tclStubStaticPackage.c
- $(cc32) $(stubscflags) -DTCL_DLL_FILE="\"tcl$(TCL_VERSION)$(SUFX:t=).dll\"" $(TCL_INCLUDES) -Fo$@ $?
-
-$(TMP_DIR)\tclStubMainEx.obj: $(GENERICDIR)\tclStubMainEx.c
- $(cc32) $(stubscflags) -DTCL_DLL_FILE="\"tcl$(TCL_VERSION)$(SUFX:t=).dll\"" $(TCL_INCLUDES) -Fo$@ $?
-
$(TMP_DIR)\tclStubLibTbl.obj: $(GENERICDIR)\tclStubLibTbl.c
$(cc32) $(stubscflags) $(TCL_INCLUDES) -Fo$@ $?