blob: b803b29835e00af826a6c85fd359e237a34ca910 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001
Guido van Rossum3d54f2d1990-11-02 17:51:17 +00002/* PD implementation of strerror() for systems that don't have it.
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00003 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
4
5#include <stdio.h>
6
7extern int sys_nerr;
8extern char *sys_errlist[];
9
10char *
Thomas Woutersf70ef4f2000-07-22 18:47:25 +000011strerror(int err)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000012{
13 static char buf[20];
14 if (err >= 0 && err < sys_nerr)
15 return sys_errlist[err];
16 sprintf(buf, "Unknown errno %d", err);
17 return buf;
18}
Guido van Rossum3d54f2d1990-11-02 17:51:17 +000019
Guido van Rossum1d5735e1994-08-30 08:27:36 +000020#ifdef macintosh
Guido van Rossum3d54f2d1990-11-02 17:51:17 +000021int sys_nerr = 0;
22char *sys_errlist[1] = 0;
23#endif