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[] = "@(#)getproto.c 5.6 (Berkeley) %G%"; |
6b2f9dd0 | 10 | #endif /* LIBC_SCCS and not lint */ |
82fe24d3 SL |
11 | |
12 | #include <netdb.h> | |
13 | ||
5442f2c7 JL |
14 | extern int _proto_stayopen; |
15 | ||
82fe24d3 | 16 | struct protoent * |
5e649950 | 17 | getprotobynumber(proto) |
82fe24d3 SL |
18 | register int proto; |
19 | { | |
20 | register struct protoent *p; | |
21 | ||
5442f2c7 | 22 | setprotoent(_proto_stayopen); |
82fe24d3 SL |
23 | while (p = getprotoent()) |
24 | if (p->p_proto == proto) | |
25 | break; | |
5442f2c7 JL |
26 | if (!_proto_stayopen) |
27 | endprotoent(); | |
82fe24d3 SL |
28 | return (p); |
29 | } |