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 * |
Thomas Wouters | f70ef4f | 2000-07-22 18:47:25 +0000 | [diff] [blame^] | 20 | strerror(int err) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 21 | { |
| 22 | static char buf[20]; |
| 23 | if (err >= 0 && err < sys_nerr) |
| 24 | return sys_errlist[err]; |
| 25 | sprintf(buf, "Unknown errno %d", err); |
| 26 | return buf; |
| 27 | } |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 28 | |
Guido van Rossum | 1d5735e | 1994-08-30 08:27:36 +0000 | [diff] [blame] | 29 | #ifdef macintosh |
Guido van Rossum | 3d54f2d | 1990-11-02 17:51:17 +0000 | [diff] [blame] | 30 | int sys_nerr = 0; |
| 31 | char *sys_errlist[1] = 0; |
| 32 | #endif |