bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] progname: also set global program_invocation_name, when poss


From: Sergey Poznyakoff
Subject: Re: [PATCH] progname: also set global program_invocation_name, when possible
Date: Tue, 25 Aug 2009 10:31:26 +0300

Hello, 

> +#if HAVE_DECL_PROGRAM_INVOCATION_NAME
> +  program_invocation_name = (char *) argv0;
> +#endif

In my opinion, that's not correct.  Libc (and gnulib's argp, FWIW) uses
two variables: program_invocation_name, which points to the full program
name as obtained from argv[0], and program_invocation_short_name, which
points to the program name with all leading directories removed.  So,
set_program_name should set program_invocation_name to arg0, and
program_invocation_short_name to part of arg0 after the last directory
separator.

Regards,
Sergey




reply via email to

[Prev in Thread] Current Thread [Next in Thread]