summaryrefslogtreecommitdiffstats
path: root/win/tkWinInit.c
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2002-01-29 20:51:24 (GMT)
committerandreas_kupries <akupries@shaw.ca>2002-01-29 20:51:24 (GMT)
commit5310e9653a49ae3827c4149151c21fc9c5ce1c07 (patch)
treec0f511f0a8b4cd96d0ba2e976d82b11653d4432e /win/tkWinInit.c
parent1c041c5380b764bed95e621f15a17c24a2d558e4 (diff)
downloadtk-5310e9653a49ae3827c4149151c21fc9c5ce1c07.zip
tk-5310e9653a49ae3827c4149151c21fc9c5ce1c07.tar.gz
tk-5310e9653a49ae3827c4149151c21fc9c5ce1c07.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.
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);
}