pkgsrc/pkgtools/libnbcompat/files/strerror.c
jlam f8dd961144 Update pkgtools/libnbcompat to 20040822. Changes from version 20040814
include:

* Rework the way that poll() is detected so that it more closely
  follows how the rest of the replacement functions are detected.

* Split err*() and warn*() functions into separate err.c and warn.c
  files so that we can more finely isolate the objects files pulled
  in by the linker.  This should fix building textproc/nbsed on Solaris.

* Move more definitions from nbcompat.h into nbcompat/*.h.  This makes
  it more clear which NetBSD headers are expected to provide which
  function declarations and macro definitions.

* Clean out nbconfig.h by moving all of the relevant definitions into
  the correct nbcompat/*.h files.

* Update all of the library functions to the latest from src HEAD.
  Also change the way that sources are modified when imported -- we
  now include <nbcompat.h> before the first system header, include
  <nbcompat/*.h> versions of headers instead of system ones where
  available, and "#if 0" the sections that make no sense when being
  built outside of the NetBSD source tree.  This should make future
  updates from src HEAD, e.g. for security updates or bug fixes,
  easier.

* Move all private headers into a subdirectory and include the headers
  from the private directory.  This avoids any nameclashes with system
  headers with the same name.
2004-08-23 03:32:12 +00:00

20 lines
378 B
C

/* $NetBSD: strerror.c,v 1.2 2004/08/23 03:32:12 jlam Exp $ */
#include <nbcompat.h>
#include <nbcompat/string.h>
char *
strerror(int n)
{
static char msg[] = "Unknown error (1234567890)";
extern int sys_nerr;
extern char *sys_errlist[];
if (n >= sys_nerr) {
snprintf(msg, sizeof(msg), "Unknown error (%d)", n);
return(msg);
} else {
return(sys_errlist[n]);
}
}