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 726619Sdonn #if defined(LIBC_SCCS) && !defined(lint) 8*28280Slepreau static char sccsid[] = "@(#)getproto.c 5.3 (Berkeley) 05/19/86"; 926619Sdonn #endif LIBC_SCCS and not lint 1021378Sdist 117898Ssam #include <netdb.h> 127898Ssam 13*28280Slepreau extern int _proto_stayopen; 14*28280Slepreau 157898Ssam struct protoent * 168324Ssam getprotobynumber(proto) 177898Ssam register int proto; 187898Ssam { 197898Ssam register struct protoent *p; 207898Ssam 21*28280Slepreau setprotoent(_proto_stayopen); 227898Ssam while (p = getprotoent()) 237898Ssam if (p->p_proto == proto) 247898Ssam break; 25*28280Slepreau if (!_proto_stayopen) 26*28280Slepreau endprotoent(); 277898Ssam return (p); 287898Ssam } 29