bugGNU Wget - Bugs: bug #20445, The options/wget command code is...

 
 

bug #20445: The options/wget command code is too convoluted

Submitter:  Micah Cowan <micahcowan>
Submitted:  Tue 10 Jul 2007 11:42:25 PM UTC
   
 
Category:  Code Architecture Severity:  3 - Normal
Priority:  5 - Normal Status:  Confirmed
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  None Operating System:  None
Reproducibility:  None Fixed Release:  None
Planned Release:  2.0 Regression:  None
Work Required:  2 - Weeks Patch Included:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 10 Jul 2007 11:42:25 PM UTC, original submission:  

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.

Micah Cowan <micahcowan>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by micahcowan (Submitted the item)
  •  

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-07-20 micahcowan Planned ReleaseNone 2.0

    Back to the top

    Powered by Savane 3.14-49f2.
    Corresponding source code