aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2003-11-28 10:50:12 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2003-11-28 10:50:12 +0000
commit6a6484bfdb62e22fceb8b41f98e0dfef8adccd9d (patch)
treeca365c7e83819370a706148b7fadbf6800f469dd
parent19c5a6124c7ba06fa88aaf6dbf70f1ade88cc7b6 (diff)
downloadcpio-6a6484bfdb62e22fceb8b41f98e0dfef8adccd9d.tar.gz
cpio-6a6484bfdb62e22fceb8b41f98e0dfef8adccd9d.tar.bz2
Added to the repository
-rw-r--r--strerror.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/strerror.c b/strerror.c
new file mode 100644
index 0000000..0d16e17
--- /dev/null
+++ b/strerror.c
@@ -0,0 +1,63 @@
+/* This file is part of GNU Radius.
+ Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc.
+
+ Written by Sergey Poznyakoff
+
+ GNU Radius is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GNU Radius is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Radius; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#if defined(HAVE_SYS_ERRLIST)
+
+#if !HAVE_DECL_SYS_ERRLIST
+extern char *sys_errlist[];
+#endif
+#if !HAVE_DECL_SYS_NERR
+extern int sys_nerr;
+#endif
+
+char *
+strerror (int err)
+{
+ static char buf[80];
+
+ if (err > sys_nerr)
+ {
+ sprintf(buf, "error %d", err);
+ return buf;
+ }
+ return sys_errlist[err];
+}
+
+#else
+
+char *
+strerror (int err)
+{
+ static char buf[80];
+
+ sprintf(buf, "error %d", err);
+ return buf;
+}
+
+#endif /* HAVE_SYS_ERRLIST */
+
+

Return to:

Send suggestions and report system problems to the System administrator.