summaryrefslogtreecommitdiffstats
path: root/Python/strerror.c
blob: a78b9173c9b1a26b275ae6a2ae80c8e7161a5f52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* PD implementation of strerror() for BSD derivatives that don't have it.
   Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */

#include <stdio.h>

extern int sys_nerr;
extern char *sys_errlist[];

char *
strerror(err)
	int err;
{
	static char buf[20];
	if (err >= 0 && err < sys_nerr)
		return sys_errlist[err];
	sprintf(buf, "Unknown errno %d", err);
	return buf;
}