+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
{
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;
}
}
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. */