
  GNU Gengetopt

//

This program generates a C function that uses /getopt_long/ function to
parse the command line options, to validate them and fills a /struct/ .

Thus your program can now handle options such as:

myprog --input foo.c -o foo.o --no-tabs -i 100 *.class

And both long options (those that start with --) and short options
(start with - and consist of only one character) can be handled. For
standards about short and long options you may want to take a look at
the GNU Coding Standards <http://www.gnu.org/prep/standards_toc.html> .

gengetopt is *free software*. Please see the file LICENSE and COPYING
for details.
Notice that: Use of gengetopt _does not impose any particular license on
the generated code: the code generated is not under any license_.

For installation, please read the INSTALL file.

For documentation, please read the html file gengetopt.html.

gengetopt is perfect if you are too lazy (like me) to write all stuff
required to call getopt_long, and when you have a
program and wish it took options.

Generated code works if you use /GNU Autoconf/ or /GNU Automake/ .

Gengetopt has originally been written by *Roberto Arturo Tena Sanchez*
<arturo@directmail.org <mailto:arturo@directmail.org>>, and currently
maintained by *Lorenzo Bettini* http://www.lorenzobettini.it .

Gengetopt is a GNU <http://www.gnu.org> program and its main home page
is at GNU site:
http://www.gnu.org/software/gengetopt/gengetopt.html

    Download

You can download it from GNU's ftp site:
ftp://ftp.gnu.org/gnu/gengetopt/ or from one of its mirrors (see
http://www.gnu.org/prep/ftp.html ).

I do not distribute Windows binaries anymore; since, they can be easily
built by using *Cygwin C/C++* compiler, available at
http://www.cygwin.com/. However, if you don't feel like downloading such
compiler, you can request such binaries directly to me, by e-mail
(bettini@gnu.org <mailto:bettini@gnu.org> ) and I can send them to you.

You may also want to check the /md5sum/ of the archives, which are also
digitally signed by me (/Lorenzo Bettini/) with /GNU gpg/
(http://www.gnupg.org). My GPG public key can be found at my home page
(see at the end of this doc).


      Anonymous CVS Access

This project's CVS repository can be checked out through anonymous
(pserver) CVS with the following instruction set. When prompted for a
password for anoncvs, simply press the Enter key.

cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/gengetopt login

cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/gengetopt co gengetopt

Further instructions can be found at the address:
http://savannah.gnu.org/projects/gengetopt .


    Installation

See the file INSTALL for detailed building and installation
instructions; anyway if you're used to compiling Linux software that
comes with sources you may simply follow the usual procedure:

cd /<source code main directory>
/./configure
make
make install

Note: unless you specify a different install directory by --prefix
option of configure (e.g. ./configure --prefix=/<your home>/ ), you must
be root to 'make install'.

You can also run some tests by issuing 'make check'.

Files will be installed in the following directories:

    * Executables          -> /prefix/bin
    * Docs                 -> /prefix/share/doc/gengetopt
    * Man pages            -> /prefix/man
    * Examples             -> /prefix/share/doc/gengetopt/examples
    * Util files           -> /prefix/share/gengetopt

Default value for prefix is /usr/local but you may change it with
--prefix option to configure (see above).


      What you need to build gengetopt

*Actually you need nothing more than a Unix C/C++ compiler.*

/getopt_long/ function is usually in the standard C library, but there
may be some C libraries which don't include it; in this case you have to
link the program that uses the file generated by gengetopt with the
files /getopt.c/ and /getopt1.c/ and include /getopt.h/ in your project.
You may also need to link /alloca.c./We obviously provide these files in
the utility files directory (/prefix/share/gengetopt). These files are
part of the GNU C library. You may want to take a look at /getopt/ man
page <man_getopt.html>. Read also no_getopt_long.txt. for instuctions on
how to check if /getopt_long/ and /alloca/ are part of the library and
how to deal with their lacking (using /autoconf/ and /automake/).

gengetopt has been developed under Linux, using *gcc*, and *bison*
(yacc) and *flex* (lex), and ported under Windows with *Cygwin C/C++*
compiler, available at http://www.cygwin.com/. I used the excellent GNU
*Autoconf* and *Automake*. I also used *Autotools
*(ftp://ftp.ugcs.caltech.edu/pub/elef/autotools ) which creates a
starting source tree (according to GNU standards) with autoconf,
automake starting files, and *getopt_long* (for command line parsing).
Moreover /Gengen/ (http://www.lorenzobettini.it/software/gengen/ ) is
used for automatically generating the code that generates the command
line parser.

Actually, unless you want to develop gengetopt, you don't need all these
tools to build gengetopt because I provide generated sources; you don't
need neither bison (yacc) nor flex (lex), for the same reason. Actually
programs that use lex generated files need to link with library
/libfl/(or/ libl /for lex); anyway configuration phase can discover if
this library is missing and in that case it sets the program to link
with a source file I provide. This hack works for flex: I don't know
about lex generated scanners. But, again, this is a problem only if you
develop gengetopt and you use lex.

Should you want to act on the generated code you may want to download
/Gengen/ that speeds up this part
(http://www.lorenzobettini.it/software/gengen/ ).


      Patching from a previous version

If you downloaded a patch, say gengetopt-1.3-1.3.1-patch.gz (i.e. the
patch to go from version 1.3 to version 1.3.1), cd to the directory with
sources from the previous version (gengetopt-1.3) and type:

gunzip -cd ../gengetopt-1.3-1.3.1.patch.gz | patch -p1

and restart the compilation process (if you had already run configure a
simple make will do).


    Credits

See THANKS file :-)


    Feedback

Tell us if you like this software :-)

Actually we want to extend it, so if you have some ideas... The most
import one will be to make gengetopt more customizable :-)

Please send all bug reports by electronic mail to:
bug-gengetopt@gnu.org <mailto:bug-gengetopt@gnu.org>


    Mailing Lists

The following mailing lists are available:

    * help-gengetopt@gnu.org <mailto:help-gengetopt@gnu.org>, for
      generic discussions about the program and for asking for help
      about it (open mailing list),
      http://mail.gnu.org/mailman/listinfo/help-gengetopt
    * info-gengetopt@gnu.org <mailto:info-gengetopt@gnu.org> , for
      receiving information about new releases and features (read-only
      mailing list), http://mail.gnu.org/mailman/listinfo/info-gengetopt

if you want to subscribe to a mailing list just go to the URL and follow
the instructions.
 
*Lorenzo Bettini*
http://www.lorenzobettini.it

gengetopt is free software. See the file LICENSE and COPYING for copying
conditions. Anyway we won't get offended if you send us a postcard :-)

C/C++ files are formatted with /GNU Source-highlight/
(http://www.gnu.org/software/src-highlite/ ) by Lorenzo Bettini.

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

Return to GNU's home page </home.html>.

Please send FSF & GNU inquiries & questions to /gnu@gnu.org
<mailto:gnu@gnu.org> /. There are also other ways to contact
<http://www.gnu.org/home.html#ContactInfo> the FSF.

Please send comments on these web pages to /webmasters@gnu.org
<mailto:webmasters@gnu.org> /, send other questions to /gnu@gnu.org
<mailto:gnu@gnu.org> /.

Copyright (C) 2001 Free Software Foundation, Inc., 59 Temple Place -
Suite 330, Boston, MA 02111, USA

Verbatim copying and distribution of this entire article is permitted in
any medium, provided this notice is preserved.

Updated:9 Jan 2001 mhw

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

