xref: /csrg-svn/lib/libc/net/getproto.c (revision 21378)
1*21378Sdist /*
2*21378Sdist  * Copyright (c) 1983 Regents of the University of California.
3*21378Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21378Sdist  * specifies the terms and conditions for redistribution.
5*21378Sdist  */
67898Ssam 
7*21378Sdist #ifndef lint
8*21378Sdist static char sccsid[] = "@(#)getproto.c	5.1 (Berkeley) 05/30/85";
9*21378Sdist #endif not lint
10*21378Sdist 
117898Ssam #include <netdb.h>
127898Ssam 
137898Ssam struct protoent *
148324Ssam getprotobynumber(proto)
157898Ssam 	register int proto;
167898Ssam {
177898Ssam 	register struct protoent *p;
187898Ssam 
197898Ssam 	setprotoent(0);
207898Ssam 	while (p = getprotoent())
217898Ssam 		if (p->p_proto == proto)
227898Ssam 			break;
237898Ssam 	endprotoent();
247898Ssam 	return (p);
257898Ssam }
26