On Tue, Jan 10, 2006 at 11:07:20PM +0900, Peter O'Gorman wrote:

> char *
> get_prog_name(void)
> {
>       char * name;
>       if (prog_name)
>               name = prog_name;
>       else
>       {
> #if defined(HAVE_GETPROGNAME)
> #include <stdlib.h>
>               name = getprogname();
> #elif defined(HAVE_GETEXECNAME)
> #include <stdlib.h>
>               name = getexecname();
> #elif defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
> #include <errno.h>
>               name = program_invocation_short_name;
> #else
>               name = "executable";
> #endif
>       }
>       return name;
> }

If we adopted this code, application authors would still be obliged to
call set_program_name() since there would still be platforms where the 

>               name = "executable";

clause is executed.  However, this clause will only be exercised on
some systems, so having a good default here simply helps to mask bugs.
This is especially unfortunate where developers have a machine which
can figure out the executable name unaided, but end-users don't.

James.



_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to