Adding an option

Jonathan Hayward -- http://JonathansCorner.com jshayward@pobox.com
Wed Aug 29 17:32:01 2001


--------------8F464EC6910BA7BA6CB1119E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Werner Koch wrote:


> On Tue, 28 Aug 2001 13:26:23 -0500, "Jonathan Hayward said:
>
> > In my Tcl extension, I'm trying to add an option --passphrase
> > <passphrase>.
>
> Don't do this, everyone can do a ps and view the passphrase.
>
As a standalone process, definitely. As an argument passed from within Tcl, it doesn't show up.
>
> > What are the steps involved in registering an option with the
argument
> > parser? It looks like I've left something out.
>
> Add a new name into the option enum (oFoo), add an entry to the list
> of options (use another otion which takes a string as a template) and
> finally add a case oFoo to the big options switch in main(). I thing
> --comment may be a goog example.
>
Hmm... I think I'm missing something. I've added oPassphrase to the option enum, added { oPassphrase, "passphrase", 2, N_("|PASSPHRASE|use passphrase PASSPHRASE")}, to the list of options, and added to the switch: case oPassphrase: fd_passwd = pargs.r.ret_str; break; The complaint it's giving is util/argparse.c, line 49 of function initialize(); by the time that function checks, arg->r_opt has value 618. Is there a reason arg->r_opt should contain a value that would trouble argparse? -- Jonathan Hayward jshayward@pobox.com http://JonathansCorner.com (A four dimensional maze, stories, essays, artwork, and other things...) --------------8F464EC6910BA7BA6CB1119E Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Werner Koch wrote: <p>> On Tue, 28 Aug 2001 13:26:23 -0500, "Jonathan Hayward said: <br>> <br>> > In my Tcl extension, I'm trying to add an option --passphrase <br>> > &lt;passphrase>. <br>> <br>> Don't do this, everyone can do a ps and view the passphrase. <br>> <p>As a standalone process, definitely.&nbsp; As an argument passed from within <br>Tcl, it doesn't show up. <p>> <br>> > What are the steps involved in registering an option with the argument <br>> > parser? It looks like I've left something out. <br>> <br>> Add a new name into the option enum (oFoo), add an entry to the list <br>> of options (use another otion which takes a string as a template) and <br>> finally add a case oFoo to the big options switch in main().&nbsp; I thing <br>> --comment may be a goog example. <br>> <p>Hmm...&nbsp; I think I'm missing something. <p>I've added oPassphrase to the option enum, added <p>{ oPassphrase, "passphrase", 2, N_("|PASSPHRASE|use passphrase <br>PASSPHRASE")}, <p>to the list of options, and added to the switch: <p>&nbsp;&nbsp;&nbsp; case oPassphrase: <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fd_passwd = pargs.r.ret_str; <br>&nbsp;&nbsp;&nbsp; break; <p>The complaint it's giving is util/argparse.c, line 49 of function <br>initialize(); by the time that function checks, arg->r_opt has value 618. <p>Is there a reason arg->r_opt should contain a value that would trouble <br>argparse? <pre>--&nbsp; Jonathan Hayward jshayward@pobox.com <A HREF="http://JonathansCorner.com">http://JonathansCorner.com</A> (A four dimensional maze, stories, essays, artwork, and other things...)</pre> &nbsp;</html> --------------8F464EC6910BA7BA6CB1119E--