Mercurial > cpython-lru_cache-weakref
annotate Python/strerror.c @ 6:fc6fcd7df4f7 legacy-trunk
Initial revision
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sun, 14 Oct 1990 12:07:46 +0000 |
| parents | |
| children | 5c4dd9348e81 |
| rev | line source |
|---|---|
| 6 | 1 /* PD implementation of strerror() for BSD derivatives that don't have it. |
| 2 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */ | |
| 3 | |
| 4 #include <stdio.h> | |
| 5 | |
| 6 extern int sys_nerr; | |
| 7 extern char *sys_errlist[]; | |
| 8 | |
| 9 char * | |
| 10 strerror(err) | |
| 11 int err; | |
| 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 } |
