From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 7 17:41:58 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2814216A47E for ; Tue, 7 Nov 2006 17:41:58 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91B3143D53 for ; Tue, 7 Nov 2006 17:41:57 +0000 (GMT) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net ([12.207.12.9]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20061107174155m9200km1gme>; Tue, 7 Nov 2006 17:41:56 +0000 Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.13.8/8.13.8) with ESMTP id kA7HfrtU051609; Tue, 7 Nov 2006 11:41:53 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.13.8/8.13.8/Submit) id kA7Hfqb3051608; Tue, 7 Nov 2006 11:41:52 -0600 (CST) (envelope-from brooks) Date: Tue, 7 Nov 2006 11:41:51 -0600 From: Brooks Davis To: Josh Carroll Message-ID: <20061107174151.GA51473@lor.one-eyed-alien.net> References: <20061102094748.G75543@mignon.ki.iif.hu> <8cb6106e0611021507n6315b629kad8cbbf901343c2@mail.gmail.com> <20061103021803.GC8508@kobe.laptop> <8cb6106e0611021834h17737556y4bb2fda39a4bfa0c@mail.gmail.com> <20061103024621.GB16445@kobe.laptop> <20061103024837.GB79357@lor.one-eyed-alien.net> <20061103025442.GB16543@kobe.laptop> <8cb6106e0611031550y1381b67agdc74144b89de763b@mail.gmail.com> <20061104062439.GD854@turion.vk2pj.dyndns.org> <8cb6106e0611061517k62c9193fnbbfc8e36db328282@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline In-Reply-To: <8cb6106e0611061517k62c9193fnbbfc8e36db328282@mail.gmail.com> User-Agent: Mutt/1.5.11 Cc: freebsd-hackers@freebsd.org Subject: Re: sockstat tcp/udp switches X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2006 17:41:58 -0000 --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 06, 2006 at 03:17:17PM -0800, Josh Carroll wrote: > >I suggest you use /etc/protocols rather than hard code the protocols. > >This will make the code future-proof. See getprotoent(3) for the > >correct way to read /etc/protocols. >=20 > Thanks Peter, that's a great idea. Below is a new patch that uses > getprotoent(3). For now, to maintain backward compatibility, I've > defined a default list of protocols (tcp, udp, divert), in the event > -P is not specified. This should retain the normal command line > behavior. >=20 > Thanks again for the suggestion. >=20 > Dmitry - with this change, diver is now the default but can also be > specified as an argument to -P as well. On other suggestion I'd have it to consider using strsep to parse the string. I'm pretty the code will be smaller and more readable. -- Brooks --3MwIy2ne0vdjdPXF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFUMVeXY6L6fI4GtQRArq0AKDlkJuD3gXlr4hnSahB+3nMFGLN6wCgmt7q rhd4fr+GA+Ag78mHGH4xToY= =lQ65 -----END PGP SIGNATURE----- --3MwIy2ne0vdjdPXF--