Deleted Added
full compact
getnetnamadr.c (145626) getnetnamadr.c (146244)
1/*-
2 * Copyright (c) 1994, Garrett Wollman
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994, Garrett Wollman
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/lib/libc/net/getnetnamadr.c 145626 2005-04-28 15:32:55Z ume $");
27__FBSDID("$FreeBSD: head/lib/libc/net/getnetnamadr.c 146244 2005-05-15 20:15:15Z ume $");
28
29#include "namespace.h"
30#include "reentrant.h"
31#include <sys/param.h>
32#include <sys/socket.h>
33#include <netinet/in.h>
34#include <arpa/inet.h>
35#include <netdb.h>

--- 79 unchanged lines hidden (view full) ---

115
116 rval = _nsdispatch(NULL, dtab, NSDB_NETWORKS, "getnetbyname",
117 default_src, name, ne, ned);
118
119 return (rval == NS_SUCCESS) ? 0 : -1;
120}
121
122int
28
29#include "namespace.h"
30#include "reentrant.h"
31#include <sys/param.h>
32#include <sys/socket.h>
33#include <netinet/in.h>
34#include <arpa/inet.h>
35#include <netdb.h>

--- 79 unchanged lines hidden (view full) ---

115
116 rval = _nsdispatch(NULL, dtab, NSDB_NETWORKS, "getnetbyname",
117 default_src, name, ne, ned);
118
119 return (rval == NS_SUCCESS) ? 0 : -1;
120}
121
122int
123getnetbyaddr_r(u_long addr, int af, struct netent *ne, struct netent_data *ned)
123getnetbyaddr_r(uint32_t addr, int af, struct netent *ne,
124 struct netent_data *ned)
124{
125 int rval;
126
127 static const ns_dtab dtab[] = {
128 NS_FILES_CB(_ht_getnetbyaddr, NULL)
129 { NSSRC_DNS, _dns_getnetbyaddr, NULL },
130 NS_NIS_CB(_nis_getnetbyaddr, NULL) /* force -DHESIOD */
131 { 0 }

--- 27 unchanged lines hidden (view full) ---

159 if ((nd = __netdata_init()) == NULL)
160 return NULL;
161 if (getnetbyname_r(name, &nd->net, &nd->data) != 0)
162 return NULL;
163 return &nd->net;
164}
165
166struct netent *
125{
126 int rval;
127
128 static const ns_dtab dtab[] = {
129 NS_FILES_CB(_ht_getnetbyaddr, NULL)
130 { NSSRC_DNS, _dns_getnetbyaddr, NULL },
131 NS_NIS_CB(_nis_getnetbyaddr, NULL) /* force -DHESIOD */
132 { 0 }

--- 27 unchanged lines hidden (view full) ---

160 if ((nd = __netdata_init()) == NULL)
161 return NULL;
162 if (getnetbyname_r(name, &nd->net, &nd->data) != 0)
163 return NULL;
164 return &nd->net;
165}
166
167struct netent *
167getnetbyaddr(u_long addr, int af)
168#if __LONG_BIT == 64
169getnetbyaddr(u_long addr, int af) /* ABI compatibility */
170#else
171getnetbyaddr(uint32_t addr, int af)
172#endif
168{
169 struct netdata *nd;
170
171 if ((nd = __netdata_init()) == NULL)
172 return NULL;
173{
174 struct netdata *nd;
175
176 if ((nd = __netdata_init()) == NULL)
177 return NULL;
173 if (getnetbyaddr_r(addr, af, &nd->net, &nd->data) != 0)
178 if (getnetbyaddr_r((uint32_t)addr, af, &nd->net, &nd->data) != 0)
174 return NULL;
175 return &nd->net;
176}
177
178void
179setnetent(int stayopen)
180{
181 struct netdata *nd;

--- 15 unchanged lines hidden ---
179 return NULL;
180 return &nd->net;
181}
182
183void
184setnetent(int stayopen)
185{
186 struct netdata *nd;

--- 15 unchanged lines hidden ---