[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch 2/3 for topic/libposix
From: |
Bruno Haible |
Subject: |
Re: Patch 2/3 for topic/libposix |
Date: |
Fri, 12 Nov 2010 04:10:38 +0100 |
User-agent: |
KMail/1.9.9 |
Bruce Korb wrote:
> This patch modifies lib/error.c so that should someone
> call it without having set program_name, then a message
> is printed and abort() called instead of seg faulting.
A link error would be best, to detect this situation.
If we cannot get a link error, an abort() is a small improvement,
but a better improvement would be incorporate code that determines
the program name on platforms like MacOS X, mingw, or HP-UX. (See
progreloc.c.)
> -extern char *program_name;
> +#ifdef HPUX
> +extern
> +#endif
> +char *program_name;
What is this doing? I hope you're not turning a link error into a
runtime error.
Btw, 'HPUX' is not a predefined macro on any platform. For predefined macros,
look at http://predef.sourceforge.net/.
> -#if _LIBC
> - __fxprintf (NULL, "%s:", program_name);
> -#else
> - fprintf (stderr, "%s:", program_name);
> -#endif
> - }
> + pr_prog_name ();
>
> #if _LIBC
> __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
This inserts an additional space in the output. It will then not have the
format "prog:file:line: message" that is standardized in
<http://www.gnu.org/prep/standards/html_node/Errors.html>. Is this intended?
Bruno