Re: gnome_init_with_popt_table();



On Fri, 22 Mar 2002, Freivald, Joseph A, SOFED wrote:

> I am trying to use the gnome_init_with_popt_table() function to allow me
> to add two command line options to my application (-s and -d ? - where ?
> is any character).  I have stripped out a code segment and compiled is
> separately as an example of what I'm doing.
>
> I have looked at several examples, but none of them seem straight
> forward to me.
>
> Would someone be kind enough to review a this segment an tell me where
> my error is?  I have included a script that I was using to compile the
> test segment with, and commented the code with specific questions.

You are trying to use a getopt-style while() loop to process the arguments 
that have already been 100% processed by gnome_init_with_popt_table.

If you pass the -d option, immediately after the
gnome_init_with_popt_table() call the debugFlags variable will set. If you
were to stick the address of an int variable in the entry for the simulate
option, popt would set it to 1 if that option was passed. And so it
goes...

If you need to do more involved processing of arguments, you can get popt
to call callbacks and such for each argument. The gnome1 popt setup
doesn't support the getopt-style loop, but there are plenty of other ways
to accomplish the same thing if you investigate popt enough.

-- Elliot
Customer service by the financial industry: "If he's not broke, let's fix it."




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