diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2024-01-31 15:21:31 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2024-01-31 20:11:58 +0100 |
commit | b2476bc5232246278bc6a40e812785270bccb668 (patch) | |
tree | 17d28f501d2ce2dd74ea552f1afd3a7070cae862 /winsup/cygwin/dcrt0.cc | |
parent | bded8091c438d18e1d259864d773891a747c7576 (diff) | |
download | newlib-b2476bc5232246278bc6a40e812785270bccb668.zip newlib-b2476bc5232246278bc6a40e812785270bccb668.tar.gz newlib-b2476bc5232246278bc6a40e812785270bccb668.tar.bz2 |
Cygwin: globals: make __progname an alias of program_invocation_short_name
On Linux, __progname and program_invocation_short_name are just
different exported names of the same string. Do the same in Cygwin.
This requires to tweak the mkglobals_h so as not to touch the
EXPORT_ALIAS expression. Also, use the base variable
program_invocation_short_name throughout. __progname is just
the export for getopt.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index fc1eec7..a40129c 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -924,17 +924,17 @@ dll_crt0_1 (void *) /* Set up standard fds in file descriptor table. */ cygheap->fdtab.stdio_init (); - /* Set up __progname for getopt error call. */ - if (__argv[0] && (__progname = strrchr (__argv[0], '/'))) - ++__progname; - else - __progname = __argv[0]; + /* Set up program_invocation_name and program_invocation_short_name. + __progname is an export alias for program_invocation_short_name. */ program_invocation_name = __argv[0]; - program_invocation_short_name = __progname; - if (__progname) + if (__argv[0] && (program_invocation_short_name = strrchr (__argv[0], '/'))) + ++program_invocation_short_name; + else + program_invocation_short_name = __argv[0]; + if (program_invocation_short_name) { - char *cp = strchr (__progname, '\0') - 4; - if (cp > __progname && ascii_strcasematch (cp, ".exe")) + char *cp = strchr (program_invocation_short_name, '\0') - 4; + if (cp > program_invocation_short_name && ascii_strcasematch (cp, ".exe")) *cp = '\0'; } SetThreadName (GetCurrentThreadId (), program_invocation_short_name); |