change retry loop to decrement after test
[unix-history] / usr / src / lib / libc / net / getnetent.c
index 61c2c9a..055803d 100644 (file)
@@ -1,13 +1,22 @@
-/*     getnetent.c     4.5     82/11/14        */
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getnetent.c        5.2 (Berkeley) %G%";
+#endif LIBC_SCCS and not lint
 
 #include <stdio.h>
 
 #include <stdio.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
 #include <ctype.h>
 
 #define        MAXALIASES      35
 
 #include <sys/socket.h>
 #include <netdb.h>
 #include <ctype.h>
 
 #define        MAXALIASES      35
 
-static char *NETDB = "/usr/lib/networks";
+static char NETDB[] = "/etc/networks";
 static FILE *netf = NULL;
 static char line[BUFSIZ+1];
 static struct netent net;
 static FILE *netf = NULL;
 static char line[BUFSIZ+1];
 static struct netent net;
@@ -64,19 +73,18 @@ again:
        net.n_net = inet_network(cp);
        net.n_addrtype = AF_INET;
        q = net.n_aliases = net_aliases;
        net.n_net = inet_network(cp);
        net.n_addrtype = AF_INET;
        q = net.n_aliases = net_aliases;
-       if (p != NULL) {
+       if (p != NULL) 
                cp = p;
                cp = p;
-               while (*cp) {
-                       if (*cp == ' ' || *cp == '\t') {
-                               cp++;
-                               continue;
-                       }
-                       if (q < &net_aliases[MAXALIASES - 1])
-                               *q++ = cp;
-                       cp = any(cp, " \t");
-                       if (*cp != NULL)
-                               *cp++ = '\0';
+       while (cp && *cp) {
+               if (*cp == ' ' || *cp == '\t') {
+                       cp++;
+                       continue;
                }
                }
+               if (q < &net_aliases[MAXALIASES - 1])
+                       *q++ = cp;
+               cp = any(cp, " \t");
+               if (cp != NULL)
+                       *cp++ = '\0';
        }
        *q = NULL;
        return (&net);
        }
        *q = NULL;
        return (&net);