4 * Copyright (C) 2012 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
13 char *portname(pr, port)
17 struct protoent *p = NULL;
18 struct servent *sv = NULL;
19 struct servent *sv1 = NULL;
21 if ((opts & OPT_NORESOLVE) == 0) {
23 if ((sv = getservbyport(htons(port), "tcp"))) {
24 strncpy(buf, sv->s_name, sizeof(buf)-1);
25 buf[sizeof(buf)-1] = '\0';
26 sv1 = getservbyport(htons(port), "udp");
27 sv = strncasecmp(buf, sv->s_name, strlen(buf)) ?
32 } else if ((pr != -2) && (p = getprotobynumber(pr))) {
33 if ((sv = getservbyport(htons(port), p->p_name))) {
34 strncpy(buf, sv->s_name, sizeof(buf)-1);
35 buf[sizeof(buf)-1] = '\0';
41 (void) sprintf(buf, "%d", port);