[wget-notify] [bug #20445] The options/wget command code is too convoluted

Micah Cowan INVALID.NOREPLY at gnu.org
Tue Jul 10 16:42:27 PDT 2007


URL:
  <http://savannah.gnu.org/bugs/?20445>

                 Summary: The options/wget command code is too convoluted
                 Project: GNU Wget
            Submitted by: micahcowan
            Submitted on: Tuesday 07/10/2007 at 16:42
                Category: Code Architecture
                Severity: 3 - Normal
                  Status: Confirmed
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
        Operating System: None
         Reproducibility: None
           Fixed Release: None
         Planned Release: None
              Regression: None
           Work Required: 2 - Weeks
          Patch Included: None

    _______________________________________________________

Details:

There are too many places to look to see how an option is set on the
command-line or wgetrc, what it's default value is, etc. To find out what opt
field is set by a given command-line option, for example, you need to search
for the command-line option in  main.c's OPTION_DATA array, note the value of
the DATA field, and use that to search in init.c's COMMANDS array. Then, to
find its default value, you need to check init.c's DEFAULTS function.

Too involved. If necessary, the necessary data structures could be generated
from a special source file designed to map a wgetrc command to its short and
long options (if any), its internal "opt" structure member, its default
value, tables of conflicting options, and perhaps its usage string and usage
category. This could make maintenance and addition of new options much
easier, as well as code comprehensibility.

Additional benefits would be that there's no particular need to keep options
in alphabetical order, since the generator could re-sort them for binary
searches. If we wish, we could generate tries instead of lists for lookup of
options, resulting in O(N) complexity, rather than the current O(N log M),
where N is the number of chars in the option or command name, and M is the
number of entries. In addition, time would no longer be wasted on each
invocation of wget to construct the table for getopt_long, which could
already have been generated at build time.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?20445>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



More information about the wget-notify mailing list