diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Python/strerror.c	Sun Oct 14 12:07:46 1990 +0000
@@ -0,0 +1,18 @@
+/* PD implementation of strerror() for BSD derivatives that don't have it.
+   Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
+
+#include <stdio.h>
+
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+char *
+strerror(err)
+	int err;
+{
+	static char buf[20];
+	if (err >= 0 && err < sys_nerr)
+		return sys_errlist[err];
+	sprintf(buf, "Unknown errno %d", err);
+	return buf;
+}