[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getprogname
From: |
Paul Eggert |
Subject: |
Re: getprogname |
Date: |
Tue, 10 Jan 2006 12:37:37 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Well, my intention is basically this:
A few comments.....
This isn't as compatible as possible with BSD, as BSD setprogname
ignores its argument when the true program name is available from
the operating system.
LibGW32C-0.3 has getexecname (see
<http://sourceforge.net/project/shownotes.php?release_id=154242>), so
that function is not unique to Solaris.
I just looked it up, and on Solaris, getexecname might fail and return
NULL, on programs that are linked statically.
Surely you meant base_name rather than basename?
How about something like this instead?
#if !HAVE_GETEXECNAME
# define getexecname() NULL
#endif
#if !HAVE_GETPROGNAME
static const char *progname;
void
setprogname (const char *arg)
{
progname = arg;
}
const char *
getprogname ()
{
#if HAVE_PROGRAM_INVOCATION_SHORT_NAME /* glibc */
return program_invocation_short_name;
#else
const char *p = getexecname ();
return base_name (p ? p : progname);
#endif
}
#endif
- Re: use of program_name, (continued)
- Re: use of program_name, Sergey Poznyakoff, 2006/01/06
- Re: use of program_name, Dave Love, 2006/01/06
- Re: [bug-gnulib] Re: use of program_name, Bruno Haible, 2006/01/09
- use of -fno-common on Darwin (was: use of program_name), Ralf Wildenhues, 2006/01/09
- Re: use of -fno-common on Darwin, Peter O'Gorman, 2006/01/09
- Re: use of -fno-common on Darwin, Paul Eggert, 2006/01/09
- Re: use of -fno-common on Darwin, Bob Friesenhahn, 2006/01/10
- Re: use of -fno-common on Darwin, Bruno Haible, 2006/01/10
- Re: use of -fno-common on Darwin, Peter O'Gorman, 2006/01/10
- Re: getprogname, Bruno Haible, 2006/01/10
- Re: getprogname,
Paul Eggert <=
- Re: getprogname, Bruno Haible, 2006/01/10
- Re: getprogname, Paul Eggert, 2006/01/11
- Re: use of -fno-common on Darwin, James Youngman, 2006/01/10
- Re: getprogname, Bruno Haible, 2006/01/11
- Re: getprogname, Paul Eggert, 2006/01/11
- Re: [bug-gnulib] Re: use of program_name, Bruno Haible, 2006/01/09
- Re: use of program_name, James Youngman, 2006/01/05
- Re: [bug-gnulib] Re: use of program_name, Bruno Haible, 2006/01/09
- Re: [bug-gnulib] Re: use of program_name, James Youngman, 2006/01/09
- Re: use of program_name, Dave Love, 2006/01/05