summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/getpublickey.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2000-08-29 21:04:07 +0000
committerache <ache@FreeBSD.org>2000-08-29 21:04:07 +0000
commit59889a1524d53b0efa5deebd003a0c6b5118b513 (patch)
tree5e6b6c3eb13edc4dd1394a4c346416f346da6cc5 /lib/libc/rpc/getpublickey.c
parent5c34b0eac75aa6d5a8bb94e8054260564cd1f3d4 (diff)
downloadFreeBSD-src-59889a1524d53b0efa5deebd003a0c6b5118b513.zip
FreeBSD-src-59889a1524d53b0efa5deebd003a0c6b5118b513.tar.gz
strtok() -> strsep() (no strtok() in libraries allowed)
small cleanup in nearby area: pointer 0 -> NULL, according to manpages hardcoded constant -> sizeof(buf)
Diffstat (limited to 'lib/libc/rpc/getpublickey.c')
-rw-r--r--lib/libc/rpc/getpublickey.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libc/rpc/getpublickey.c b/lib/libc/rpc/getpublickey.c
index e1c34d9..49227b4 100644
--- a/lib/libc/rpc/getpublickey.c
+++ b/lib/libc/rpc/getpublickey.c
@@ -26,6 +26,8 @@
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
+ *
+ * $FreeBSD$
*/
#if !defined(lint) && defined(SCCSIDS)
static char sccsid[] = "@(#)publickey.c 1.10 91/03/11 Copyr 1986 Sun Micro";
@@ -97,11 +99,11 @@ getpublicandprivatekey(key, ret)
char *mval;
fd = fopen(PKFILE, "r");
- if (fd == (FILE *) 0)
+ if (fd == NULL)
return (0);
for (;;) {
- res = fgets(buf, 1024, fd);
- if (res == 0) {
+ res = fgets(buf, sizeof(buf), fd);
+ if (res == NULL) {
fclose(fd);
return (0);
}
@@ -140,13 +142,15 @@ getpublicandprivatekey(key, ret)
continue;
#endif /* YP */
} else {
- mkey = strtok(buf, "\t ");
+ mkey = strsep(&res, "\t ");
if (mkey == NULL) {
fprintf(stderr,
"Bad record in %s -- %s", PKFILE, buf);
continue;
}
- mval = strtok((char *)NULL, " \t#\n");
+ do {
+ mval = strsep(&res, " \t#\n");
+ } while (mval != NULL && !*mval);
if (mval == NULL) {
fprintf(stderr,
"Bad record in %s val problem - %s", PKFILE, buf);
OpenPOWER on IntegriCloud