* 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.
This commit is contained in:
Corinna Vinschen 2002-06-27 16:01:38 +00:00
parent 196cdd45f6
commit eba23038af
2 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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. */