summaryrefslogtreecommitdiff
path: root/libnetbsd/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnetbsd/strerror.c')
-rw-r--r--libnetbsd/strerror.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libnetbsd/strerror.c b/libnetbsd/strerror.c
new file mode 100644
index 0000000000000..7bbd6b4e6c13a
--- /dev/null
+++ b/libnetbsd/strerror.c
@@ -0,0 +1,19 @@
+/* $NetBSD: strerror.c,v 1.3 2005/05/11 01:01:56 lukem Exp $ */
+
+#include "tnftp.h"
+
+char *
+strerror(int n)
+{
+ static char msg[] = "Unknown error (1234567890)";
+
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+
+ if (n >= sys_nerr) {
+ snprintf(msg, sizeof(msg), "Unknown error (%d)", n);
+ return(msg);
+ } else {
+ return(sys_errlist[n]);
+ }
+}