1997-08-22 00:57:35 +02:00
|
|
|
/* xstrerror.c -- jacket routine for more robust strerror() usage.
|
|
|
|
Fri Jun 16 18:30:00 1995 Pat Rankin <rankin@eql.caltech.edu>
|
|
|
|
This code is in the public domain. */
|
|
|
|
|
configure.in (MAKEINFO, PERL): Detect these.
* configure.in (MAKEINFO, PERL): Detect these.
(--enable-maintainer-mode): Add.
* configure: Regenerate.
* Makefile.in (MAKEINFO, PERL): Define.
(libiberty.info, libiberty.dvi, libiberty.html): New.
(CFILES): Add bsearch.c.
(CONFIGURED_OFILES): New, list of objects configure might add.
(maint-missing, maint-buildall): New, for maintainers only.
(clean, mostlyclean): Add info/dvi/html files.
* libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New.
* gather-docs: New, for maintainers.
* maint-tool: New, for maintainers.
* alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c,
bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c,
getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c,
memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c,
sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c,
strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c,
tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c,
xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update
documentation.
Co-Authored-By: Phil Edwards <pedwards@disaster.jaj.com>
From-SVN: r45828
2001-09-26 20:16:17 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
@deftypefn Replacement char* xstrerror (int @var{errnum})
|
|
|
|
|
|
|
|
Behaves exactly like the standard @code{strerror} function, but
|
alloca.c, [...]: Improve manual formatting.
* alloca.c, clock.c, getcwd.c, getpagesize.c, getpwd.c, index.c,
libiberty.texi, memchr.c, putenv.c, rindex.c, strchr.c, strdup.c,
strerror.c, strrchr.c, strstr.c, strtod.c, tmpnam.c, vfork.c,
xatexit.c, xmalloc.c, xstrerror.c: Improve manual formatting. Fix
spelling. Give names to function arguments in documentation. Use
(void) prototypes in documentation.
* functions.texi: Regenerate.
From-SVN: r46068
2001-10-07 23:53:31 +02:00
|
|
|
will never return a @code{NULL} pointer.
|
configure.in (MAKEINFO, PERL): Detect these.
* configure.in (MAKEINFO, PERL): Detect these.
(--enable-maintainer-mode): Add.
* configure: Regenerate.
* Makefile.in (MAKEINFO, PERL): Define.
(libiberty.info, libiberty.dvi, libiberty.html): New.
(CFILES): Add bsearch.c.
(CONFIGURED_OFILES): New, list of objects configure might add.
(maint-missing, maint-buildall): New, for maintainers only.
(clean, mostlyclean): Add info/dvi/html files.
* libiberty.texi, copying-lib.texi, obstacks.texi, functions.texi: New.
* gather-docs: New, for maintainers.
* maint-tool: New, for maintainers.
* alloca.c, atexit.c, basename.c, bcmp.c, bcopy.c, bsearch.c,
bzero.c, calloc.c, clock.c, configure.in, configure, getcwd.c,
getpagesize.c, getpwd.c, index.c, memchr.c, memcmp.c, memcpy.c,
memmove.c, memset.c, putenv.c, rename.c, rindex.c, setenv.c,
sigsetmask.c, strcasecmp.c, strchr.c, strdup.c, strerror.c,
strncasecmp.c, strncmp.c, strrchr.c, strstr.c, strtod.c, strtol.c,
tmpnam.c, vfork.c, vprintf.c, waitpid.c, xatexit.c, xexit.c,
xmalloc.c, xmemdup.c, xstrdup.c, xstrerror.c: Add or update
documentation.
Co-Authored-By: Phil Edwards <pedwards@disaster.jaj.com>
From-SVN: r45828
2001-09-26 20:16:17 +02:00
|
|
|
|
|
|
|
@end deftypefn
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
1997-08-22 00:57:35 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "libiberty.h"
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifdef VMS
|
|
|
|
#include <errno.h>
|
|
|
|
#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES)
|
|
|
|
extern char *strerror PARAMS ((int,...));
|
|
|
|
#define DONT_DECLARE_STRERROR
|
|
|
|
#endif
|
|
|
|
#endif /* VMS */
|
|
|
|
|
|
|
|
#ifndef DONT_DECLARE_STRERROR
|
|
|
|
extern char *strerror PARAMS ((int));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* If strerror returns NULL, we'll format the number into a static buffer. */
|
|
|
|
|
|
|
|
#define ERRSTR_FMT "undocumented error #%d"
|
|
|
|
static char xstrerror_buf[sizeof ERRSTR_FMT + 20];
|
|
|
|
|
|
|
|
/* Like strerror, but result is never a null pointer. */
|
|
|
|
|
|
|
|
char *
|
|
|
|
xstrerror (errnum)
|
|
|
|
int errnum;
|
|
|
|
{
|
|
|
|
char *errstr;
|
|
|
|
#ifdef VMS
|
|
|
|
char *(*vmslib_strerror) PARAMS ((int,...));
|
|
|
|
|
|
|
|
/* Override any possibly-conflicting declaration from system header. */
|
|
|
|
vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror;
|
|
|
|
/* Second argument matters iff first is EVMSERR, but it's simpler to
|
|
|
|
pass it unconditionally. `vaxc$errno' is declared in <errno.h>
|
|
|
|
and maintained by the run-time library in parallel to `errno'.
|
|
|
|
We assume that `errnum' corresponds to the last value assigned to
|
|
|
|
errno by the run-time library, hence vaxc$errno will be relevant. */
|
|
|
|
errstr = (*vmslib_strerror) (errnum, vaxc$errno);
|
|
|
|
#else
|
|
|
|
errstr = strerror (errnum);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* If `errnum' is out of range, result might be NULL. We'll fix that. */
|
|
|
|
if (!errstr)
|
|
|
|
{
|
|
|
|
sprintf (xstrerror_buf, ERRSTR_FMT, errnum);
|
|
|
|
errstr = xstrerror_buf;
|
|
|
|
}
|
|
|
|
return errstr;
|
|
|
|
}
|