diff options
author | bch <brad.harder@gmail.com> | 2022-01-28 23:52:10 (GMT) |
---|---|---|
committer | bch <brad.harder@gmail.com> | 2022-01-28 23:52:10 (GMT) |
commit | 95bcc538075fc86ab77313a173e2c4ce89a38f0d (patch) | |
tree | 6ada97c4d4cd3bcf807a503853a5c6b38dd99ea2 /generic | |
parent | cc66f3601ff68b38489ca84cb582dbbe3ea804ef (diff) | |
download | tcl-95bcc538075fc86ab77313a173e2c4ce89a38f0d.zip tcl-95bcc538075fc86ab77313a173e2c4ce89a38f0d.tar.gz tcl-95bcc538075fc86ab77313a173e2c4ce89a38f0d.tar.bz2 |
take advantage of what we know re: argv guarantees [https://www.iso-9899.info/n1570.html#5.1.2.2.1|argv spec] (per @cousteau on #tcl)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclMain.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c index f1b1ae2..be9ec4c 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -288,7 +288,6 @@ Tcl_MainEx( * but before starting to execute commands. */ Tcl_Interp *interp) { - char *progname = NULL; /* may/may-not be able to use argv[0] */ int i=0; /* argv[i] index */ Tcl_Obj *path, *resultPtr, *argvPtr, *appName; const char *encodingName = NULL; @@ -299,13 +298,12 @@ Tcl_MainEx( TclpSetInitialEncodings(); if (0 < argc) { - progname = argv[0]; - --argc; /* consume argv[0] */ + --argc; /* "consume" argv[0] */ ++i; } - TclpFindExecutable ((const char *)progname); /* nb: this could be NULL - * w/ (eg) a malformed - * execve() */ + TclpFindExecutable ((const char *)argv [0]); /* nb: this could be NULL + * w/ (eg) an empty argv + * supplied to execve() */ Tcl_InitMemory(interp); @@ -345,7 +343,7 @@ Tcl_MainEx( path = Tcl_GetStartupScript(&encodingName); if (path == NULL) { - appName = NewNativeObj(progname); + appName = NewNativeObj(argv[0]); } else { appName = path; } |