Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 2 | /* PD implementation of strerror() for systems that don't have it. |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 3 | Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */ |
| 4 | |
| 5 | #include <stdio.h> |
| 6 | |
| 7 | extern int sys_nerr; |
| 8 | extern char *sys_errlist[]; |
| 9 | |
| 10 | char * |
Thomas Wouters | f70ef4f | 2000-07-22 18:47:25 +0000 | [diff] [blame] | 11 | strerror(int err) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 12 | { |
| 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 Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 19 | |
Guido van Rossum | 1d5735e | 1994-08-30 08:27:36 +0000 | [diff] [blame] | 20 | #ifdef macintosh |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 21 | int sys_nerr = 0; |
| 22 | char *sys_errlist[1] = 0; |
| 23 | #endif |