summaryrefslogtreecommitdiff
path: root/libc/string/strsignal.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-18 23:38:13 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-18 23:38:13 +0000
commit9b7d191055ade5069c6325fa857e007b4c658b14 (patch)
tree3546e12e3453e15508dbdfbec0a940e3e3de0647 /libc/string/strsignal.c
parenta6a89eb4477289063cb9ef1cc414b9e748f877f9 (diff)
More updates. Implement strsignal. Add pwd_grp tests
Diffstat (limited to 'libc/string/strsignal.c')
-rw-r--r--libc/string/strsignal.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libc/string/strsignal.c b/libc/string/strsignal.c
new file mode 100644
index 000000000..e1f7ab129
--- /dev/null
+++ b/libc/string/strsignal.c
@@ -0,0 +1,36 @@
+/* vi: set sw=4 ts=4: */
+/* Copyright (C) 2000 Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ * This file is part of the uC-Linux and is distributed under the
+ * GNU Library General Public License.
+ */
+
+#include <string.h>
+#include <malloc.h>
+#include <signal.h>
+
+extern __const char *__const _sys_siglist[_NSIG];
+extern __const char *__const sys_siglist[_NSIG];
+
+/********************** Function strsignal ************************************/
+
+char *strsignal (int sig)
+{
+ static char retbuf[80];
+
+ if (sys_siglist) {
+ if (sig < 0 || sig >= _NSIG)
+ goto unknown;
+ strcpy(retbuf, sys_siglist[sig]);
+ return retbuf;
+ }
+
+ if (sig <= 0)
+ goto unknown;
+
+ unknown:
+ strcpy(retbuf, "Unknown Signal: ");
+ strcat(retbuf, (char *) itoa(sig));
+ return retbuf;
+}
+
+/********************** THE END ********************************************/