date and time created 87/11/17 19:18:49 by bostic
[unix-history] / usr / src / lib / libc / net / getnetbyaddr.c
index 4ba6742..6251811 100644 (file)
@@ -1,17 +1,29 @@
-/*     getnetbyaddr.c  4.3     82/10/06        */
+/*
+ * 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[] = "@(#)getnetbyaddr.c     5.4 (Berkeley) %G%";
+#endif LIBC_SCCS and not lint
 
 #include <netdb.h>
 
 
 #include <netdb.h>
 
+extern int _net_stayopen;
+
 struct netent *
 getnetbyaddr(net, type)
 struct netent *
 getnetbyaddr(net, type)
-       register int net, type;
+       register long net;
+       register int type;
 {
        register struct netent *p;
 
 {
        register struct netent *p;
 
-       setnetent(0);
+       setnetent(_net_stayopen);
        while (p = getnetent())
                if (p->n_addrtype == type && p->n_net == net)
                        break;
        while (p = getnetent())
                if (p->n_addrtype == type && p->n_net == net)
                        break;
-       endnetent();
+       if (!_net_stayopen)
+               endnetent();
        return (p);
 }
        return (p);
 }