diff options
author | peter <peter@FreeBSD.org> | 1996-01-13 09:03:58 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-01-13 09:03:58 +0000 |
commit | 05184daaef969978db8f5aa4df2c3c5edac44c51 (patch) | |
tree | 1aa115c29231422c8a28d2fe8a54407622c4698e /lib/libc/net/getnetbyht.c | |
parent | 6ba0bb5bfcd0dcb90300a37b199f1bef4c8e2490 (diff) | |
download | FreeBSD-src-05184daaef969978db8f5aa4df2c3c5edac44c51.zip FreeBSD-src-05184daaef969978db8f5aa4df2c3c5edac44c51.tar.gz |
The last of the bind-4.9.3-REL resolver merges.
Diffstat (limited to 'lib/libc/net/getnetbyht.c')
-rw-r--r-- | lib/libc/net/getnetbyht.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index 4f6439c..24ca2ed 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -31,6 +31,16 @@ * SUCH DAMAGE. */ +/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro + * Dep. Matematica Universidade de Coimbra, Portugal, Europe + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * from getnetent.c 1.1 (Coimbra) 93/06/02 + */ + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ @@ -39,6 +49,7 @@ static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> +#include <arpa/nameser.h> #include <netdb.h> #include <stdio.h> #include <string.h> @@ -55,6 +66,7 @@ void _setnethtent(f) int f; { + if (netf == NULL) netf = fopen(_PATH_NETWORKS, "r" ); else @@ -65,6 +77,7 @@ _setnethtent(f) void _endnethtent() { + if (netf) { fclose(netf); netf = NULL; @@ -103,7 +116,7 @@ again: 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; while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { @@ -128,7 +141,7 @@ _getnetbyhtname(name) register char **cp; setnetent(_net_stayopen); - while ((p = getnetent())) { + while (p = getnetent()) { if (strcasecmp(p->n_name, name) == 0) break; for (cp = p->n_aliases; *cp != 0; cp++) @@ -141,7 +154,6 @@ found: return (p); } - struct netent * _getnetbyhtaddr(net, type) register long net; @@ -150,7 +162,7 @@ _getnetbyhtaddr(net, type) register struct netent *p; setnetent(_net_stayopen); - while ((p = getnetent())) + while (p = getnetent()) if (p->n_addrtype == type && p->n_net == net) break; if (!_net_stayopen) |