hi...

i'm starting to crawl around in wget... i have eclipse, running an a linux
box. i'm using the 1.10 source

i can manage to build/debug/step around the app...

i'm playing around with adding another command option. however, i'm
generating an assert error!!!

the option i'm creating is:
 --> -C --college-file=FILE

in looking at the code, i see that i need to modify code in at least 3
places. the code segments are:

main.c
  add the option "-C --college-file"

 add to 'struct cmdline_option option_data[]'
      .
      .
      { "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
      { "wait", 'w', OPT_VALUE, "wait", -1 },
>>>   { "college-file", 'C', OPT_VALUE, "collegefile", -1 },
      { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
  };



 add to 'static const char* help[]'

     -X,  --exclude-directories=LIST  list of excluded directories.\n"),
       N_("\
     -np, --no-parent          don't ascend to the parent directory.   \n"),

       "\n",
        N_("\
       College Parsing File options:\n"),

        N_("\
>>>>   -C, --college-file=FILE          File containing the parse site
structure.\n"),
       "\n",

       N_("Mail bug reports and suggestions to <[EMAIL PROTECTED]>.\n")
     };

------------

add in init.c
  in the 'static
...
  commands[]'
     .
     .
    { "wait",                     &opt.wait,              cmd_time },
>>> { "collegefile",      &opt.parse_filename,    cmd_file },
    { "waitretry",        &opt.waitretry,         cmd_time }
    };

------------

add in options.h
  in the 'struct options'

     .
     .
 >>> char *parse_filename;         /* parse filename */
   };


------------------

my cmd is -> "wget2 -Chh.txt http://www.foo.edu";

when i step through the wget/main(), things seem to work until i get to the
case/opt_value section...

   main.c
     main()
      case->opt_value
            setoptval

   init.c
     setoptval
     setval_internal->command_by_name

   it's in this section that the assert is triggered...

   it appears that the command_by_name is working... but
   for some reason i'm getting the assert..

   i've checked to make sure a similar option "-Ohh.txt"
   still works, so the logic appears to be ok... i haven't
   changed any othe code, so i'm at a loss to explain
   what's going on..

   are there any other changes that have to be made in order
   to add a cmd line option....

   thoughts/comments/ideas would be helpful...!!!!!

   i've been looking at this for hours, so i'm pretty
   sure that what i'm missing is fairly subtle...

  -bruce


Reply via email to