Mercurial > cpython-lru_cache-weakref
annotate Python/strerror.c @ 33318:b57612f61ba3 legacy-trunk
Centralize WITH_TSC processing.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Sun, 29 Aug 2004 15:51:52 +0000 |
| parents | 86fdf8fe7f17 |
| children |
| rev | line source |
|---|---|
| 145 | 1 |
|
61
5c4dd9348e81
Added provision for THINK C which doesn't have sys_nerrors or sys_errlist.
Guido van Rossum <guido@python.org>
parents:
6
diff
changeset
|
2 /* PD implementation of strerror() for systems that don't have it. |
| 6 | 3 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */ |
| 4 | |
| 5 #include <stdio.h> | |
|
21077
379fc66f4c96
Use PyOS_snprintf instead of sprintf.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
14375
diff
changeset
|
6 #include "Python.h" |
| 6 | 7 |
| 8 extern int sys_nerr; | |
| 9 extern char *sys_errlist[]; | |
| 10 | |
| 11 char * | |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
12 strerror(int err) |
| 6 | 13 { |
| 14 static char buf[20]; | |
| 15 if (err >= 0 && err < sys_nerr) | |
| 16 return sys_errlist[err]; | |
|
21077
379fc66f4c96
Use PyOS_snprintf instead of sprintf.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
14375
diff
changeset
|
17 PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err); |
| 6 | 18 return buf; |
| 19 } |
