aboutsummaryrefslogtreecommitdiff
path: root/sunrpc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-15 15:49:26 +0000
committerRoland McGrath <roland@gnu.org>1996-05-15 15:49:26 +0000
commitf8adc70c3f27250d5768ff922c0ac39f0e77c058 (patch)
tree8ab82a13daaf342b64db23292efe40b6bffd08ca /sunrpc
parent64166d98349c01ccaaa848a30b12ae0d83de9bb8 (diff)
downloadglibc-f8adc70c3f27250d5768ff922c0ac39f0e77c058.tar
glibc-f8adc70c3f27250d5768ff922c0ac39f0e77c058.tar.gz
glibc-f8adc70c3f27250d5768ff922c0ac39f0e77c058.tar.bz2
glibc-f8adc70c3f27250d5768ff922c0ac39f0e77c058.zip
Tue May 14 19:42:04 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* 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 <davidm@AZStarNet.com> * sunrpc/getrpcent.c (interpret): Declare args. Rewrite parsing using strpbrk. Tue May 14 20:18:38 1996 Ulrich Drepper <drepper@cygnus.com> * time/Makefile (routines): Add strptime. * time/time.h: Add prototype for strptime. * time/strptime.c: New file. Implementation according to XPG4.
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/getrpcent.c36
1 files changed, 9 insertions, 27 deletions
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);