From owner-svn-src-all@FreeBSD.ORG Tue Jun 30 15:04:36 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37B51106564A; Tue, 30 Jun 2009 15:04:36 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id E8CF58FC13; Tue, 30 Jun 2009 15:04:35 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 368246D418; Tue, 30 Jun 2009 17:04:35 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 15532844A4; Tue, 30 Jun 2009 17:04:35 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Evans References: <200906232316.n5NNG1iT094289@svn.freebsd.org> <20090625154007.H33864@delplex.bde.org> <4A43B727.7010204@delphij.net> <20090627033608.P35379@delplex.bde.org> Date: Tue, 30 Jun 2009 17:04:34 +0200 In-Reply-To: <20090627033608.P35379@delplex.bde.org> (Bruce Evans's message of "Sat, 27 Jun 2009 04:16:03 +1000 (EST)") Message-ID: <8663ed2265.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, Xin LI , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, d@delphij.net Subject: Re: svn commit: r194789 - head/usr.bin/usbhidctl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 15:04:36 -0000 Bruce Evans writes: > Actually, it is OK to use it in FreeBSD iff the system supports the > same program having different names, like reboot/halt/etc. I don't see the point - you would still need different usage messages for each version. Using your example: % reboot -h reboot: illegal option -- h usage: reboot [-dlnpq] [-k kernel] % halt -h halt: illegal option -- h usage: halt [-lnpq] [-k kernel] The code that implements this is needlessly complicated: static void usage() { (void)fprintf(stderr, "usage: %s [-%slnpq] [-k kernel]\n", getprogname(), dohalt ? "" : "d"); exit(1); } The following is far more readable: static void usage(void) { (void)fprintf(stderr, dohalt ? "usage: halt [-lnpq] [-k kernel]\n" : "usage: reboot [-dlnpq] [-k kernel]\n"); exit(1); } BTW, there are numerous style issues in sbin/reboot/reboot.c. > This was discussed in FreeBSD mailing lists years ago, and IIRC no one > disagreed with the existing practice of hard-coding the program name. ISTR it was one of my commits that triggered the discussion. It must have been ten years ago, or close to it. Blink of an eye ;) I just realized that we have at least one committer who wasn't born when the FreeBSD project was founded... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no