Re: XForms: Xforms & command line parameters

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 10 Jul 97 06:12:43 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> This seems to be a problem. I use the common 'getopt' method
> to pick application specific options *before* I call fl_initialize():
>
> while ( (c = getopt(argc, argv, "b:d:D:hp:s:")) != EOF ) {
> switch ( c ) {
> case ...
> case ...
> case ...
> }
> }
>
> After processing this loop no options remain for fl_initialize()
> and, even worse, XForms options (X11 options) are treated as an
> error if they are not explicitly mentioned in 'getopt(...)'.

True.

You could, however, add the XForms arguments to your getopt() list.

Perhaps the solution is to use the built in argument parsing provided
by XForms. IMHO it is superior to getopt()'s rather primitive single
character flags and it allows you to specify defaults and data types
in a much more rich vocabulary than the standard getopt(). I've used
it on some of my more elaborate projects and it works well. I've even
hacked it to be "self-documenting," so that all the parameter
definitions, defaults, and explanations of the parameters are
effectively in one place.

spl

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/