X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/aa7815f5c6e8e07a85e47df9cd7b579468969efb..490abf53b1391c2bc49564bff71ac400880323ad:/src/complain.c diff --git a/src/complain.c b/src/complain.c index 35a784ee..620e726c 100644 --- a/src/complain.c +++ b/src/complain.c @@ -19,14 +19,10 @@ /* Based on error.c and error.h, written by David MacKenzie . */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include +#include "system.h" #if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC -# if __STDC__ +# ifdef __STDC__ # include # define VA_START(args, lastarg) va_start(args, lastarg) # else @@ -47,18 +43,62 @@ void exit (); #include "complain.h" +#ifndef HAVE_DECL_STRERROR_R +"this configure-time declaration test was not run" +#endif +#if !HAVE_DECL_STRERROR_R +char *strerror_r (); +#endif + #ifndef _ # define _(String) String #endif #ifdef _LIBC /* In the GNU C library, there is a predefined variable for this. */ + # define program_name program_invocation_name +# include + +/* 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 + +# ifdef USE_IN_LIBIO +# include +# define fflush(s) _IO_fflush (s) +# endif + #else /* not _LIBC */ + /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; -#endif + +# ifdef HAVE_STRERROR_R +# define __strerror_r strerror_r +# else +# if HAVE_STRERROR +# ifndef strerror /* On some systems, strerror is a macro */ +char *strerror (); +# endif +# else +static char * +private_strerror (errnum) + int errnum; +{ + extern char *sys_errlist[]; + extern int sys_nerr; + + if (errnum > 0 && errnum <= sys_nerr) + return _(sys_errlist[errnum]); + return _("Unknown system error"); +} +# define strerror private_strerror +# endif /* HAVE_STRERROR */ +# endif /* HAVE_STRERROR_R */ +#endif /* not _LIBC */ /* This variable is incremented each time `warn' is called. */ unsigned int warn_message_count; @@ -75,7 +115,7 @@ int error_one_per_line; `--------------------------------*/ void -#if defined VA_START && __STDC__ +#if defined VA_START && defined __STDC__ warn (const char *message, ...) #else warn (message, va_alist) @@ -127,7 +167,7 @@ warn (message, va_alist) `-----------------------------------------------------------*/ void -#if defined VA_START && __STDC__ +#if defined VA_START && defined __STDC__ complain (const char *message, ...) #else complain (message, va_alist) @@ -177,7 +217,7 @@ complain (message, va_alist) `-------------------------------------------------*/ void -#if defined VA_START && __STDC__ +#if defined VA_START && defined __STDC__ fatal (const char *message, ...) #else fatal (message, va_alist) @@ -215,7 +255,7 @@ fatal (message, va_alist) `------------------------------------------------------------------*/ void -#if defined VA_START && __STDC__ +#if defined VA_START && defined __STDC__ error (int status, int errnum, const char *message, ...) #else