PERFORCE change 164314 for review
Gabor Pali
pgj at FreeBSD.org
Sun Jun 14 00:52:58 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164314
Change 164314 by pgj at petymeg-current on 2009/06/14 00:52:12
Fix port information storage and port name rendering
Affected files ...
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#28 edit
.. //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#16 edit
Differences ...
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.c#28 (text+ko) ====
@@ -743,12 +743,12 @@
C(in->s_addr));
}
result = _netstat_at_allocate(type, address, NULL);
- result->at_port = port;
+ result->at_port = ntohs(port);
sp = getservbyport((int)port, proto);
if ((sp != NULL || port == 0) && !anonport)
sprintf(result->at_portname, "%.15s", sp ? sp->s_name : "*");
else
- sprintf(result->at_portname, "%d", ntohs(port));
+ sprintf(result->at_portname, "%d", result->at_port);
return (result);
#undef C
==== //depot/projects/soc2009/pgj_libstat/src/usr.bin/netstat/inet.c#16 (text+ko) ====
@@ -933,7 +933,10 @@
sprintf(line, "%.*s.", Wflag ? 39 : (Aflag && !numeric) ? 12 : 16,
netstat_at_get_name(atp));
cp = index(line, '\0');
- sprintf(cp, "%.15s ", netstat_at_get_portname(atp));
+ if (numeric && (netstat_at_get_port(atp) > 0))
+ sprintf(cp, "%d ", netstat_at_get_port(atp));
+ else
+ sprintf(cp, "%.15s ", netstat_at_get_portname(atp));
width = Wflag ? 45 : Aflag ? 18 : 22;
printf("%-*.*s ", width, width, line);
}
More information about the p4-projects
mailing list