svn commit: r194789 - head/usr.bin/usbhidctl
des at des.no
Tue Jun 30 15:04:36 UTC 2009
Bruce Evans <brde at 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:
(void)fprintf(stderr, "usage: %s [-%slnpq] [-k kernel]\n",
getprogname(), dohalt ? "" : "d");
The following is far more readable:
(void)fprintf(stderr, dohalt ?
"usage: halt [-lnpq] [-k kernel]\n" :
"usage: reboot [-dlnpq] [-k kernel]\n");
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...
Dag-Erling Smørgrav - des at des.no
More information about the svn-src-all