[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: determining the program_invocation_name
From: |
Eric Blake |
Subject: |
Re: determining the program_invocation_name |
Date: |
Mon, 27 Dec 2010 09:47:21 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
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 address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature