blob: fc7f8d193fbcb38e673ceb575301ad265d5923d6 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00002Copyright (c) 2000, BeOpen.com.
3Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5All rights reserved.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00006
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007See the file "Misc/COPYRIGHT" for information on usage and
8redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00009******************************************************************/
10
Guido van Rossum3d54f2d1990-11-02 17:51:17 +000011/* PD implementation of strerror() for systems that don't have it.
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000012 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
13
14#include <stdio.h>
15
16extern int sys_nerr;
17extern char *sys_errlist[];
18
19char *
Thomas Woutersf70ef4f2000-07-22 18:47:25 +000020strerror(int err)
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000021{
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 Rossum3d54f2d1990-11-02 17:51:17 +000028
Guido van Rossum1d5735e1994-08-30 08:27:36 +000029#ifdef macintosh
Guido van Rossum3d54f2d1990-11-02 17:51:17 +000030int sys_nerr = 0;
31char *sys_errlist[1] = 0;
32#endif