Staging
v0.5.1
https://github.com/python/cpython
Revision f8200ffda3b39f7bd53e62e5afa5c53fe71766c0 authored by Raymond Hettinger on 21 August 2005, 12:36:21 UTC, committed by Raymond Hettinger on 21 August 2005, 12:36:21 UTC
1 parent 7290f01
Raw File
Tip revision: f8200ffda3b39f7bd53e62e5afa5c53fe71766c0 authored by Raymond Hettinger on 21 August 2005, 12:36:21 UTC
SF bug #1168135: Python 2.5a0 Tutorial errors and observations
Tip revision: f8200ff
strerror.c

/* PD implementation of strerror() for systems that don't have it.
   Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */

#include <stdio.h>
#include "Python.h"

extern int sys_nerr;
extern char *sys_errlist[];

char *
strerror(int err)
{
	static char buf[20];
	if (err >= 0 && err < sys_nerr)
		return sys_errlist[err];
	PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
	return buf;
}
back to top