summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-10-29 21:39:47 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2005-10-29 21:39:47 +1000
commitf084cc9a342aa3d08054a5a930833b390a063bcd (patch)
tree65e7600111444e876ed1f2445bb57ee06d72623c /src
parentAdded missing system.h inclusion for mempcpy (diff)
downloaddash-f084cc9a342aa3d08054a5a930833b390a063bcd.tar.gz
dash-f084cc9a342aa3d08054a5a930833b390a063bcd.zip
[SIGNAL] Added default implementation of strsignal
klibc doesn't have strsignal but it does have sys_siglist.
Diffstat (limited to 'src')
-rw-r--r--src/jobs.c1
-rw-r--r--src/system.c14
-rw-r--r--src/system.h4
3 files changed, 19 insertions, 0 deletions
diff --git a/src/jobs.c b/src/jobs.c
index d5ea156..158d4e4 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -65,6 +65,7 @@
 #include "memalloc.h"
 #include "error.h"
 #include "mystring.h"
+#include "system.h"
 
 /* mode flags for set_curjob */
 #define CUR_DELETE 2
diff --git a/src/system.c b/src/system.c
index d375de0..d986efd 100644
--- a/src/system.c
+++ b/src/system.c
@@ -26,7 +26,9 @@
  * SUCH DAMAGE.
  */
 
+#include <signal.h>
 #include <string.h>
+#include "output.h"
 #include "system.h"
 
 #ifndef HAVE_MEMPCPY
@@ -53,6 +55,18 @@ char *strchrnul(const char *s, int c)
 }
 #endif
 
+#ifndef HAVE_STRSIGNAL
+char *strsignal(int sig)
+{
+	static char buf[19];
+
+	if ((unsigned)sig < NSIG && sys_siglist[sig])
+		return (char *)sys_siglist[sig];
+	fmtstr(buf, sizeof(buf), "Signal %d", sig); 
+	return buf;
+}
+#endif
+
 #ifndef HAVE_BSEARCH
 void *bsearch(const void *key, const void *base, size_t nmemb,
 	      size_t size, int (*cmp)(const void *, const void *))
diff --git a/src/system.h b/src/system.h
index d686024..0842675 100644
--- a/src/system.h
+++ b/src/system.h
@@ -51,6 +51,10 @@ char *stpcpy(char *, const char *);
 char *strchrnul(const char *, int);
 #endif
 
+#ifndef HAVE_STRSIGNAL
+char *strsignal(int);
+#endif
+
 #ifndef HAVE_STRTOIMAX
 #define strtoimax strtoll
 #endif