From f8adc70c3f27250d5768ff922c0ac39f0e77c058 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 15 May 1996 15:49:26 +0000 Subject: Tue May 14 19:42:04 1996 Roland McGrath * sysdeps/generic/strrchr.c: Deansideclized. * elf/Makefile (ldd): Depend on Makefile. Find ld.so in $(slibdir) instead of $(libdir). * sysdeps/i386/strrchr.S: Use `testl $3, %esi' instead of `testb $3, %esi'; gas misassembles the latter into `testb $3, %dh'. * mach/Machrules (%.udeps rule): Do $(make-target-directory) first. Tue May 14 16:38:44 1996 David Mosberger-Tang * sunrpc/getrpcent.c (interpret): Declare args. Rewrite parsing using strpbrk. Tue May 14 20:18:38 1996 Ulrich Drepper * time/Makefile (routines): Add strptime. * time/time.h: Add prototype for strptime. * time/strptime.c: New file. Implementation according to XPG4. --- sunrpc/getrpcent.c | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'sunrpc') diff --git a/sunrpc/getrpcent.c b/sunrpc/getrpcent.c index 8ef65618b0..0fc7affdf9 100644 --- a/sunrpc/getrpcent.c +++ b/sunrpc/getrpcent.c @@ -163,13 +163,15 @@ getrpcent() return(NULL); if (d->rpcf == NULL && (d->rpcf = fopen(RPCDB, "r")) == NULL) return (NULL); - if (fgets(d->line, BUFSIZ, d->rpcf) == NULL) + if (fgets(d->line, BUFSIZ, d->rpcf) == NULL) return (NULL); return interpret(d->line, strlen(d->line)); } static struct rpcent * interpret(val, len) + char * val; + size_t len; { register struct rpcdata *d = _rpcdata(); char *p; @@ -182,21 +184,13 @@ interpret(val, len) d->line[len] = '\n'; if (*p == '#') return (getrpcent()); - cp = index(p, '#'); + cp = strpbrk(p, "#\n"); if (cp == NULL) - { - cp = index(p, '\n'); - if (cp == NULL) - return (getrpcent()); - } + return (getrpcent()); *cp = '\0'; - cp = index(p, ' '); + cp = strpbrk(p, " \t"); if (cp == NULL) - { - cp = index(p, '\t'); - if (cp == NULL) - return (getrpcent()); - } + return (getrpcent()); *cp++ = '\0'; /* THIS STUFF IS INTERNET SPECIFIC */ d->rpc.r_name = d->line; @@ -204,15 +198,9 @@ interpret(val, len) cp++; d->rpc.r_number = atoi(cp); q = d->rpc.r_aliases = d->rpc_aliases; - cp = index(p, ' '); + cp = strpbrk(p, " \t"); if (cp != NULL) *cp++ = '\0'; - else - { - cp = index(p, '\t'); - if (cp != NULL) - *cp++ = '\0'; - } while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { cp++; @@ -220,15 +208,9 @@ interpret(val, len) } if (q < &(d->rpc_aliases[MAXALIASES - 1])) *q++ = cp; - cp = index(p, ' '); + cp = strpbrk(p, " \t"); if (cp != NULL) *cp++ = '\0'; - else - { - cp = index(p, '\t'); - if (cp != NULL) - *cp++ = '\0'; - } } *q = NULL; return (&d->rpc); -- cgit v1.2.3