summaryrefslogtreecommitdiffstats
path: root/win/tkWinInit.c
diff options
context:
space:
mode:
authorandreas_kupries <andreas_kupries@noemail.net>2002-01-29 20:51:23 (GMT)
committerandreas_kupries <andreas_kupries@noemail.net>2002-01-29 20:51:23 (GMT)
commit40e339a2fb0755adfdee9a57ab56660a7610755b (patch)
treec0f511f0a8b4cd96d0ba2e976d82b11653d4432e /win/tkWinInit.c
parent53425bf32c857bab191360214ab390fc83e4b9b2 (diff)
downloadtk-40e339a2fb0755adfdee9a57ab56660a7610755b.zip
tk-40e339a2fb0755adfdee9a57ab56660a7610755b.tar.gz
tk-40e339a2fb0755adfdee9a57ab56660a7610755b.tar.bz2
* win/tkWinInit.c (TkpGetAppName): TIP 27 fixup. The code now does
not write into the CONST path returned by "argv0" and Tcl_SplitPath anymore. FossilOrigin-Name: 6b1785497d20fd266cac609d492d2d09e65a5136
Diffstat (limited to 'win/tkWinInit.c')
-rw-r--r--win/tkWinInit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index ad3006a..ab8e2ae 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.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: tkWinInit.c,v 1.7 2002/01/25 21:09:37 dgp Exp $
+ * RCS: @(#) $Id: tkWinInit.c,v 1.8 2002/01/29 20:51:24 andreas_kupries Exp $
*/
#include "tkWinInt.h"
@@ -75,17 +75,18 @@ TkpGetAppName(interp, namePtr)
Tcl_Interp *interp;
Tcl_DString *namePtr; /* A previously initialized Tcl_DString. */
{
- int argc;
+ int argc, namelength;
CONST char **argv = NULL, *name, *p;
name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
+ namelength = -1;
if (name != NULL) {
Tcl_SplitPath(name, &argc, &argv);
if (argc > 0) {
name = argv[argc-1];
p = strrchr(name, '.');
if (p != NULL) {
- *p = '\0';
+ namelength = p - name;
}
} else {
name = NULL;
@@ -93,8 +94,9 @@ TkpGetAppName(interp, namePtr)
}
if ((name == NULL) || (*name == 0)) {
name = "tk";
+ namelength = -1;
}
- Tcl_DStringAppend(namePtr, name, -1);
+ Tcl_DStringAppend(namePtr, name, namelength);
if (argv != NULL) {
ckfree((char *)argv);
}