Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | /*********************************************************** |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 2 | Copyright (c) 2000, BeOpen.com. |
| 3 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 4 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 5 | All rights reserved. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 6 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 7 | See the file "Misc/COPYRIGHT" for information on usage and |
| 8 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 9 | ******************************************************************/ |
| 10 | |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 11 | /* PD implementation of strerror() for systems that don't have it. |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 12 | Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */ |
| 13 | |
| 14 | #include <stdio.h> |
| 15 | |
| 16 | extern int sys_nerr; |
| 17 | extern char *sys_errlist[]; |
| 18 | |
| 19 | char * |
| 20 | strerror(err) |
| 21 | int err; |
| 22 | { |
| 23 | static char buf[20]; |
| 24 | if (err >= 0 && err < sys_nerr) |
| 25 | return sys_errlist[err]; |
| 26 | sprintf(buf, "Unknown errno %d", err); |
| 27 | return buf; |
| 28 | } |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 29 | |
Guido van Rossum | 1d5735e | 1994-08-30 08:27:36 +0000 | [diff] [blame] | 30 | #ifdef macintosh |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 31 | int sys_nerr = 0; |
| 32 | char *sys_errlist[1] = 0; |
| 33 | #endif |