]> git.ipfire.org Git - thirdparty/coreutils.git/commit
all: detect --help and --version more consistently
authorBernhard Voelker <mail@bernhard-voelker.de>
Mon, 26 Nov 2018 08:05:37 +0000 (09:05 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Sun, 24 Feb 2019 18:32:29 +0000 (19:32 +0100)
commit44af84263ed9398418f8366d08a1c20f3aed367e
treebe425fd5e0092e6fc6707f9189073540a821222a
parent36b99b611309d8ef9634376d87149724850074a8
all: detect --help and --version more consistently

For select programs which accept only --help and --version options
(in addition to non-option arguments), process these options before
any other options.

Before:

  $ dd bs=1 --help
  dd: unrecognized option '--help'
  Try 'dd --help' for more information.

  $ yes me --help
  me --help
  me --help
  ...

After:
Any occurrence of '--help' in the arguments (prior to '--') will
show the help screen.

Discussed in https://bugs.gnu.org/33468 .

* NEWS: Mention change.
* src/cksum.c, src/dd.c, src/hostid.c, src/hostname.c, src/link.c,
src/logname.c, src/nohup.c, src/sleep.c, src/tsort.c, src/unlink.c,
src/uptime.c, src/users.c, src/whoami.c, src/yes.c (main): Replace
parse_long_options() + getopt_long() calls with
parse_gnu_standard_options_only(); Remove <getopt.h> inclusion;
Remove empty 'struct long_options' variable;
* tests/misc/help-version-getopt.sh: Add test.
* tests/local.mk (all_tests): Reference it.
17 files changed:
NEWS
src/cksum.c
src/dd.c
src/hostid.c
src/hostname.c
src/link.c
src/logname.c
src/nohup.c
src/sleep.c
src/tsort.c
src/unlink.c
src/uptime.c
src/users.c
src/whoami.c
src/yes.c
tests/local.mk
tests/misc/help-version-getopt.sh [new file with mode: 0755]