diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-10-18 23:38:13 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-10-18 23:38:13 +0000 |
commit | 9b7d191055ade5069c6325fa857e007b4c658b14 (patch) | |
tree | 3546e12e3453e15508dbdfbec0a940e3e3de0647 /libc | |
parent | a6a89eb4477289063cb9ef1cc414b9e748f877f9 (diff) |
More updates. Implement strsignal. Add pwd_grp tests
Diffstat (limited to 'libc')
-rw-r--r-- | libc/signal/Makefile | 2 | ||||
-rw-r--r-- | libc/string/Makefile | 6 | ||||
-rw-r--r-- | libc/string/strerror.c | 4 | ||||
-rw-r--r-- | libc/string/strsignal.c | 36 |
4 files changed, 42 insertions, 6 deletions
diff --git a/libc/signal/Makefile b/libc/signal/Makefile index 4014fd11d..bc81d0b09 100644 --- a/libc/signal/Makefile +++ b/libc/signal/Makefile @@ -24,7 +24,7 @@ TOPDIR=../ include $(TOPDIR)Rules.mak LIBC=$(TOPDIR)libc.a -CSRC=raise.c +CSRC=raise.c sys_siglist.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(COBJS) diff --git a/libc/string/Makefile b/libc/string/Makefile index 5e6c241cb..0bdb925fd 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -32,9 +32,9 @@ MOBJ=strlen.o strcat.o strcpy.o strchr.o strcmp.o strncat.o strncpy.o \ MSRC1=index.c MOBJ1=index.o rindex.o -CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c config.c \ - strspn.c strcasecmp.c strncasecmp.c strerror.c sys_siglist.c \ - bcopy.c bzero.c bcmp.c +CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c config.c strspn.c \ + strcasecmp.c strncasecmp.c strerror.c bcopy.c bzero.c bcmp.c \ + strsignal.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(MOBJ) $(MOBJ1) $(COBJS) diff --git a/libc/string/strerror.c b/libc/string/strerror.c index 6eeac104e..91565965f 100644 --- a/libc/string/strerror.c +++ b/libc/string/strerror.c @@ -32,14 +32,14 @@ char *strerror(int err) if (sys_nerr) { if (err < 0 || err >= sys_nerr) goto unknown; - return sys_errlist[err]; + strcpy(retbuf, sys_errlist[err]); + return retbuf; } if (err <= 0) goto unknown; unknown: - printf("sys_nerr=%d\n", sys_nerr); strcpy(retbuf, "Unknown Error: errno="); strcat(retbuf, (char *) itoa(err)); return retbuf; 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 ********************************************/ |