diff options
author | bch <brad.harder@gmail.com> | 2022-01-29 00:13:14 (GMT) |
---|---|---|
committer | bch <brad.harder@gmail.com> | 2022-01-29 00:13:14 (GMT) |
commit | 7fc2a5ab3094bee1c0945f828ab784d9d04af625 (patch) | |
tree | 70def734a32a257470b2e419433fcb7d7660cc2f /generic | |
parent | 43b31960b76a22c951489e76a812d22fae7582e2 (diff) | |
download | tcl-7fc2a5ab3094bee1c0945f828ab784d9d04af625.zip tcl-7fc2a5ab3094bee1c0945f828ab784d9d04af625.tar.gz tcl-7fc2a5ab3094bee1c0945f828ab784d9d04af625.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 | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c index de745bd..a26577e 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] */ ++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; } |