Staging
v0.8.1
https://github.com/python/cpython
Revision 6f5d3f326f8c98dc4c53b422a92306e391e83cc2 authored by Jeffrey Yasskin on 10 December 2008, 17:23:20 UTC, committed by Jeffrey Yasskin on 10 December 2008, 17:23:20 UTC
1 parent 6f63190
Raw File
Tip revision: 6f5d3f326f8c98dc4c53b422a92306e391e83cc2 authored by Jeffrey Yasskin on 10 December 2008, 17:23:20 UTC
Backport issue 4597 to python 2.5.3: Fixed several opcodes that weren't always
Tip revision: 6f5d3f3
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