1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Move libc replacement files from src/backend/port to src/port.

This commit is contained in:
Bruce Momjian
2002-07-18 04:13:59 +00:00
parent 7f43165dd2
commit 404e9a12a5
19 changed files with 221 additions and 48 deletions

31
src/port/strerror.c Normal file
View File

@ -0,0 +1,31 @@
/* $Id: strerror.c,v 1.1 2002/07/18 04:13:59 momjian Exp $ */
/*
* 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 <string.h>
#include <stdio.h>
#include <errno.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, "unknown error %d", errnum);
return buf;
}
return sys_errlist[errnum];
}