From b56a528aea6287a9fe5b7b339a4b5ba5d0b9b470 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sun, 9 Dec 2012 17:04:39 +0100 Subject: [PATCH] Do not honor --config only when used as first long argument --- src/ChangeLog | 4 ++++ src/main.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9f52e8e0..df910136 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2012-12-09 Giuseppe Scrivano + * main.c (main): Keep looking for "config" until there are + arguments to parse. + Reported by: Adrien Dumont + * test.c: Include "wget.h". 2012-12-08 Michael Stapelberg (tiny change) diff --git a/src/main.c b/src/main.c index 4c2eb45b..992f60a0 100644 --- a/src/main.c +++ b/src/main.c @@ -1034,7 +1034,6 @@ main (int argc, char **argv) short_options, long_options, &longindex)) != -1) { int confval; - bool userrc_ret = true; struct cmdline_option *config_opt; /* There is no short option for "--config". */ @@ -1044,16 +1043,17 @@ main (int argc, char **argv) config_opt = &option_data[confval & ~BOOLEAN_NEG_MARKER]; if (strcmp (config_opt->long_name, "config") == 0) { + bool userrc_ret = true; userrc_ret &= run_wgetrc (optarg); use_userconfig = true; + if (userrc_ret) + break; + else + { + fprintf (stderr, _("Exiting due to error in %s\n"), optarg); + exit (2); + } } - if (!userrc_ret) - { - fprintf (stderr, _("Exiting due to error in %s\n"), optarg); - exit (2); - } - else - break; } }