From owner-cvs-src@FreeBSD.ORG Thu Jun 5 12:17:27 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29D16106567B; Thu, 5 Jun 2008 12:17:27 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: from mail.cokane.org (c-24-60-133-163.hsd1.ma.comcast.net [24.60.133.163]) by mx1.freebsd.org (Postfix) with ESMTP id BCD848FC26; Thu, 5 Jun 2008 12:17:26 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: by mail.cokane.org (Postfix, from userid 103) id 396B325AD3C; Thu, 5 Jun 2008 08:17:26 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.1.8-gr1 (2007-02-13) on discordia X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8-gr1 Received: from [172.20.1.3] (erwin.int.cokane.org [172.20.1.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cokane.org (Postfix) with ESMTP id 3D1E325AD3C; Thu, 5 Jun 2008 08:17:11 -0400 (EDT) From: Coleman Kane To: Steve Kargl In-Reply-To: <20080604222931.GA50114@troutmask.apl.washington.edu> References: <20080604041815.GA84027@FreeBSD.org> <20080604043955.GA38627@troutmask.apl.washington.edu> <20080604063631.GA28351@freebie.xs4all.nl> <20080604150013.GA44358@troutmask.apl.washington.edu> <20080604191339.GA31570@freebie.xs4all.nl> <20080604192955.GA46284@troutmask.apl.washington.edu> <1212608575.15220.109.camel@localhost> <4846F520.6040400@FreeBSD.org> <1212614663.15220.136.camel@localhost> <20080604222931.GA50114@troutmask.apl.washington.edu> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-Ge40JH81DTpmQqowHPgk" Organization: FreeBSD Project Date: Thu, 05 Jun 2008 08:15:41 -0400 Message-Id: <1212668141.1855.90.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1.1 FreeBSD GNOME Team Port Cc: Maxim Sobolev , Alexey Dokuchaev , src-committers@FreeBSD.org, Florent Thoumie , cvs-src@FreeBSD.org, cvs-all@FreeBSD.org, Wilko Bulte Subject: Re: cvs commit: src/usr.sbin/pkg_install/add main.c pkg_add.1 src/usr.sbin/pkg_install/create main.c pkg_create.1 src/usr.sbin/pkg_install/delete main.c pkg_delete.1 src/usr.sbin/pkg_install/info main.c pkg_info.1 ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jun 2008 12:17:27 -0000 --=-Ge40JH81DTpmQqowHPgk Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2008-06-04 at 15:29 -0700, Steve Kargl wrote: > On Wed, Jun 04, 2008 at 05:24:23PM -0400, Coleman Kane wrote: > > It's probably premature to begin shooting that down. I merely picked > > "cp" as the first tool that came to mind which lives in /bin. Maybe I > > should have picked on /bin/pax or /usr/bin/lex instead, or something > > else with 20+ getopt args :P. > >=20 > > My point was that it was pretty absurd to start treating this like it > > will turn into a giant mad party of getopt_long conversions. I don't > > really have the inclination to go out and add long options to any tool > > myself, because I have better things to do with my time. As I said > > earlier, I think it's a better policy to discuss this when the > > patch/commit comes along, and see what people's feelings are on the > > matter then. I don't think it is anybody's place at the moment (except > > maybe core@) to try and deter a committer from making what some feel is > > a beneficial change to software. > >=20 >=20 > Please commit. The patch gives conformance to Posix=20 > (ie., IEEE Std 1003.1, 2004 Edition). >=20 > As a bonus, I've included long options for compatibility > with GNU wc. >=20 > Index: wc.1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/ncvs/src/usr.bin/wc/wc.1,v > retrieving revision 1.25 > diff -u -p -r1.25 wc.1 > --- wc.1 21 Dec 2006 22:59:07 -0000 1.25 > +++ wc.1 4 Jun 2008 22:27:15 -0000 > @@ -71,25 +71,19 @@ the last file. > .Pp > The following options are available: > .Bl -tag -width indent > -.It Fl c > +.It Fl c , -bytes > The number of bytes in each input file > is written to the standard output. > -This will cancel out any prior usage of the > -.Fl m > -option. > -.It Fl l > +.It Fl l , -lines > The number of lines in each input file > is written to the standard output. > -.It Fl m > +.It Fl m , -chars > The number of characters in each input file is written to the standard o= utput. > If the current locale does not support multibyte characters, this > is equivalent to the > .Fl c > option. > -This will cancel out any prior usage of the > -.Fl c > -option. > -.It Fl w > +.It Fl w , -words > The number of words in each input file > is written to the standard output. > .El > Index: wc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /home/ncvs/src/usr.bin/wc/wc.c,v > retrieving revision 1.21 > diff -u -p -r1.21 wc.c > --- wc.c 27 Dec 2004 22:27:56 -0000 1.21 > +++ wc.c 4 Jun 2008 22:27:15 -0000 > @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD: src/usr.bin/wc/wc.c, > #include > #include > #include > +#include > #include > #include > #include > @@ -68,6 +69,15 @@ int doline, doword, dochar, domulti; > static int cnt(const char *); > static void usage(void); > =20 > +static char opts[] =3D "clmw"; > +static struct option longopts[] =3D { > + { "bytes", no_argument, NULL, 'c' }, > + { "lines", no_argument, NULL, 'l' }, > + { "chars", no_argument, NULL, 'm' }, > + { "words", no_argument, NULL, 'w' }, > + { NULL, 0, NULL, 0 }, > +}; > + > int > main(int argc, char *argv[]) > { > @@ -75,7 +85,7 @@ main(int argc, char *argv[]) > =20 > (void) setlocale(LC_CTYPE, ""); > =20 > - while ((ch =3D getopt(argc, argv, "clmw")) !=3D -1) > + while ((ch =3D getopt_long(argc, argv, opts, longopts, NULL)) !=3D -1) > switch((char)ch) { > case 'l': > doline =3D 1; > @@ -85,11 +95,13 @@ main(int argc, char *argv[]) > break; > case 'c': > dochar =3D 1; > - domulti =3D 0; > + if (domulti) > + errx(1, "-c conflicts with -m"); > break; > case 'm': > domulti =3D 1; > - dochar =3D 0; > + if (dochar) > + errx(1, "-m conflicts with -c"); > break; > case '?': > default: > @@ -263,6 +275,6 @@ word: gotsp =3D 1; > static void > usage() > { > - (void)fprintf(stderr, "usage: wc [-clmw] [file ...]\n"); > + (void)fprintf(stderr, "usage: wc [-c|-m][-lw] [file ...]\n"); > exit(1); > } >=20 First of all, your patch removes functionality in our wc that deviates from POSIX in that the last -c or -m option takes precedence over the priors. This functionality enables there to be something like a "wc -c" alias to "wc", and then if the user executes "wc -m" they will still get what they want. Yes, the POSIX manual says that you cannot specify these two options together. No, *I* am not going to "fix" our behavior, because I don't care about that particular case. If someone else does (with a commit bit who is willing to take the fall), let them speak up. I also don't personally care about adding long options to all of the core tools, especially the ones that only have 4 or 5 options. Second (as is obvious), you are merely posting this out of spite, and not because you actually have any interest in improving the tools through adding strict POSIX conformance and long options. Don't send me any more patches. Surely you have something better to do with your time. --=20 Coleman Kane --=-Ge40JH81DTpmQqowHPgk Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkhH2OwACgkQcMSxQcXat5fOCACbBAL2F/daxCBZaVFdPqIQjh0o wiEAn0XrMomQQO9osmoE+EASFqNASNNZ =MRsm -----END PGP SIGNATURE----- --=-Ge40JH81DTpmQqowHPgk--