File: getportnum.c

package info (click to toggle)
superd 0.0.3-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 136 kB
  • ctags: 85
  • sloc: ansic: 721; makefile: 103; sh: 27
file content (12 lines) | stat: -rw-r--r-- 241 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
#include "getportnum.h"

int getportnum(const char *servname, const char *protoname) {
  struct servent *sptr;

  sptr = getservbyname(servname, protoname);

  if (sptr == NULL) 
    err_sys("invalid port lookup");

  return sptr->s_port;
}