PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
strerror.c
Go to the documentation of this file.
1 /* src/port/strerror.c */
2 
3 /*
4  * strerror - map error number to descriptive string
5  *
6  * This version is obviously somewhat Unix-specific.
7  *
8  * based on code by Henry Spencer
9  * modified for ANSI by D'Arcy J.M. Cain
10  */
11 
12 #include "c.h"
13 
14 
15 extern const char *const sys_errlist[];
16 extern int sys_nerr;
17 
18 const char *
19 strerror(int errnum)
20 {
21  static char buf[24];
22 
23  if (errnum < 0 || errnum > sys_nerr)
24  {
25  sprintf(buf, _("unrecognized error %d"), errnum);
26  return buf;
27  }
28 
29  return sys_errlist[errnum];
30 }
int sys_nerr
static char * buf
Definition: pg_test_fsync.c:67
const char *const sys_errlist[]
const char * strerror(int errnum)
Definition: strerror.c:19
#define _(x)
Definition: elog.c:84