Date: Mon, 3 Jun 2002 20:58:08 -0700 (PDT) From: Kelly Yancey <kbyanc@posi.net> To: freebsd-net@FreeBSD.ORG Subject: Request for review: patch to make netstat -rW behave as described in netstat(1) Message-ID: <20020603205104.T33228-200000@gateway.posi.net>
next in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1401783618-1023163088=:33228 Content-Type: TEXT/PLAIN; charset=US-ASCII I would appreciate it if someone could review the attached patch which makes netstat calculate column widths for the routing table when the -W flag is specified rather than just picking larger arbitrary values as it does now. Other than making -W more useful, it syncs reality to the documentation; from netstat(1): -W In certain displays, avoid truncating addresses even if this causes some fields to overflow. Basically, all the patch does is add a preliminary pass to calculate the necessary column widths when -W is specified. It is pretty straightforward, but nonetheless, I'de appreciate feedback before I commit it. Thanks, Kelly kbyanc@{posi.net,FreeBSD.org} * Wow, netstat is so far from WARNS-clean, it's scary. --0-1401783618-1023163088=:33228 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="netstat.diff" Content-Transfer-Encoding: BASE64 Content-ID: <20020603205808.V33228@gateway.posi.net> Content-Description: Content-Disposition: attachment; filename="netstat.diff" SW5kZXg6IHVzci5iaW4vbmV0c3RhdC9yb3V0ZS5jDQo9PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09DQpSQ1MgZmlsZTogL2hvbWUvbmN2cy9zcmMvdXNyLmJpbi9u ZXRzdGF0L3JvdXRlLmMsdg0KcmV0cmlldmluZyByZXZpc2lvbiAxLjY1DQpk aWZmIC11IC11IC1yMS42NSByb3V0ZS5jDQotLS0gdXNyLmJpbi9uZXRzdGF0 L3JvdXRlLmMJMzEgTWF5IDIwMDIgMDQ6MzY6NTUgLTAwMDAJMS42NQ0KKysr IHVzci5iaW4vbmV0c3RhdC9yb3V0ZS5jCTQgSnVuIDIwMDIgMDM6NDc6NT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AkJaWYgKHJ0LT5ydF9ybXgucm14X2V4cGlyZSkgew0KIAkJ CXRpbWVfdCBleHBpcmVfdGltZTsNCiANCiAJCQlpZiAoKGV4cGlyZV90aW1l ID0NCiAJCQkgICAgcnQtPnJ0X3JteC5ybXhfZXhwaXJlIC0gdGltZSgodGlt ZV90ICopMCkpID4gMCkNCi0JCQkJcHJpbnRmKCIgJTZkIiwgKGludClleHBp cmVfdGltZSk7DQorCQkJCXByaW50ZigiICUqZCIsIHdpZF9leHBpcmUsIChp bnQpZXhwaXJlX3RpbWUpOw0KIAkJfQ0KIAkJaWYgKHJ0LT5ydF9ub2Rlc1sw XS5ybl9kdXBlZGtleSkNCiAJCQlwcmludGYoIiA9PiIpOw0K --0-1401783618-1023163088=:33228-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020603205104.T33228-200000>