bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in hostname


From: Jim Meyering
Subject: Re: bug in hostname
Date: Wed, 08 Oct 2003 10:27:36 +0200

Steven Augart <address@hidden> wrote:
> I looked through the Open Group documents that the letters you sent me
> pointed to.  I'm not clear on whether it's required to reject unknown
> arguments starting with a - but not after a --.  That would significantly
> influence my implementation -- I would prefer to have hostname work like
> this:
>
> hostname foo.bar.com
>         Sets the hostname
> hostname --fqdn
>         retrieves the hostname as an FQDN
> hostname -f
>         ditto
> hostname --long-option-I-never-heard-of
>         rejected with a usage message
> hostname -- --long-option-I-never-heard-of
>         sets the host name to --long-option-I-never-heard-of

That sounds like the way to go, once the program accepts options.

> But I'm wondering if there might be a reason that coreutils's "hostname"
> recognizes
> --help and --version but takes --anything-else as being a hostname.  Is
> there a reference that implies that the current behaviour is preferred?

Some GNU programs accept only --help and --version options,
I'm careful to make it so they recognize such an option only
when it is alone on the command line.  Also, the implementation
must be careful not to use getopt or getopt_long -- which can
gobble up the `--' separator.  Some programs (e.g., test, yes)
treat `--' like an argument like any other.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]