diff --git a/libc/Makefile b/libc/Makefile
index e6d695d0..0f844786 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -116,6 +116,7 @@ strndup.o \
strnlen.o \
strpbrk.o \
strrchr.o \
+strsignal.o \
strspn.o \
strstr.o \
strtok.o \
diff --git a/libc/include/string.h b/libc/include/string.h
index 518f11ca..31a3d749 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -68,7 +68,6 @@ size_t strxfrm(char* restrict, const char* restrict, size_t);
int strcoll_l(const char*, const char*, locale_t);
char* strerror_l(int, locale_t);
int strerror_r(int, char*, size_t);
-char* strsignal(int);
size_t strxfrm_l(char* restrict, const char* restrict, size_t, locale_t);
#endif
@@ -78,11 +77,14 @@ char* strchrnul(const char* str, int c);
#if defined(_SORTIX_SOURCE)
const char* sortix_strerror(int errnum);
+const char* sortix_strsignal(int signum);
#endif
#if defined(_SOURCE_SOURCE) && __SORTIX_STDLIB_REDIRECTS
const char* strerror(int errnum) asm ("sortix_strerror");
+const char* strsignal(int signum) asm ("sortix_strsignal");
#else
char* strerror(int errnum);
+char* strsignal(int signum);
#endif
__END_DECLS
diff --git a/libc/strsignal.cpp b/libc/strsignal.cpp
new file mode 100644
index 00000000..08ec5036
--- /dev/null
+++ b/libc/strsignal.cpp
@@ -0,0 +1,72 @@
+/*******************************************************************************
+
+ Copyright(C) Jonas 'Sortie' Termansen 2012.
+
+ This file is part of the Sortix C Library.
+
+ The Sortix C Library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ The Sortix C Library 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 Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with the Sortix C Library. If not, see .
+
+ strsignal.cpp
+ Convert signal number to a string.
+
+*******************************************************************************/
+
+#define __SORTIX_STDLIB_REDIRECTS 0
+#include
+#include
+
+extern "C" const char* sortix_strsignal(int signum)
+{
+ switch ( signum )
+ {
+ case SIGHUP: return "SIGHUP";
+ case SIGINT: return "SIGINT";
+ case SIGQUIT: return "SIGQUIT";
+ case SIGILL: return "SIGILL";
+ case SIGTRAP: return "SIGTRAP";
+ case SIGABRT: return "SIGABRT";
+ case SIGEMT: return "SIGEMT";
+ case SIGFPE: return "SIGFPE";
+ case SIGKILL: return "SIGKILL";
+ case SIGBUS: return "SIGBUS";
+ case SIGSEGV: return "SYSSEGV";
+ case SIGSYS: return "SIGSYS";
+ case SIGPIPE: return "SIGPIPE";
+ case SIGALRM: return "SIGALRM";
+ case SIGTERM: return "SIGTERM";
+ case SIGUSR1: return "SIGUSR1";
+ case SIGUSR2: return "SIGUSR2";
+ case SIGCHLD: return "SIGCHLD";
+ case SIGPWR: return "SIGPWR";
+ case SIGWINCH: return "SIGWINCH";
+ case SIGURG: return "SIGURG";
+ case SIGSTOP: return "SIGSTOP";
+ case SIGTSTP: return "SIGTSTP";
+ case SIGCONT: return "SIGCONT";
+ case SIGTTIN: return "SIGTTIN";
+ case SIGTTOU: return "SIGTTOU";
+ case SIGVTALRM: return "SIGVTALRM";
+ case SIGXCPU: return "SIGXCPU";
+ case SIGXFSZ: return "SIGXFSZ";
+ case SIGWAITING: return "SIGWAITING";
+ case SIGLWP: return "SIGLWP";
+ case SIGAIO: return "SIGAIO";
+ default: return "Unknown signal value";
+ }
+}
+
+extern "C" char* strsignal(int signum)
+{
+ return (char*) sortix_strsignal(signum);
+}