From owner-freebsd-current@FreeBSD.ORG Fri Feb 6 02:05:15 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 D5C3E16A4CE; Fri, 6 Feb 2004 02:05:15 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9739143D54; Fri, 6 Feb 2004 02:05:09 -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 i16A65oh028324; Fri, 6 Feb 2004 12:06:06 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i16A65He028319; Fri, 6 Feb 2004 12:06:05 +0200 (EET) (envelope-from ru) Date: Fri, 6 Feb 2004 12:06:05 +0200 From: Ruslan Ermilov To: Poul-Henning Kamp Message-ID: <20040206100605.GB27888@FreeBSD.org.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YD3LsXFS42OYHhNZ" Content-Disposition: inline User-Agent: Mutt/1.5.5.1i cc: current@FreeBSD.org Subject: 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: Fri, 06 Feb 2004 10:05:16 -0000 --YD3LsXFS42OYHhNZ Content-Type: multipart/mixed; boundary="ADZbWkCsHQ7r3kzd" Content-Disposition: inline --ADZbWkCsHQ7r3kzd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: - It's mostly useless, because one should know that it refers to a source code line in xinstall.c (!), and have that source available. - It's inspired by a lot of kernel programming, userland utils don't usually report line numbers of their sources, except for the assert() macro which is trying to catch programming (not usage) errors. ;) - There are only three cases where usage() is shown: traditional "bad option", traditional "incompatible options", traditional "missing or wrong number of arguments" (exactly like in cp(1)). If you really need it, could you please keep it locally? ;) Or perhaps, that's a userland reply to the IP security option? Then it should stay. ;) Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --ADZbWkCsHQ7r3kzd 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.62 diff -u -r1.62 xinstall.c --- xinstall.c 11 Jul 2003 20:51:16 -0000 1.62 +++ xinstall.c 6 Feb 2004 09:40:23 -0000 @@ -97,7 +97,7 @@ u_long numeric_id(const char *, const char *); void strip(const char *); int trymmap(int); -void usage(int); +void usage(void); =20 int main(int argc, char *argv[]) @@ -165,18 +165,18 @@ break; case '?': default: - usage(__LINE__); + usage(); } argc -=3D optind; argv +=3D optind; =20 /* some options make no sense when creating directories */ if (dostrip && dodir) - usage(__LINE__); + usage(); =20 /* must have at least two arguments, except when creating directories */ - if (argc < 2 && !dodir) - usage(__LINE__); + if (argc =3D=3D 0 || (argc =3D=3D 1 && !dodir)) + usage(); =20 /* need to make a temp copy so we can compare stripped version */ if (docompare && dostrip) @@ -216,7 +216,7 @@ =20 /* can't do file1 file2 directory/file */ if (argc !=3D 2) - usage(__LINE__); + usage(); =20 if (!no_target) { if (stat(*argv, &from_sb)) @@ -757,15 +757,14 @@ * print a usage message and die */ void -usage(int line) +usage() { - (void)fprintf(stderr, "line %d\n" + (void)fprintf(stderr, "usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n" " [-o owner] file1 file2\n" " install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n" " [-o owner] file1 ... fileN directory\n" -" install -d [-v] [-g group] [-m mode] [-o owner] directory ...\n", - line); +" install -d [-v] [-g group] [-m mode] [-o owner] directory ...\n"); exit(EX_USAGE); /* NOTREACHED */ } --ADZbWkCsHQ7r3kzd-- --YD3LsXFS42OYHhNZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAI2cNUkv4P6juNwoRAv7ZAJ9OWL7zh61Iu3zQA0EqJNHSSCJIfwCggUHP 9FNnTepA8cmWDat+tjzbUvc= =oCZt -----END PGP SIGNATURE----- --YD3LsXFS42OYHhNZ--