mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(main): Recognize --help and --version even if POSIXLY_CORRECT is set.
This commit is contained in:
1 parent
7870fa1081
commit
72f51d66bf
2 files changed
+12
-6
No files matched your search
+2
-2
@@ -56,8 +56,8 @@ main (int argc, char **argv)
|
||||
atexit (close_stdout);
|
||||
|
||||
/* Recognize --help or --version only if it's the only command-line
|
||||
argument and if POSIXLY_CORRECT is not set. */
|
||||
if (argc == 2 && getenv ("POSIXLY_CORRECT") == NULL)
|
||||
argument. */
|
||||
if (argc == 2)
|
||||
{
|
||||
if (STREQ (argv[1], "--help"))
|
||||
usage (EXIT_SUCCESS);
|
||||
|
||||
@@ -71,10 +71,16 @@ main (int argc, char **argv)
|
||||
|
||||
atexit (close_stdout);
|
||||
|
||||
/* Don't recognize --help or --version if POSIXLY_CORRECT is set. */
|
||||
if (getenv ("POSIXLY_CORRECT") == NULL)
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
usage, AUTHORS, (char const *) NULL);
|
||||
|
||||
/* The above handles --help and --version.
|
||||
Since there is no other invocation of getopt, handle `--' here. */
|
||||
if (1 < argc && STREQ (argv[1], "--"))
|
||||
{
|
||||
--argc;
|
||||
++argv;
|
||||
}
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user