Hello!

thanks for working on this.

vivi <[email protected]> writes:

> Hi all
>
> I've got the config option working to some extent, however, after the
> first run of getopt_long, it ignores the second getopt_long that takes
> the rest of the users options. So any options other than --config are
> ignored. I'm not sure why, if anyone could shed any light on the topic,
> it would be greatly appreciated.
>
> I've attached main.c, 899 - 928 is where the problem seems to be.

Can you please send a diff the next time? :-)  If you are working on the
Bazaar repository, you can get it with "bzr diff [FILE...]".


>   while ((retconf = getopt_long(argc, argv, 
>                                 short_options, long_options, &longindex)) != 
> -1)

Please leave an empty space between the function name and the opening
'('.  Also remove the trailing white space on the same line.

As:

  while ((retconf = getopt_long (argc, argv,
                                short_options, long_options, &longindex)) != -1)


>
>   /*If the user did not use the config flag, read the system wgetrc and 
> ~/.wgetrc. */
>   if (use_userconfig == false)
>     initialize();

Same here.



>   longindex = -1;
>   while ((ret = getopt_long (argc, argv,
>                              short_options, long_options, &longindex)) != -1)
>     {

In order to use a getopt_long loop again I think there is need to reset
`optind' too.  So you'll have:

  optind = 0;
  longindex = -1;
  while ((ret = getopt_long (argc, argv,
                             short_options, long_options, &longindex)) != -1)


I am not sure this will not cause problems too, I have never seen
getopt_long called in this way.  I will investigate better.


Cheers,
Giuseppe

Reply via email to