diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2001-06-27 19:15:04 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2001-06-27 19:15:04 +0000 |
commit | ffe4a2ea175faf47b3d4c374dfaf4eeb039270f2 (patch) | |
tree | 174d3fb592b14ee81ff251df5ab25c9bd7fcde26 | |
parent | 11c7ac847a377e312bbdb56ad0fb57687ee87b56 (diff) |
Remove nonstandard functions.
-rw-r--r-- | libc/string/Makefile | 2 | ||||
-rw-r--r-- | libc/string/config.c | 88 |
2 files changed, 1 insertions, 89 deletions
diff --git a/libc/string/Makefile b/libc/string/Makefile index 48d3a3426..488c69549 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -35,7 +35,7 @@ endif MSRC1=strsignal.c MOBJ1=strsignal.o psignal.o -CSRC=strpbrk.c strsep.c strstr.c strtok.c strtok_r.c strcspn.c config.c \ +CSRC=strpbrk.c strsep.c strstr.c strtok.c strtok_r.c strcspn.c \ strspn.c strcasecmp.c strncasecmp.c strerror.c bcopy.c bzero.c \ bcmp.c sys_errlist.c COBJS=$(patsubst %.c,%.o, $(CSRC)) diff --git a/libc/string/config.c b/libc/string/config.c deleted file mode 100644 index 3330ffd19..000000000 --- a/libc/string/config.c +++ /dev/null @@ -1,88 +0,0 @@ -/* config.c: Config file reader. - * - * Copyright 1999 D. Jeff Dionne, <jeff@rt-control.com> - * - * This is free software, under the LGPL V2.0 - */ - -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <cfgfile.h> - -/* This is a quick and dirty config file parser. It reads the file once for - * each request, there is no cache. Each line must be less than 128bytes. - */ - -static char *args[16]; -static char cfgbuf[128]; - -static char *ws(char **buf) -{ - char *b = *buf; - char *p; - - /* eat ws */ - while (*b && (*b == ' ' || *b == '\n' || *b == '\t')) - b++; - p = b; - - /* find the end */ - while (*p && !(*p == ' ' || *p == '\n' || *p == '\t')) - p++; - *p = 0; - *buf = p + 1; - return b; -} - -char **cfgread(FILE * fp) -{ - char *ebuf; - char *p; - int i; - - if (!fp) { - __set_errno(EIO); - return (void *) 0; - } - - while (fgets(cfgbuf, sizeof(cfgbuf), fp)) { - - /* ship comment lines */ - if (cfgbuf[0] == '#') - continue; - - ebuf = cfgbuf + strlen(cfgbuf); - - p = cfgbuf; - for (i = 0; i < 16 && p < ebuf; i++) { - args[i] = ws(&p); - } - args[i] = (void *) 0; - - /* return if we found something */ - if (strlen(args[0])) - return args; - } - return (void *) 0; -} - -char **cfgfind(FILE * fp, char *var) -{ - char **ret; - char search[80]; - - if (!fp || !var) { - __set_errno(EIO); - return (void *) 0; - } - - strncpy(search, var, sizeof(search)); - - fseek(fp, 0, SEEK_SET); - while ((ret = cfgread(fp))) { - if (!strcmp(ret[0], search)) - return ret; - } - return (void *) 0; -} |