/* 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);
FIXME: This should only be done when explicitly opening the com
port. It should not be reset if an fd is inherited.
- Using __progname in this way, to determine how far along in the
- initialization we are, is really a terrible kludge and should
- be fixed ASAP.
+ Using program_invocation_short_name in this way, to determine how far
+ along in the initialization we are, is really a terrible kludge and
+ should be fixed ASAP.
*/
- if (reset_com && __progname)
+ if (reset_com && program_invocation_short_name)
{
DCB state;
GetCommState (get_handle (), &state);
#undef _ROU
char **environ;
- /* __progname used in getopt error message */
- char *__progname;
- char *program_invocation_name;
+ /* __progname used in getopt error message is an alias of
+ program_invocation_short_name. */
char *program_invocation_short_name;
+ char *program_invocation_name;
static MTinterface _mtinterf;
struct per_process __cygwin_user_data =
{/* initial_sp */ 0, /* magic_biscuit */ 0,
};
int NO_COPY __api_fatal_exit_val = 1;
+
+EXPORT_ALIAS (program_invocation_short_name, __progname)
s/\s+\n/\n/sog;
s/\n[^\n]*!globals.h[^\n]*\n/\n/sog;
s%/\*.*?\*/%%sog;
+s/EXPORT_ALIAS.*\n//so;
s/(enum\s.*?{.*?})/munge($1)/soge;
s/^(\s*)([a-zA-Z_])/$1extern $2/mog;
s/extern (extern|enum)/$1/sog;
{
PWCHAR pn = NULL;
WCHAR progname[NAME_MAX];
- if (cygwin_finished_initializing && __progname)
+ if (cygwin_finished_initializing && program_invocation_short_name)
{
- char *p = strrchr (__progname, '/');
+ char *p = strrchr (program_invocation_short_name, '/');
if (p)
++p;
else
- p = __progname;
+ p = program_invocation_short_name;
char *pe = strrchr (p, '.');
if (!pe || !ascii_strcasematch (pe, ".exe"))
pe = strrchr (p, '\0');