From: Alan Cox Date: Thu, 14 May 2015 22:51:04 +0000 (+0100) Subject: strsignal: signal name conversion X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=60440fc80ebf0a04fe1a22be7c8c251e1a349a1b;p=FUZIX.git strsignal: signal name conversion --- diff --git a/Library/include/string.h b/Library/include/string.h index 822e5233..bf7d269c 100644 --- a/Library/include/string.h +++ b/Library/include/string.h @@ -59,6 +59,8 @@ extern size_t strnlen __P((const char *, size_t)); extern size_t strxfrm __P((char *, const char *, size_t)); extern int strcoll __P((const char *s1, const char *s2)); +extern const char *strsignal __P((int s)); + #ifdef z80 #pagma inline(memcpy) #pagma inline(memset) diff --git a/Library/libs/Makefile b/Library/libs/Makefile index 8fb1a704..92a469f8 100644 --- a/Library/libs/Makefile +++ b/Library/libs/Makefile @@ -4,7 +4,7 @@ AR = sdar LINKER = sdldz80 # This gets set for 'awkward' devices like ZX128 #PLATFORM = -zx128 -#PLATFORM = +PLATFORM = export PLATFORM #CC_OPT = -mz80 -c --opt-code-size --std-c99 --max-allocs-per-node 2000000 -I../include CC_OPT = -mz80 --std-c99 -c --opt-code-size --max-allocs-per-node 20000 -I../include @@ -36,7 +36,7 @@ SRC_C += regsub.c remove.c rewind.c rindex.c setbuffer.c setenv.c setjmp.c SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c SRC_C += stat.c stdio0.c stime.c SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c -SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c +SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c strsignal.c SRC_C += strtod.c strtol.c system.c time.c tmpfile.c tmpnam.c ttyname.c SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c diff --git a/Library/libs/Makefile.6502 b/Library/libs/Makefile.6502 index b75bbc70..c9cba5f8 100644 --- a/Library/libs/Makefile.6502 +++ b/Library/libs/Makefile.6502 @@ -50,7 +50,7 @@ SRC_C += regsub.c remove.c rewind.c rindex.c setbuffer.c setenv.c setjmp.c SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c SRC_C += stat.c stdio0.c stime.c SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c -SRC_C += strnicmp.c strnlen.c strsep.c +SRC_C += strnicmp.c strnlen.c strsep.c strsignal.c SRC_C += system.c time.c tmpfile.c tmpnam.c ttyname.c SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c @@ -87,7 +87,7 @@ fuzix6502/Makefile: ../tools/syscall_6502.c ../../Kernel/include/syscall_name.h syslib.lib: fuzix6502/Makefile $(OBJ_C) (cd fuzix6502; make) $(AR) a syslib.lib $(OBJ_C) - ln -sf syslib.lib c.lib + ln -sf syslib.lib c6502.lib $(OBJ_ASM):%.o: %.s $(ASM) $(ASM_OPT) $@ $(@:.o=.s) diff --git a/Library/libs/Makefile.6809 b/Library/libs/Makefile.6809 index efbb0123..b7cc75c3 100644 --- a/Library/libs/Makefile.6809 +++ b/Library/libs/Makefile.6809 @@ -31,7 +31,7 @@ SRC_C += regsub.c remove.c rewind.c rindex.c setbuffer.c setenv.c setjmp.c SRC_C += setlocale.c setvbuf.c settimeofday.c sleep.c sprintf.c SRC_C += stat.c stdio0.c stime.c SRC_C += strcasecmp.c strcasestr.c strdup.c stricmp.c strlcpy.c strncasecmp.c -SRC_C += strnlen.c strnicmp.c strsep.c strxfrm.c strcoll.c +SRC_C += strnlen.c strnicmp.c strsep.c strsignal.c strxfrm.c strcoll.c SRC_C += strtod.c strtol.c system.c time.c tmpfile.c tmpnam.c ttyname.c SRC_C += tzset.c ungetc.c utent.c utimes.c utsname.c SRC_C += vfprintf.c vprintf.c wait.c xitoa.c pathconf.c diff --git a/Library/libs/strsignal.c b/Library/libs/strsignal.c new file mode 100644 index 00000000..211fc818 --- /dev/null +++ b/Library/libs/strsignal.c @@ -0,0 +1,48 @@ +/* + * Implement strsignal and the C sys_siglist + */ + +#include +#include + +const char *sys_siglist[NSIGS] = { + "Unknown signal", + "Hangup", + "Interrupt", + "Quit", + "Illegal instruction", + "BPT trace/trap", + "ABORT instruction", + "I/O trap", + "Bus error", + "Floating point exception", + "Killed", + "User signal 1", + "User signal 2", + "Broken pipe", + "Alarm clock", + "Terminated", + "Stack fault", + "Child death or stop", + "Continue", + "Stopped", + "Stopped (signal)", + "Stopped (tty input)", + "Stopped (tty output)", + "Urgent IO condition", + "CPU limit", + "File limit", + "Alarm (virtual)", + "Alarm (profile)", + "Window changed", + "I/O ready", + "Power", + "Bad system call" +}; + +const char *strsignal(int s) +{ + if (s < 1 || s >= NSIGS) + s = 0; + return sys_siglist[s]; +}