[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?

# define getexecname() NULL


static const char *progname;

setprogname (const char *arg)
  progname = arg;

const char *
getprogname ()
  return program_invocation_short_name;
  const char *p = getexecname ();
  return base_name (p ? p : progname);


reply via email to

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