Bruce Evans <b...@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
-- 
Dag-Erling Smørgrav - d...@des.no
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to