summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/printf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c
index b7eceffa4..f8fb51065 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -545,6 +545,14 @@ main (int argc, char **argv)
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
+ /* 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)
{
fprintf (stderr, _("Usage: %s format [argument...]\n"), program_name);