autoopts_back

AutoGen's Automated Option Processing

Main
AutoGen
Pages

Home
Announce
FAQ
docs
XML Defs
testimonials
downloads

Automated
Options

AutoOpts
Comparison
Man example
Redistribute
Licensing
local use
using getopt

GCC's
Fixincludes

fixincludes

Automated
FSM

description
example
usagefsm

Addons
addon

Project GNU
Home Page

Automated
XDR

xdr project

i

AutoOpts 28:0 is included with AutoGen 5.9. It is a very powerful command line option parser consisting of a set of AutoGen templates and a run time library that nearly eliminates the hassle of parsing and documenting command line options. This package allows you to specify several program attributes, up to 100 option types and many attributes for each option.

Using your program's option definitions, AutoGen will expand the AutoOpts templates into two C source files and, optionally, a man page document and a tex-info ``invoking'' document section. The header and code files constitute all the information the AutoOpts library needs to parse and handle the command line, environment variables and initialization file (rc file) options. When your program runs, the AutoOpts library will then interpret these compiled data.

Additionally, if you wish to use ``getopt_long(3GNU) or getopt(3C)'' to parse the options instead of AutoOpts' libopts library, you may do so. A template (getopt.tpl) is distributed with AutoOpts that will take restricted AutoOpts option definitions and produce the parsing loop that calls either ``getopt(3C)'' or ``getopt_long(3GNU)''. (Which depends on whether long options are enabled in your description.) Be aware, though, that it is necessarily crippled when compared with the full set of AutoOpts Features

AutoOpts, the full package, is licensed under the "Lesser" (Library) GNU Public License (LGPL). The shared library portion of it, however, is available separately. The libopts tear-off library is available under either of two licenses: the LGPL, or, optionally, the advertising-clause-free BSD license.


Internationalization

AutoOpts option processing is internationalizable:

If you compile with ENABLE_NLS defined and the _() macro defined to a localization function such as gettext(3GNU), then the option processing code will be localizable. Simply run xgettext, or equivalent, on the distributed header, usage-txt.h and add it to the rest of your i18n. When you call optionProcess, all of the user visible AutoOpts strings will be passed through the localization procedure established with the _() preprocessing macro.

The AutoOpts library will always check for the ``compiled with NLS'' flag, so the libopts library does not need to be specially compiled.


Tear-off libopts source

The AutoOpts component of AutoGen now produces a source tarball that you may incorporate into your own source distribution under generous licensing terms.

Here is the readme. "blocksort" is an example project that incorporates the redistributable libopts library component of AutoOpts.


Distributing without libopts

It is possible. You may use getopt(3C) or getopt_long(3GNU) to parse your options, if you choose. There are a number of usage constraints over AutoOpts' full feature set, but you do not need to worry about integration issues, either. You may see an example of the generated getopt_long loop in the getopt test script.


What will AutoOpts do for you?

Many things :-). Please see the AutoOpts Features documentation for an abbreviated list of features, or see the Comparative Features to see how it stacks up with "the competition"* ;-).



If you are interested in trying this package, the full documentation is here online and it is included with the AutoGen distribution. (If you choose to download, or have any other questions, please drop a note and let me know if you built it and what you used it for.
Thanks! :)

*If the comparison page lies or is incomplete, please let know. I don't track other projects all the time.


top  Viewable With Any Browser  Valid XHTML 1.0!


AutoGen, AutoOpts, columns, getdefs, AutoFSM, AutoXDR and these web pages copyright (c) 1999-2002 Bruce Korb, all rights reserved.

Return to GNU's home page.

Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.

Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.

This article, Copyright © 2000-2002 by Bruce Korb

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Last modified: Sun Feb 18 12:18:40 PST 2007