diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1995-03-24 15:38:54 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1995-03-24 15:38:54 +0000 |
| commit | 3d1513bdeb7948258c5c47d560f3dbb11f411376 (patch) | |
| tree | 46aacccd0ca533fd37689ffd7a83bcf73370dec1 /lib/libc | |
| parent | 6075622c647dd58b770bcd5206582753a55dccbe (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/net/gethostnamadr.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index 1e8672a6bf36..04a443d6b610 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -24,8 +24,8 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)$Id$"; -static char rcsid[] = "$Id$"; +static char sccsid[] = "@(#)$Id: gethostnamadr.c,v 1.5 1994/09/25 02:12:18 pst Exp $"; +static char rcsid[] = "$Id: gethostnamadr.c,v 1.5 1994/09/25 02:12:18 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -88,7 +88,7 @@ get_service_name(const char *name) { static void init_services() { - char *cp, buf[BUFSIZ]; + char *cp, *p, buf[BUFSIZ]; register int cc = 0; FILE *fd; @@ -102,14 +102,20 @@ init_services() if(buf[0] == '#') continue; - cp = strtok(buf, "\n \t,:;"); + p = buf; + while ((cp = strsep(&p, "\n \t,:;")) != NULL && *cp == '\0') + ; + if (cp == NULL) + continue; do { - if(!isalpha(cp[0])) continue; - service_order[cc] = get_service_name(buf); - if(service_order[cc] != SERVICE_NONE) - cc++; - } while((cp = strtok((char *)0, "\n \t,:;")) - && (cc < SERVICE_MAX)); + if (isalpha(cp[0])) { + service_order[cc] = get_service_name(cp); + if(service_order[cc] != SERVICE_NONE) + cc++; + } + while ((cp = strsep(&p, "\n \t,:;")) != NULL && *cp == '\0') + ; + } while(cp != NULL && cc < SERVICE_MAX); } service_order[cc] = SERVICE_NONE; fclose(fd); |
