rem: debug_v("netcat_getport(dst=%p, port_string=\"%s\", port_num=%hu)", (void *)dst, port_string, port_num);
add: debug_v(("netcat_getport(dst=%p, port_string=\"%s\", port_num=%hu)", (void *)dst, port_string, port_num));
context: bool netcat_getport(nc_port_t *dst, const char *port_string,		    unsigned short port_num){  const char *get_proto = (opt_proto == NETCAT_PROTO_UDP ? "udp" : "tcp");  struct servent *servent;  debug_v("netcat_getport(dst=%p, port_string=\"%s\", port_num=%hu)",	  (void *)dst, port_string, port_num);/* Obligatory netdb.h-inspired rant: servent.s_port is supposed to be an int.   Despite this, we still have to treat it as a short when copying it around.   Not only that, but we have to convert it *back* into net order for   getservbyport to work.  Manpages generally aren't clear on all this, but   there are plenty of examples in which it is just quietly done. -hobbit */  /* reset all fields of the dst struct */  memset(dst, 0, sizeof(*dst));  if (!port_string) {    if (port_num == 0)      return FALSE;    dst->num = port_num;    dst->netnum = htons(port_num);    servent = getservbyport((int)dst->netnum, get_proto);    if (servent) {      assert(dst->netnum == servent->s_port);      strncpy(dst->name, servent->s_name, sizeof(dst->name));    }    goto end;  }  else {    long port;    char *endptr;    /* empty string? refuse it */    if (!port_string[0])      return FALSE;    /* try to convert the string into a valid port number.  If an error occurs       but it doesn't occur at the first char, throw an error */    port = strtol(port_string, &endptr, 10);    if (!endptr[0]) {      /* pure numeric value, check it out */      if ((port > 0) && (port < 65536))        return netcat_getport(dst, NULL, (in_port_t)port);      else        return FALSE;    }    else if (endptr != port_string)	/* mixed numeric and string value */      return FALSE;    /* this is a port name, try to lookup it */    servent = getservbyname(port_string, get_proto);    if (servent) {      strncpy(dst->name, servent->s_name, sizeof(dst->name));      dst->netnum = servent->s_port;      dst->num = ntohs(dst->netnum);      goto end;    }    return FALSE;  } end:  snprintf(dst->ascnum, sizeof(dst->ascnum), "%hu", dst->num);  return TRUE;}			/* end of netcat_getport() */