getnetbyht.c (145684) | getnetbyht.c (146244) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41 * from getnetent.c 1.1 (Coimbra) 93/06/02 42 */ 43 44#if defined(LIBC_SCCS) && !defined(lint) 45static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; 46static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp"; 47#endif /* LIBC_SCCS and not lint */ 48#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41 * from getnetent.c 1.1 (Coimbra) 93/06/02 42 */ 43 44#if defined(LIBC_SCCS) && !defined(lint) 45static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93"; 46static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp"; 47#endif /* LIBC_SCCS and not lint */ 48#include <sys/cdefs.h> |
49__FBSDID("$FreeBSD: head/lib/libc/net/getnetbyht.c 145684 2005-04-29 17:36:54Z ume $"); | 49__FBSDID("$FreeBSD: head/lib/libc/net/getnetbyht.c 146244 2005-05-15 20:15:15Z ume $"); |
50 51#include <sys/types.h> 52#include <sys/socket.h> 53#include <netinet/in.h> 54#include <arpa/inet.h> 55#include <arpa/nameser.h> 56#include <netdb.h> 57#include <stdio.h> --- 59 unchanged lines hidden (view full) --- 117 strlcpy(bp, p, ep - bp); 118 bp += len; 119 while (*cp == ' ' || *cp == '\t') 120 cp++; 121 p = strpbrk(cp, " \t"); 122 if (p != NULL) 123 *p++ = '\0'; 124 ne->n_net = inet_network(cp); | 50 51#include <sys/types.h> 52#include <sys/socket.h> 53#include <netinet/in.h> 54#include <arpa/inet.h> 55#include <arpa/nameser.h> 56#include <netdb.h> 57#include <stdio.h> --- 59 unchanged lines hidden (view full) --- 117 strlcpy(bp, p, ep - bp); 118 bp += len; 119 while (*cp == ' ' || *cp == '\t') 120 cp++; 121 p = strpbrk(cp, " \t"); 122 if (p != NULL) 123 *p++ = '\0'; 124 ne->n_net = inet_network(cp); |
125#if __LONG_BIT == 64 126 ne->__n_pad0 = 0; /* ABI compatibility */ 127#endif |
|
125 ne->n_addrtype = AF_INET; 126 q = ne->n_aliases = ned->net_aliases; 127 if (p != NULL) { 128 cp = p; 129 while (cp && *cp) { 130 if (*cp == ' ' || *cp == '\t') { 131 cp++; 132 continue; --- 53 unchanged lines hidden (view full) --- 186 if (!ned->stayopen) 187 endnetent_r(ned); 188 return (error == 0) ? NS_SUCCESS : NS_NOTFOUND; 189} 190 191int 192_ht_getnetbyaddr(void *rval, void *cb_data, va_list ap) 193{ | 128 ne->n_addrtype = AF_INET; 129 q = ne->n_aliases = ned->net_aliases; 130 if (p != NULL) { 131 cp = p; 132 while (cp && *cp) { 133 if (*cp == ' ' || *cp == '\t') { 134 cp++; 135 continue; --- 53 unchanged lines hidden (view full) --- 189 if (!ned->stayopen) 190 endnetent_r(ned); 191 return (error == 0) ? NS_SUCCESS : NS_NOTFOUND; 192} 193 194int 195_ht_getnetbyaddr(void *rval, void *cb_data, va_list ap) 196{ |
194 unsigned long net; | 197 uint32_t net; |
195 int type; 196 struct netent *ne; 197 struct netent_data *ned; 198 int error; 199 | 198 int type; 199 struct netent *ne; 200 struct netent_data *ned; 201 int error; 202 |
200 net = va_arg(ap, unsigned long); | 203 net = va_arg(ap, uint32_t); |
201 type = va_arg(ap, int); 202 ne = va_arg(ap, struct netent *); 203 ned = va_arg(ap, struct netent_data *); 204 205 setnetent_r(ned->stayopen, ned); 206 while ((error = getnetent_r(ne, ned)) == 0) 207 if (ne->n_addrtype == type && ne->n_net == net) 208 break; 209 if (!ned->stayopen) 210 endnetent_r(ned); 211 return (error == 0) ? NS_SUCCESS : NS_NOTFOUND; 212} | 204 type = va_arg(ap, int); 205 ne = va_arg(ap, struct netent *); 206 ned = va_arg(ap, struct netent_data *); 207 208 setnetent_r(ned->stayopen, ned); 209 while ((error = getnetent_r(ne, ned)) == 0) 210 if (ne->n_addrtype == type && ne->n_net == net) 211 break; 212 if (!ned->stayopen) 213 endnetent_r(ned); 214 return (error == 0) ? NS_SUCCESS : NS_NOTFOUND; 215} |