diff options
author | Raja R Harinath <harinath@src.gnome.org> | 1998-08-02 22:05:26 +0000 |
---|---|---|
committer | Raja R Harinath <harinath@src.gnome.org> | 1998-08-02 22:05:26 +0000 |
commit | 29adbf48b22634002c6b0f5a848c84a6477370b1 (patch) | |
tree | 09574cbcf588a73e027f9f1970489f487f90373c | |
parent | 951c2d7cd8b3ecdacc8fed30bbf9e9dedece102c (diff) | |
download | gnome-common-29adbf48b22634002c6b0f5a848c84a6477370b1.tar.gz |
Clean up #ifdef logic some more. (HAVE_STRERROR_R): Step on implementation
* error.c (program_name): Clean up #ifdef logic some more.
(HAVE_STRERROR_R): Step on implementation namespace only if _LIBC.
svn path=/trunk/; revision=316
-rw-r--r-- | support/ChangeLog | 5 | ||||
-rw-r--r-- | support/error.c | 29 |
2 files changed, 21 insertions, 13 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 0cebdab..f1ddcce 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,8 @@ +1998-08-02 Raja R Harinath <harinath@cs.umn.edu> + + * error.c (program_name): Clean up #ifdef logic some more. + (HAVE_STRERROR_R): Step on implementation namespace only if _LIBC. + 1998-07-30 Martin Baulig <martin@home-of-linux.org> * error.c: Making weak alias `__error' and `__error_at_line' diff --git a/support/error.c b/support/error.c index d3e9fcb..b0264bc 100644 --- a/support/error.c +++ b/support/error.c @@ -67,28 +67,31 @@ void (*error_print_progname) ( /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; -#if defined _LIBC || HAVE_PROGRAM_INVOCATION_NAME +#if HAVE_PROGRAM_INVOCATION_NAME || _LIBC /* In the GNU C library, there is a predefined variable for this. */ # define program_name program_invocation_name # include <errno.h> -#if defined _LIBC +#else + +/* The calling program should define program_name and set it to the + name of the executing program. */ +extern char *program_name; + +#endif + +#ifdef _LIBC /* In GNU libc we want do not want to use the common name `error' directly. Instead make it a weak alias. */ # define error __error # define error_at_line __error_at_line -#endif /* _LIBC */ -#else /* not _LIBC */ +# define strerror_r __strerror_r -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; +#else /* not _LIBC */ -# ifdef HAVE_STRERROR_R -# define __strerror_r strerror_r -# else +# if ! HAVE_STRERROR_R # if HAVE_STRERROR # ifndef strerror /* On some systems, strerror is a macro */ char *strerror (); @@ -107,7 +110,7 @@ private_strerror (errnum) } # define strerror private_strerror # endif /* HAVE_STRERROR */ -# endif /* HAVE_STRERROR_R */ +# endif /* ! HAVE_STRERROR_R */ #endif /* not _LIBC */ /* Print the program name and error message MESSAGE, which is a printf-style @@ -156,7 +159,7 @@ error (status, errnum, message, va_alist) { #if defined HAVE_STRERROR_R || defined _LIBC char errbuf[1024]; - fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf)); + fprintf (stderr, ": %s", strerror_r (errnum, errbuf, sizeof errbuf)); #else fprintf (stderr, ": %s", strerror (errnum)); #endif @@ -231,7 +234,7 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist) { #if defined HAVE_STRERROR_R || defined _LIBC char errbuf[1024]; - fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf)); + fprintf (stderr, ": %s", strerror_r (errnum, errbuf, sizeof errbuf)); #else fprintf (stderr, ": %s", strerror (errnum)); #endif |