Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-06-27 20:01:38 +0400
committerCorinna Vinschen <corinna@vinschen.de>2002-06-27 20:01:38 +0400
commiteba23038af62124b3e75016f9b7294637e7022c2 (patch)
tree2be025435d65063973d3e4fa9dfea0e6f975af73
parent196cdd45f6895b3901ec8925020995fbce38bd7f (diff)
* dcrt0.cc (dll_crt0_1): Let __progname point to the applications
basename. Move eliminating ".exe" suffix from argv[0] so that it always also affects __progname.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/dcrt0.cc14
2 files changed, 16 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 871ab64f2..b6e99f0e1 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-27 Corinna Vinschen <corinna@vinschen.de>
+
+ * dcrt0.cc (dll_crt0_1): Let __progname point to the applications
+ basename. Move eliminating ".exe" suffix from argv[0] so that it
+ always also affects __progname.
+
2002-06-27 Thomas Pfaff <tpfaff@gmx.net>
* thread.cc (pthread::create): Added trace printf to get CreateThread
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index da2865112..a27e8e4eb 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -704,9 +704,6 @@ dll_crt0_1 ()
{
char *new_argv0 = (char *) alloca (MAX_PATH);
cygwin_conv_to_posix_path (__argv[0], new_argv0);
- char *p = strchr (new_argv0, '\0') - 4;
- if (p > new_argv0 && strcasematch (p, ".exe"))
- *p = '\0';
__argv[0] = new_argv0;
}
}
@@ -719,7 +716,16 @@ dll_crt0_1 ()
cygheap->fdtab.stdio_init ();
/* Set up __progname for getopt error call. */
- __progname = __argv[0];
+ if (__argv[0] && (__progname = strrchr (__argv[0], '/')))
+ ++__progname;
+ else
+ __progname = __argv[0];
+ if (__progname)
+ {
+ char *cp = strchr (__progname, '\0') - 4;
+ if (cp > __progname && strcasematch (cp, ".exe"))
+ *cp = '\0';
+ }
/* Set new console title if appropriate. */