On Sat, Jan 18, 2014 at 2:05 AM, Tim Rühsen <tim.rueh...@gmx.de> wrote:
> Am Freitag, 17. Januar 2014, 11:42:41 schrieb Tony Lewis: > > Darshit Shah wrote: > > > In case both the --config and --no-config commands are issued, the one > > > > that > > > > > appears first on the command will be considered and the other ignored. > > > > Given my memory of the way the parsing loop works, I would expect that it > > would use the last one that appears. How do GNU commands usually handle > > multiple instances of a command option? > > Wget, as most tools, parse the argument from left to right, the second > overwriting the first. Else (e.g. if arguments 'sum up'),it should be > explicitly mentioned in the docs. > > True. While Wget's command parser loop would usually accept the last instance of the option, this is an exception. One of the chief reasons I RFC'ed this patch. The --config option is detected just before the other options by running the same loop a little earlier. However, to same CPU cycles, we break out of the loop as soon as --config is identified. I have extended that loop so that it detects --no-config too and breaks out the moment either one of these is seen. Hence, only the first instance is acted upon, while the others are silently discarded. > Tim -- Thanking You, Darshit Shah