OSDN Git Service

Use _() macro consistently rather than gettext(). Add translation
[pg-rex/syncrep.git] / src / port / strerror.c
1 /* $PostgreSQL: pgsql/src/port/strerror.c,v 1.4 2005/02/22 04:43:16 momjian Exp $ */
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 <string.h>
13 #include <stdio.h>
14 #include <errno.h>
15
16 extern const char *const sys_errlist[];
17 extern int      sys_nerr;
18
19 const char *
20 strerror(int errnum)
21 {
22         static char buf[24];
23
24         if (errnum < 0 || errnum > sys_nerr)
25         {
26                 sprintf(buf, _("unrecognized error %d"), errnum);
27                 return buf;
28         }
29
30         return sys_errlist[errnum];
31 }