Commit | Line | Data |
---|---|---|
8ea4199d DF |
1 | /* |
2 | * Copyright (c) 1983 Regents of the University of California. | |
6b2f9dd0 KB |
3 | * All rights reserved. |
4 | * | |
269a7923 | 5 | * %sccs.include.redist.c% |
8ea4199d DF |
6 | */ |
7 | ||
2ce81398 | 8 | #if defined(LIBC_SCCS) && !defined(lint) |
269a7923 | 9 | static char sccsid[] = "@(#)getnetbyaddr.c 5.7 (Berkeley) %G%"; |
6b2f9dd0 | 10 | #endif /* LIBC_SCCS and not lint */ |
ee9f7735 SL |
11 | |
12 | #include <netdb.h> | |
13 | ||
5442f2c7 JL |
14 | extern int _net_stayopen; |
15 | ||
ee9f7735 | 16 | struct netent * |
86755108 | 17 | getnetbyaddr(net, type) |
8fed5136 KB |
18 | register long net; |
19 | register int type; | |
ee9f7735 SL |
20 | { |
21 | register struct netent *p; | |
22 | ||
5442f2c7 | 23 | setnetent(_net_stayopen); |
ee9f7735 | 24 | while (p = getnetent()) |
86755108 | 25 | if (p->n_addrtype == type && p->n_net == net) |
ee9f7735 | 26 | break; |
5442f2c7 JL |
27 | if (!_net_stayopen) |
28 | endnetent(); | |
ee9f7735 SL |
29 | return (p); |
30 | } |