X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fxstrerror.c;h=2ea2200e9fcfc86d4a3bf6d4e656b37e963b7fc7;hb=32348c581bf104d46c3fb42a7ff5cefe8ef65f7f;hp=770b653ba8000f1668857df203f96407da3a2179;hpb=d0352a18a504a4e7b761f6b3264cf11347d8d056;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/xstrerror.c b/libiberty/xstrerror.c index 770b653ba8..2ea2200e9f 100644 --- a/libiberty/xstrerror.c +++ b/libiberty/xstrerror.c @@ -2,21 +2,45 @@ Fri Jun 16 18:30:00 1995 Pat Rankin This code is in the public domain. */ +/* + +@deftypefn Replacement char* xstrerror (int @var{errnum}) + +Behaves exactly like the standard @code{strerror} function, but +will never return a @code{NULL} pointer. + +@end deftypefn + +*/ + #include -#include "libiberty.h" #include "config.h" +#include "libiberty.h" #ifdef VMS -#include -#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES) -extern char *strerror PARAMS ((int,...)); -#define DONT_DECLARE_STRERROR -#endif -#endif /* VMS */ +# include +# if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES) +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +extern char *strerror (int,...); +# define DONT_DECLARE_STRERROR +# ifdef __cplusplus +} +# endif /* __cplusplus */ +# endif +#endif /* VMS */ + #ifndef DONT_DECLARE_STRERROR -extern char *strerror PARAMS ((int)); +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +extern char *strerror (int); +# ifdef __cplusplus +} +# endif /* __cplusplus */ #endif /* If strerror returns NULL, we'll format the number into a static buffer. */ @@ -27,15 +51,14 @@ static char xstrerror_buf[sizeof ERRSTR_FMT + 20]; /* Like strerror, but result is never a null pointer. */ char * -xstrerror (errnum) - int errnum; +xstrerror (int errnum) { char *errstr; #ifdef VMS - char *(*vmslib_strerror) PARAMS ((int,...)); + char *(*vmslib_strerror) (int,...); /* Override any possibly-conflicting declaration from system header. */ - vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror; + vmslib_strerror = (char *(*) (int,...)) strerror; /* Second argument matters iff first is EVMSERR, but it's simpler to pass it unconditionally. `vaxc$errno' is declared in and maintained by the run-time library in parallel to `errno'.