postgresql/src/port/strerror.c

31 lines
502 B
C
Raw Normal View History

2010-09-20 22:08:53 +02:00
/* src/port/strerror.c */
/*
* strerror - map error number to descriptive string
*
* This version is obviously somewhat Unix-specific.
*
* based on code by Henry Spencer
* modified for ANSI by D'Arcy J.M. Cain
*/
#include "c.h"
extern const char *const sys_errlist[];
extern int sys_nerr;
const char *
strerror(int errnum)
{
static char buf[24];
if (errnum < 0 || errnum > sys_nerr)
{
sprintf(buf, _("unrecognized error %d"), errnum);
1998-09-01 05:29:17 +02:00
return buf;
}
1998-09-01 05:29:17 +02:00
return sys_errlist[errnum];
}