1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if defined(LIBC_SCCS) && !defined(lint)
   8: static char sccsid[] = "@(#)getservbyport.c	5.3 (Berkeley) 5/19/86";
   9: #endif LIBC_SCCS and not lint
  10: 
  11: #include <netdb.h>
  12: 
  13: extern int _serv_stayopen;
  14: 
  15: struct servent *
  16: getservbyport(port, proto)
  17:     int port;
  18:     char *proto;
  19: {
  20:     register struct servent *p;
  21: 
  22:     setservent(_serv_stayopen);
  23:     while (p = getservent()) {
  24:         if (p->s_port != port)
  25:             continue;
  26:         if (proto == 0 || strcmp(p->s_proto, proto) == 0)
  27:             break;
  28:     }
  29:     if (!_serv_stayopen)
  30:         endservent();
  31:     return (p);
  32: }
Last modified: 1987-08-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 524
Valid CSS Valid XHTML 1.0 Strict