Date: Tue, 30 Jun 2009 17:04:34 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@FreeBSD.org, Xin LI <delphij@FreeBSD.org>, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, d@delphij.net Subject: Re: svn commit: r194789 - head/usr.bin/usbhidctl Message-ID: <8663ed2265.fsf@ds4.des.no> In-Reply-To: <20090627033608.P35379@delplex.bde.org> (Bruce Evans's message of "Sat, 27 Jun 2009 04:16:03 %2B1000 (EST)") References: <200906232316.n5NNG1iT094289@svn.freebsd.org> <20090625154007.H33864@delplex.bde.org> <4A43B727.7010204@delphij.net> <20090627033608.P35379@delplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <brde@optusnet.com.au> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8663ed2265.fsf>