Patch by Jeremy Katz (SF #1609407)
[python.git] / Python / strerror.c
blob55f8342ec4529bfb57cb223d12a9ebb3a028ff8f
2 /* PD implementation of strerror() for systems that don't have it.
3 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
5 #include <stdio.h>
6 #include "Python.h"
8 extern int sys_nerr;
9 extern char *sys_errlist[];
11 char *
12 strerror(int err)
14 static char buf[20];
15 if (err >= 0 && err < sys_nerr)
16 return sys_errlist[err];
17 PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
18 return buf;