On 12/24/2010 02:41 PM, Bruno Haible wrote:
> Hi,
> 
> How can some library code determine the name of the running program,
> for error message and display purposes, if the program's main() function
> has not stored argv[0] in a particular place?
> 
> Let's be clear about two things:
> 
>   1) This question is mostly irrelevant for libposix, because library
>      functions in libposix should not call exit() and should not print
>      error messages. The only ways out that a library function has is
>      to call abort() if there was a programming error, and to return
>      an error code or error message that the caller can then handle.
> 
>   2) Even if we find an answer to this question, it does not magically
>      resolve all problems with the 'error' module, because the question
>      remains where the 'program_name' variable shall be allocated,
>      and it is a portability problem for MacOS X, AIX, Solaris, Cygwin [1].

FYI - cygwin 1.7.8 (probably being released in January) just added
support for program_invocation_name and program_invocation_short_name,
in order to be more like glibc:

http://cygwin.com/ml/cygwin-cvs/2010-q4/msg00047.html

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to