xref: /csrg-svn/lib/libc/net/getproto.c (revision 26619)
121378Sdist /*
221378Sdist  * Copyright (c) 1983 Regents of the University of California.
321378Sdist  * All rights reserved.  The Berkeley software License Agreement
421378Sdist  * specifies the terms and conditions for redistribution.
521378Sdist  */
67898Ssam 
7*26619Sdonn #if defined(LIBC_SCCS) && !defined(lint)
8*26619Sdonn static char sccsid[] = "@(#)getproto.c	5.2 (Berkeley) 03/09/86";
9*26619Sdonn #endif LIBC_SCCS and not lint
1021378Sdist 
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