bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Having some problems with getopt_long


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] Having some problems with getopt_long
Date: Wed, 04 Aug 2010 16:26:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Hello!

thanks for working on this.

vivi <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]