From owner-freebsd-current@FreeBSD.ORG Fri Feb 6 23:47:23 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1008116A4CE for ; Fri, 6 Feb 2004 23:47:23 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E26543D31 for ; Fri, 6 Feb 2004 23:47:19 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i177lwoh044268; Sat, 7 Feb 2004 09:48:04 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i177lsV2044254; Sat, 7 Feb 2004 09:47:54 +0200 (EET) (envelope-from ru) Date: Sat, 7 Feb 2004 09:47:53 +0200 From: Ruslan Ermilov To: Poul-Henning Kamp Message-ID: <20040207074753.GD43602@FreeBSD.org.ua> References: <20040206100605.GB27888@FreeBSD.org.ua> <2651.1076092124@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+jhVVhN62yS6hEJ8" Content-Disposition: inline In-Reply-To: <2651.1076092124@critter.freebsd.dk> User-Agent: Mutt/1.5.5.1i cc: current@freebsd.org Subject: Re: usage() in install(1) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Feb 2004 07:47:23 -0000 --+jhVVhN62yS6hEJ8 Content-Type: multipart/mixed; boundary="7LkOrbQMr4cezO2T" Content-Disposition: inline --7LkOrbQMr4cezO2T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 06, 2004 at 07:28:44PM +0100, Poul-Henning Kamp wrote: > In message <20040206100605.GB27888@FreeBSD.org.ua>, Ruslan Ermilov writes: >=20 > >Poul-Henning, > > > >I was very puzzled today trying to understand what is this line > >number that install(1) is telling me about, especially that I've > >just run it without any options, to see its usage. > > > >Please revert the part of the revision 1.62 where it was added. > >I have the following reasons why it shouldn't have been done: >=20 > I added it because the error messages from [x]install are singularly > uninformative and at least the line numbers could serve as "guru > meditation material". >=20 There are four cases where it displays the usage: 1. When asked (``install -?'' or ``install''). 2. Incorrect option or missing option argument: getopt(3) takes care of that. 3. Incompatible options are specified (-d and -s): the usage is shown to let you decide what do you really want: -s or -d. This is how most bin/ utils do that. 4. Wrong number or types of arguments: the usage is shown to let you know the correct syntax. > The correct solution of course is to replace the totally uninformative > usage message >=20 Come on now! How is it totally uninformative? It presents you with the correct usage when you misuse it. You'd better watch the cpio(1) usage. ;) > which the program indiscriminatly spits out on any sort > of trouble with intelligent informative error messages. >=20 Only 3 and 4 lack the verbose reason, but this is how traditional BSD programs behave. If it will make your life easier, feel free to commit the attached patch. Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --7LkOrbQMr4cezO2T Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: xinstall.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/xinstall/xinstall.c,v retrieving revision 1.63 diff -u -r1.63 xinstall.c --- xinstall.c 7 Feb 2004 07:22:11 -0000 1.63 +++ xinstall.c 7 Feb 2004 07:43:22 -0000 @@ -171,8 +171,10 @@ argv +=3D optind; =20 /* some options make no sense when creating directories */ - if (dostrip && dodir) + if (dostrip && dodir) { + warnx("-d and -s may not be specified together"); usage(); + } =20 /* must have at least two arguments, except when creating directories */ if (argc =3D=3D 0 || (argc =3D=3D 1 && !dodir)) @@ -215,8 +217,10 @@ } =20 /* can't do file1 file2 directory/file */ - if (argc !=3D 2) + if (argc !=3D 2) { + warnx("wrong number or types of arguments"); usage(); + } =20 if (!no_target) { if (stat(*argv, &from_sb)) --7LkOrbQMr4cezO2T-- --+jhVVhN62yS6hEJ8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAJJgpUkv4P6juNwoRAop9AJ9LRiIbpjwtL4LGw8FeTIoFZwWlLwCeLZUV tjIlx4HzHxyfbea6Z472Jno= =HxLv -----END PGP SIGNATURE----- --+jhVVhN62yS6hEJ8--