Minor fixes to netstat
Mike Makonnen <[email protected]> Wed, 8 Jan 2003 04:44:00 -0500
| Newsgroups | gmane.os.freebsd.devel.audit |
|---|---|
| Message-ID | <20030108094400.GA7614@quark> |
Hi folks, Does anyone have any objections to the following patch to netstat? It basically, fixes some typos/grammar nits and adds another mini-function to correctly handle singular/plurals of words ending in 'ly'. netstat.diff - the patch out.diff - the result of the patch Cheers. -- Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc [email protected] | Fingerprint: D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC 68B9
netstat.diff
(text/plain, 5.2 KB)
Index: usr.bin/netstat/inet.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/inet.c,v
retrieving revision 1.55
diff -u -r1.55 inet.c
--- usr.bin/netstat/inet.c 5 Sep 2002 17:06:51 -0000 1.55
+++ usr.bin/netstat/inet.c 25 Dec 2002 02:40:50 -0000
@@ -630,7 +630,7 @@
p(icps_error, "\t%lu call%s to icmp_error\n");
p(icps_oldicmp,
- "\t%lu error%s not generated 'cuz old message was icmp\n");
+ "\t%lu error%s not generated in response to an icmp message\n");
for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++)
if (icmpstat.icps_outhist[i] != 0) {
if (first) {
Index: usr.bin/netstat/inet6.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/inet6.c,v
retrieving revision 1.20
diff -u -r1.20 inet6.c
--- usr.bin/netstat/inet6.c 5 Sep 2002 17:06:51 -0000 1.20
+++ usr.bin/netstat/inet6.c 25 Dec 2002 03:02:34 -0000
@@ -416,7 +416,7 @@
"\t%llu packet%s whose headers are not continuous\n");
p(ip6s_nogif, "\t%llu tunneling packet%s that can't find gif\n");
p(ip6s_toomanyhdr,
- "\t%llu packet%s discarded due to too may headers\n");
+ "\t%llu packet%s discarded because of too many headers\n");
/* for debugging source address selection */
#define PRINT_SCOPESTAT(s,i) do {\
@@ -538,7 +538,7 @@
p(ifs6_out_fragcreat, "\t%llu output datagram%s succeeded on fragment\n");
p(ifs6_reass_reqd, "\t%llu incoming datagram%s fragmented\n");
p(ifs6_reass_ok, "\t%llu datagram%s reassembled\n");
- p(ifs6_reass_fail, "\t%llu datagram%s failed on reassembling\n");
+ p(ifs6_reass_fail, "\t%llu datagram%s failed on reassembly\n");
p(ifs6_in_mcast, "\t%llu multicast datagram%s received\n");
p(ifs6_out_mcast, "\t%llu multicast datagram%s sent\n");
@@ -834,11 +834,11 @@
printf(m, (unsigned long long)icmp6stat.f, plural(icmp6stat.f))
#define p_5(f, m) printf(m, (unsigned long long)icmp6stat.f)
- p(icp6s_error, "\t%llu call%s to icmp_error\n");
+ p(icp6s_error, "\t%llu call%s to icmp6_error\n");
p(icp6s_canterror,
- "\t%llu error%s not generated because old message was icmp error or so\n");
+ "\t%llu error%s not generated in response to an icmp6 message\n");
p(icp6s_toofreq,
- "\t%llu error%s not generated because rate limitation\n");
+ "\t%llu error%s not generated because of rate limitation\n");
#define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s_outhist[0]))
for (first = 1, i = 0; i < NELEM; i++)
if (icmp6stat.icp6s_outhist[i] != 0) {
@@ -903,6 +903,8 @@
int s;
#define p(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <= 1) \
printf(m, (unsigned long long)ifr.ifr_ifru.ifru_icmp6stat.f, plural(ifr.ifr_ifru.ifru_icmp6stat.f))
+#define p2(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <= 1) \
+ printf(m, (unsigned long long)ifr.ifr_ifru.ifru_icmp6stat.f, pluralies(ifr.ifr_ifru.ifru_icmp6stat.f))
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
perror("Warning: socket(AF_INET6)");
@@ -925,13 +927,13 @@
p(ifs6_in_paramprob, "\t%llu input parameter problem error%s\n");
p(ifs6_in_pkttoobig, "\t%llu input packet too big error%s\n");
p(ifs6_in_echo, "\t%llu input echo request%s\n");
- p(ifs6_in_echoreply, "\t%llu input echo reply%s\n");
+ p2(ifs6_in_echoreply, "\t%llu input echo repl%s\n");
p(ifs6_in_routersolicit, "\t%llu input router solicitation%s\n");
p(ifs6_in_routeradvert, "\t%llu input router advertisement%s\n");
p(ifs6_in_neighborsolicit, "\t%llu input neighbor solicitation%s\n");
p(ifs6_in_neighboradvert, "\t%llu input neighbor advertisement%s\n");
p(ifs6_in_redirect, "\t%llu input redirect%s\n");
- p(ifs6_in_mldquery, "\t%llu input MLD query%s\n");
+ p2(ifs6_in_mldquery, "\t%llu input MLD quer%s\n");
p(ifs6_in_mldreport, "\t%llu input MLD report%s\n");
p(ifs6_in_mlddone, "\t%llu input MLD done%s\n");
@@ -943,13 +945,13 @@
p(ifs6_out_paramprob, "\t%llu output parameter problem error%s\n");
p(ifs6_out_pkttoobig, "\t%llu output packet too big error%s\n");
p(ifs6_out_echo, "\t%llu output echo request%s\n");
- p(ifs6_out_echoreply, "\t%llu output echo reply%s\n");
+ p2(ifs6_out_echoreply, "\t%llu output echo repl%s\n");
p(ifs6_out_routersolicit, "\t%llu output router solicitation%s\n");
p(ifs6_out_routeradvert, "\t%llu output router advertisement%s\n");
p(ifs6_out_neighborsolicit, "\t%llu output neighbor solicitation%s\n");
p(ifs6_out_neighboradvert, "\t%llu output neighbor advertisement%s\n");
p(ifs6_out_redirect, "\t%llu output redirect%s\n");
- p(ifs6_out_mldquery, "\t%llu output MLD query%s\n");
+ p2(ifs6_out_mldquery, "\t%llu output MLD quer%s\n");
p(ifs6_out_mldreport, "\t%llu output MLD report%s\n");
p(ifs6_out_mlddone, "\t%llu output MLD done%s\n");
Index: usr.bin/netstat/main.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/main.c,v
retrieving revision 1.58
diff -u -r1.58 main.c
--- usr.bin/netstat/main.c 5 Sep 2002 17:06:51 -0000 1.58
+++ usr.bin/netstat/main.c 25 Dec 2002 02:56:14 -0000
@@ -703,6 +703,12 @@
return (n != 1 ? "es" : "");
}
+const char *
+pluralies(int n)
+{
+ return (n != 1 ? "ies" : "y");
+}
+
/*
* Find the protox for the given "well-known" name.
*/
out.diff
(text/plain, 879 B)
'netstat -s' output: icmp: 0 calls to icmp_error - 0 errors not generated 'cuz old message was icmp + 0 errors not generated in response to an icmp message ... - 0 packets discarded due to too may headers + 0 packets discarded because of too many headers ... - 0 calls to icmp_error - 0 errors not generated because old message was icmp error or so - 0 errors not generated because rate limitation + 0 calls to icmp6_error + 0 errors not generated in response to an icmp6 message + 0 errors not generated because of rate limitation 'netstat -I dc0 -s' output: - 0 datagrams failed on reassembling + 0 datagrams failed on reassembly ... - 0 input echo replys + 0 input echo replies ... - 0 input MLD querys + 0 input MLD queries ... - 0 output echo replys + 0 output echo replies ... - 0 output MLD querys + 0 output MLD queries 2 output MLD reports 0 output MLD dones
signature.asc
(application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+G/Lf2uHir9vMaLkRAl7FAKDpFAQI34/dwmzHJskt5v6m57kOsACfY9Eh 737Z/BaLz3hzxiXyT2Z7YAA= =z3P8 -----END PGP SIGNATURE-----