2005-07-28 06:03:14 +02:00
|
|
|
/* $PostgreSQL: pgsql/src/port/strerror.c,v 1.5 2005/07/28 04:03:14 tgl Exp $ */
|
1997-12-19 14:35:17 +01:00
|
|
|
|
1997-03-19 03:37:42 +01:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2005-07-28 06:03:14 +02:00
|
|
|
#include "c.h"
|
|
|
|
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
extern const char *const sys_errlist[];
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int sys_nerr;
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
const char *
|
1997-03-19 03:37:42 +01:00
|
|
|
strerror(int errnum)
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
static char buf[24];
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
if (errnum < 0 || errnum > sys_nerr)
|
|
|
|
{
|
2005-02-22 05:43:23 +01:00
|
|
|
sprintf(buf, _("unrecognized error %d"), errnum);
|
1998-09-01 05:29:17 +02:00
|
|
|
return buf;
|
1997-09-07 07:04:48 +02:00
|
|
|
}
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return sys_errlist[errnum];
|
1997-03-19 03:37:42 +01:00
|
|
|
}
|