SCCS id got lost along the way
[unix-history] / usr / src / lib / libc / net / getproto.c
CommitLineData
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 9static 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
14extern int _proto_stayopen;
15
82fe24d3 16struct protoent *
5e649950 17getprotobynumber(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}