[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.12 AutoOpts for Shell Scripts

AutoOpts may be used with shell scripts either by automatically creating a complete program that will process command line options and pass back the results to the invoking shell by issuing shell variable assignment commands, or it may be used to generate portable shell code that can be inserted into your script.

The functionality of these features, of course, is somewhat constrained compared with the normal program facilities. Specifically, you cannot invoke callout procedures with either of these methods. Additionally, if you generate a shell script to do the parsing:

  1. You cannot obtain options from configuration files.
  2. You cannot obtain options from environment variables.
  3. You cannot save the option state to an option file.
  4. Option conflict/requirement verification is disabled.

Both of these methods are enabled by running AutoGen on the definitions file with the additional main procedure attribute:

 
main = { main-type = shell-process; };

or:

 
main = { main-type = shell-parser; };

If you do not supply a proc-to-call, it will default to optionPutShell. That will produce a program that will process the options and generate shell text for the invoking shell to interpret (see section Parsing with an Executable). If you supply the name, optionParseShell, then you will have a program that will generate a shell script that can parse the options (see section Parsing with a Portable Script). If you supply a different procedure name, you will have to provide that routine and it may do whatever you like.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.12.1 Parsing with an Executable

The following commands are approximately all that is needed to build a shell script command line option parser from an option definition file:

 
autogen -L <opt-template-dir> test-errors.def
cc -o test-errors -L <opt-lib-dir> -I <opt-include-dir> \
        -DTEST_PROGRAM_OPTS test-errors.c -lopts

The resulting program can then be used within your shell script as follows:

 
eval `./test-errors "$@"`
if [ -z "${OPTION_CT}" ] ; then exit 1 ; fi
test ${OPTION_CT} -gt 0 && shift ${OPTION_CT}

Here is the usage output example from AutoOpts error handling tests. The option definition has argument reordering enabled:

 
test_errors - Test AutoOpts for errors
Usage:  errors [ -<flag> [<val>] | --<name>[{=| }<val>] ]... arg ...
  Flg Arg Option-Name    Description
   -o no  option         The option option descrip
   -s Str second         The second option descrip
                                - may appear up to 10 times
   -i --- ignored        we have dumped this
   -X no  another        Another option descrip
                                - may appear up to 5 times
   -? no  help           display extended usage information and exit
   -! no  more-help      extended usage information passed thru pager
   -> opt save-opts      save the option state to a config file
   -< Str load-opts      load options from a config file
                                - disabled as '--no-load-opts'
                                - may appear multiple times

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Operands and options may be intermixed.  They will be reordered.

The following option preset mechanisms are supported:
 - reading file errorsRC
Packaged by Bruce (2015-08-21)
Report test_errors bugs to bkorb@gnu.org

Using the invocation,

 
  test-errors operand1 -s first operand2 -X -- -s operand3

you get the following output for your shell script to evaluate:

 
OPTION_CT=4
export OPTION_CT
TEST_ERRORS_SECOND='first'
export TEST_ERRORS_SECOND
TEST_ERRORS_ANOTHER=1 # 0x1
export TEST_ERRORS_ANOTHER
set -- 'operand1' 'operand2' '-s' 'operand3'
OPTION_CT=0

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.12.2 Parsing with a Portable Script

If you had used test-main = optionParseShell instead, then you can, at this point, merely run the program and it will write the parsing script to standard out. You may also provide this program with command line options to specify the shell script file to create or edit, and you may specify the shell program to use on the first shell script line. That program’s usage text would look something like the following and the script parser itself would be very verbose:

 
genshellopt - Generate Shell Option Processing Script - Ver. 1
Usage:  genshellopt [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
  Flg Arg Option-Name    Description
   -o Str script         Output Script File
   -s Str shell          Shell name (follows "#!" magic)
                                - disabled as '--no-shell'
                                - enabled by default
   -v opt version        output version information and exit
   -? no  help           display extended usage information and exit
   -! no  more-help      extended usage information passed thru pager

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Note that 'shell' is only useful if the output file does not already exist.
If it does, then the shell name and optional first argument will be
extracted from the script file.
If the script file already exists and contains Automated Option Processing
text, the second line of the file through the ending tag will be replaced
by the newly generated text.  The first '#!' line will be regenerated.
Packaged by Bruce (2015-08-21)
Report genshellopt bugs to bkorb@gnu.org

= = = = = = = =

This incarnation of genshell will produce
a shell script to parse the options for getdefs:

getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
Usage:  getdefs [ <option-name>[{=| }<val>] ]...
   Arg Option-Name    Description
   Str defs-to-get    Regexp to look for after the "/*="
   Str subblock       subblock definition names
   Str listattr       attribute with list of values
   opt ordering       Alphabetize or use named file
   Num first-index    The first index to apply to groups
   opt filelist       Insert source file names into defs
   Str assign         Global assignments
   Str common-assign  Assignments common to all blocks
   Str copy           File(s) to copy into definitions
   opt srcfile        Insert source file name into each def
   opt linenum        Insert source line number into each def
   Str input          Input file to search for defs
   Str output         Output file to open
   opt autogen        Invoke AutoGen with defs
   Str template       Template Name
   Str agarg          AutoGen Argument
   Str base-name      Base name for output file(s)
   opt version        output version information and exit
   no  help           display extended usage information and exit
   no  more-help      extended usage information passed thru pager
   opt save-opts      save the option state to a config file
   Str load-opts      load options from a config file

All arguments are named options.
If no 'input' argument is provided or is set to simply "-", and if 'stdin'
is not a 'tty', then the list of input files will be read from 'stdin'.
Packaged by Bruce (2015-08-21)
Report getdefs bugs to bkorb@gnu.org

Resulting in the following script:

 
#! /bin/sh
# # # # # # # # # # -- do not modify this marker --
#
#  DO NOT EDIT THIS SECTION
 OF /u/bkorb/ag/ag/doc/ag-texi-17516.d/.ag-Zq75tt/genshellopt.sh
#
#  From here to the next `-- do not modify this marker --',
#  the text has been generated Friday August 21, 2015 at 01:11:48 PM PDT
#  From the GETDEFS option definitions
#
GETDEFS_LONGUSAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
Usage:  getdefs [ <option-name>[{=| }<val>] ]...

Specify which definitions are of interest and what to say about them:

   Arg Option-Name    Description
   Str defs-to-get    Regexp to look for after the "/*="
   Str subblock       subblock definition names
                                - may appear multiple times
   Str listattr       attribute with list of values
                                - may appear multiple times

specify how to number the definitions:

   Arg Option-Name    Description
   opt ordering       Alphabetize or use named file
                                - disabled as '\''--no-ordering'\''
                                - enabled by default
   Num first-index    The first index to apply to groups

Definition insertion options:

   Arg Option-Name    Description
   opt filelist       Insert source file names into defs
   Str assign         Global assignments
                                - may appear multiple times
   Str common-assign  Assignments common to all blocks
                                - may appear multiple times
   Str copy           File(s) to copy into definitions
                                - may appear multiple times
   opt srcfile        Insert source file name into each def
   opt linenum        Insert source line number into each def

specify which files to search for markers:

   Arg Option-Name    Description
   Str input          Input file to search for defs
                                - may appear multiple times
                                - default option for unnamed options

Definition output disposition options::

   Arg Option-Name    Description
   Str output         Output file to open
                                - an alternate for '\''autogen'\''
   opt autogen        Invoke AutoGen with defs
                                - disabled as '\''--no-autogen'\''
                                - enabled by default
   Str template       Template Name
   Str agarg          AutoGen Argument
                                - prohibits the option '\''output'\''
                                - may appear multiple times
   Str base-name      Base name for output file(s)
                                - prohibits the option '\''output'\''

Version, usage and configuration options:

   Arg Option-Name    Description
   opt version        output version information and exit
   no  help           display extended usage information and exit
   no  more-help      extended usage information passed thru pager
   opt save-opts      save the option state to a config file
   Str load-opts      load options from a config file
                                - disabled as '\''--no-load-opts'\''
                                - may appear multiple times

All arguments are named options.
If no '\''input'\'' argument is provided or is set to simply "-", and if '\''stdin'\''
is not a '\''tty'\'', then the list of input files will be read from '\''stdin'\''.

The following option preset mechanisms are supported:
 - reading file /dev/null
This program extracts AutoGen definitions from a list of source files.
Definitions are delimited by '\''/*=<entry-type> <entry-name>\n'\'' and '\''=*/\n'\''.
Packaged by Bruce (2015-08-21)
Report getdefs bugs to bkorb@gnu.org'

GETDEFS_USAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
Usage:  getdefs [ <option-name>[{=| }<val>] ]...
   Arg Option-Name    Description
   Str defs-to-get    Regexp to look for after the "/*="
   Str subblock       subblock definition names
   Str listattr       attribute with list of values
   opt ordering       Alphabetize or use named file
   Num first-index    The first index to apply to groups
   opt filelist       Insert source file names into defs
   Str assign         Global assignments
   Str common-assign  Assignments common to all blocks
   Str copy           File(s) to copy into definitions
   opt srcfile        Insert source file name into each def
   opt linenum        Insert source line number into each def
   Str input          Input file to search for defs
   Str output         Output file to open
   opt autogen        Invoke AutoGen with defs
   Str template       Template Name
   Str agarg          AutoGen Argument
   Str base-name      Base name for output file(s)
   opt version        output version information and exit
   no  help           display extended usage information and exit
   no  more-help      extended usage information passed thru pager
   opt save-opts      save the option state to a config file
   Str load-opts      load options from a config file

All arguments are named options.
If no '\''input'\'' argument is provided or is set to simply "-", and if '\''stdin'\''
is not a '\''tty'\'', then the list of input files will be read from '\''stdin'\''.
Packaged by Bruce (2015-08-21)
Report getdefs bugs to bkorb@gnu.org'


GETDEFS_DEFS_TO_GET=${GETDEFS_DEFS_TO_GET}
GETDEFS_DEFS_TO_GET_set=false
export GETDEFS_DEFS_TO_GET

if test -z "${GETDEFS_SUBBLOCK}"
then
  GETDEFS_SUBBLOCK_CT=0
  export GETDEFS_SUBBLOCK_CT
else
  GETDEFS_SUBBLOCK_CT=1
  GETDEFS_SUBBLOCK_1=${GETDEFS_SUBBLOCK}
  export GETDEFS_SUBBLOCK_CT GETDEFS_SUBBLOCK_1
fi

if test -z "${GETDEFS_LISTATTR}"
then
  GETDEFS_LISTATTR_CT=0
  export GETDEFS_LISTATTR_CT
else
  GETDEFS_LISTATTR_CT=1
  GETDEFS_LISTATTR_1=${GETDEFS_LISTATTR}
  export GETDEFS_LISTATTR_CT GETDEFS_LISTATTR_1
fi

GETDEFS_ORDERING=${GETDEFS_ORDERING}
GETDEFS_ORDERING_set=false
export GETDEFS_ORDERING

GETDEFS_FIRST_INDEX=${GETDEFS_FIRST_INDEX-'0'}
GETDEFS_FIRST_INDEX_set=false
export GETDEFS_FIRST_INDEX

GETDEFS_FILELIST=${GETDEFS_FILELIST}
GETDEFS_FILELIST_set=false
export GETDEFS_FILELIST

if test -z "${GETDEFS_ASSIGN}"
then
  GETDEFS_ASSIGN_CT=0
  export GETDEFS_ASSIGN_CT
else
  GETDEFS_ASSIGN_CT=1
  GETDEFS_ASSIGN_1=${GETDEFS_ASSIGN}
  export GETDEFS_ASSIGN_CT GETDEFS_ASSIGN_1
fi

if test -z "${GETDEFS_COMMON_ASSIGN}"
then
  GETDEFS_COMMON_ASSIGN_CT=0
  export GETDEFS_COMMON_ASSIGN_CT
else
  GETDEFS_COMMON_ASSIGN_CT=1
  GETDEFS_COMMON_ASSIGN_1=${GETDEFS_COMMON_ASSIGN}
  export GETDEFS_COMMON_ASSIGN_CT GETDEFS_COMMON_ASSIGN_1
fi

if test -z "${GETDEFS_COPY}"
then
  GETDEFS_COPY_CT=0
  export GETDEFS_COPY_CT
else
  GETDEFS_COPY_CT=1
  GETDEFS_COPY_1=${GETDEFS_COPY}
  export GETDEFS_COPY_CT GETDEFS_COPY_1
fi

GETDEFS_SRCFILE=${GETDEFS_SRCFILE}
GETDEFS_SRCFILE_set=false
export GETDEFS_SRCFILE

GETDEFS_LINENUM=${GETDEFS_LINENUM}
GETDEFS_LINENUM_set=false
export GETDEFS_LINENUM

if test -z "${GETDEFS_INPUT}"
then
  GETDEFS_INPUT_CT=0
  export GETDEFS_INPUT_CT
else
  GETDEFS_INPUT_CT=1
  GETDEFS_INPUT_1=${GETDEFS_INPUT}
  export GETDEFS_INPUT_CT GETDEFS_INPUT_1
fi

GETDEFS_OUTPUT=${GETDEFS_OUTPUT}
GETDEFS_OUTPUT_set=false
export GETDEFS_OUTPUT

GETDEFS_AUTOGEN=${GETDEFS_AUTOGEN}
GETDEFS_AUTOGEN_set=false
export GETDEFS_AUTOGEN

GETDEFS_TEMPLATE=${GETDEFS_TEMPLATE}
GETDEFS_TEMPLATE_set=false
export GETDEFS_TEMPLATE

if test -z "${GETDEFS_AGARG}"
then
  GETDEFS_AGARG_CT=0
  export GETDEFS_AGARG_CT
else
  GETDEFS_AGARG_CT=1
  GETDEFS_AGARG_1=${GETDEFS_AGARG}
  export GETDEFS_AGARG_CT GETDEFS_AGARG_1
fi

GETDEFS_BASE_NAME=${GETDEFS_BASE_NAME}
GETDEFS_BASE_NAME_set=false
export GETDEFS_BASE_NAME

ARG_COUNT=$#
OPT_ARG=$1
while [ $# -gt 0 ]
do
    OPT_ELEMENT=''
    OPT_ARG_VAL=''
    OPT_ARG=${1}
        OPT_CODE=`echo "X${OPT_ARG}"|sed 's/^X-*//'`
        shift
        OPT_ARG=$1
        case "${OPT_CODE}" in *=* )
            OPT_ARG_VAL=`echo "${OPT_CODE}"|sed 's/^[^=]*=//'`
            OPT_CODE=`echo "${OPT_CODE}"|sed 's/=.*$//'` ;; esac
        case "${OPT_CODE}" in
        'de' | \
        'def' | \
        'defs' | \
        'defs-' | \
        'defs-t' | \
        'defs-to' | \
        'defs-to-' | \
        'defs-to-g' | \
        'defs-to-ge' | \
        'defs-to-get' )
            if [ -n "${GETDEFS_DEFS_TO_GET}" ] && ${GETDEFS_DEFS_TO_GET_set} ; then
                echo 'Error:  duplicate DEFS_TO_GET option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_DEFS_TO_GET_set=true
            OPT_NAME='DEFS_TO_GET'
            OPT_ARG_NEEDED=YES
            ;;

        'su' | \
        'sub' | \
        'subb' | \
        'subbl' | \
        'subblo' | \
        'subbloc' | \
        'subblock' )
            GETDEFS_SUBBLOCK_CT=`expr ${GETDEFS_SUBBLOCK_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_SUBBLOCK_CT}"
            OPT_NAME='SUBBLOCK'
            OPT_ARG_NEEDED=YES
            ;;

        'li' | \
        'lis' | \
        'list' | \
        'lista' | \
        'listat' | \
        'listatt' | \
        'listattr' )
            GETDEFS_LISTATTR_CT=`expr ${GETDEFS_LISTATTR_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_LISTATTR_CT}"
            OPT_NAME='LISTATTR'
            OPT_ARG_NEEDED=YES
            ;;

        'or' | \
        'ord' | \
        'orde' | \
        'order' | \
        'orderi' | \
        'orderin' | \
        'ordering' )
            if [ -n "${GETDEFS_ORDERING}" ] && ${GETDEFS_ORDERING_set} ; then
                echo 'Error:  duplicate ORDERING option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_ORDERING_set=true
            OPT_NAME='ORDERING'
            eval GETDEFS_ORDERING${OPT_ELEMENT}=true
            export GETDEFS_ORDERING${OPT_ELEMENT}
            OPT_ARG_NEEDED=OK
            ;;

        'no-' | \
        'no-o' | \
        'no-or' | \
        'no-ord' | \
        'no-orde' | \
        'no-order' | \
        'no-orderi' | \
        'no-orderin' | \
        'no-ordering' )
            if [ -n "${GETDEFS_ORDERING}" ] && ${GETDEFS_ORDERING_set} ; then
                echo 'Error:  duplicate ORDERING option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_ORDERING_set=true
            GETDEFS_ORDERING='no'
            export GETDEFS_ORDERING
            OPT_NAME='ORDERING'
            OPT_ARG_NEEDED=NO
            ;;

        'fi' | \
        'fir' | \
        'firs' | \
        'first' | \
        'first-' | \
        'first-i' | \
        'first-in' | \
        'first-ind' | \
        'first-inde' | \
        'first-index' )
            if [ -n "${GETDEFS_FIRST_INDEX}" ] && ${GETDEFS_FIRST_INDEX_set} ; then
                echo 'Error:  duplicate FIRST_INDEX option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_FIRST_INDEX_set=true
            OPT_NAME='FIRST_INDEX'
            OPT_ARG_NEEDED=YES
            ;;

        'fi' | \
        'fil' | \
        'file' | \
        'filel' | \
        'fileli' | \
        'filelis' | \
        'filelist' )
            if [ -n "${GETDEFS_FILELIST}" ] && ${GETDEFS_FILELIST_set} ; then
                echo 'Error:  duplicate FILELIST option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_FILELIST_set=true
            OPT_NAME='FILELIST'
            eval GETDEFS_FILELIST${OPT_ELEMENT}=true
            export GETDEFS_FILELIST${OPT_ELEMENT}
            OPT_ARG_NEEDED=OK
            ;;

        'as' | \
        'ass' | \
        'assi' | \
        'assig' | \
        'assign' )
            GETDEFS_ASSIGN_CT=`expr ${GETDEFS_ASSIGN_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_ASSIGN_CT}"
            OPT_NAME='ASSIGN'
            OPT_ARG_NEEDED=YES
            ;;

        'co' | \
        'com' | \
        'comm' | \
        'commo' | \
        'common' | \
        'common-' | \
        'common-a' | \
        'common-as' | \
        'common-ass' | \
        'common-assi' | \
        'common-assig' | \
        'common-assign' )
            GETDEFS_COMMON_ASSIGN_CT=`expr ${GETDEFS_COMMON_ASSIGN_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_COMMON_ASSIGN_CT}"
            OPT_NAME='COMMON_ASSIGN'
            OPT_ARG_NEEDED=YES
            ;;

        'co' | \
        'cop' | \
        'copy' )
            GETDEFS_COPY_CT=`expr ${GETDEFS_COPY_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_COPY_CT}"
            OPT_NAME='COPY'
            OPT_ARG_NEEDED=YES
            ;;

        'sr' | \
        'src' | \
        'srcf' | \
        'srcfi' | \
        'srcfil' | \
        'srcfile' )
            if [ -n "${GETDEFS_SRCFILE}" ] && ${GETDEFS_SRCFILE_set} ; then
                echo 'Error:  duplicate SRCFILE option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_SRCFILE_set=true
            OPT_NAME='SRCFILE'
            eval GETDEFS_SRCFILE${OPT_ELEMENT}=true
            export GETDEFS_SRCFILE${OPT_ELEMENT}
            OPT_ARG_NEEDED=OK
            ;;

        'li' | \
        'lin' | \
        'line' | \
        'linen' | \
        'linenu' | \
        'linenum' )
            if [ -n "${GETDEFS_LINENUM}" ] && ${GETDEFS_LINENUM_set} ; then
                echo 'Error:  duplicate LINENUM option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_LINENUM_set=true
            OPT_NAME='LINENUM'
            eval GETDEFS_LINENUM${OPT_ELEMENT}=true
            export GETDEFS_LINENUM${OPT_ELEMENT}
            OPT_ARG_NEEDED=OK
            ;;

        'in' | \
        'inp' | \
        'inpu' | \
        'input' )
            GETDEFS_INPUT_CT=`expr ${GETDEFS_INPUT_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_INPUT_CT}"
            OPT_NAME='INPUT'
            OPT_ARG_NEEDED=YES
            ;;

        'ou' | \
        'out' | \
        'outp' | \
        'outpu' | \
        'output' )
            if [ -n "${GETDEFS_OUTPUT}" ] && ${GETDEFS_OUTPUT_set} ; then
                echo 'Error:  duplicate OUTPUT option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_OUTPUT_set=true
            OPT_NAME='OUTPUT'
            OPT_ARG_NEEDED=YES
            ;;

        'au' | \
        'aut' | \
        'auto' | \
        'autog' | \
        'autoge' | \
        'autogen' )
            if [ -n "${GETDEFS_AUTOGEN}" ] && ${GETDEFS_AUTOGEN_set} ; then
                echo 'Error:  duplicate AUTOGEN option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_AUTOGEN_set=true
            OPT_NAME='AUTOGEN'
            eval GETDEFS_AUTOGEN${OPT_ELEMENT}=true
            export GETDEFS_AUTOGEN${OPT_ELEMENT}
            OPT_ARG_NEEDED=OK
            ;;

        'no-' | \
        'no-a' | \
        'no-au' | \
        'no-aut' | \
        'no-auto' | \
        'no-autog' | \
        'no-autoge' | \
        'no-autogen' )
            if [ -n "${GETDEFS_AUTOGEN}" ] && ${GETDEFS_AUTOGEN_set} ; then
                echo 'Error:  duplicate AUTOGEN option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_AUTOGEN_set=true
            GETDEFS_AUTOGEN='no'
            export GETDEFS_AUTOGEN
            OPT_NAME='AUTOGEN'
            OPT_ARG_NEEDED=NO
            ;;

        'te' | \
        'tem' | \
        'temp' | \
        'templ' | \
        'templa' | \
        'templat' | \
        'template' )
            if [ -n "${GETDEFS_TEMPLATE}" ] && ${GETDEFS_TEMPLATE_set} ; then
                echo 'Error:  duplicate TEMPLATE option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_TEMPLATE_set=true
            OPT_NAME='TEMPLATE'
            OPT_ARG_NEEDED=YES
            ;;

        'ag' | \
        'aga' | \
        'agar' | \
        'agarg' )
            GETDEFS_AGARG_CT=`expr ${GETDEFS_AGARG_CT} + 1`
            OPT_ELEMENT="_${GETDEFS_AGARG_CT}"
            OPT_NAME='AGARG'
            OPT_ARG_NEEDED=YES
            ;;

        'ba' | \
        'bas' | \
        'base' | \
        'base-' | \
        'base-n' | \
        'base-na' | \
        'base-nam' | \
        'base-name' )
            if [ -n "${GETDEFS_BASE_NAME}" ] && ${GETDEFS_BASE_NAME_set} ; then
                echo 'Error:  duplicate BASE_NAME option'
                echo "$GETDEFS_USAGE_TEXT"
                exit 1
            fi >&2
            GETDEFS_BASE_NAME_set=true
            OPT_NAME='BASE_NAME'
            OPT_ARG_NEEDED=YES
            ;;

        've' | \
        'ver' | \
        'vers' | \
        'versi' | \
        'versio' | \
        'version' )
            echo "$GETDEFS_LONGUSAGE_TEXT"
            exit 0
            ;;

        'he' | \
        'hel' | \
        'help' )
            echo "$GETDEFS_LONGUSAGE_TEXT"
            exit 0
            ;;

        'mo' | \
        'mor' | \
        'more' | \
        'more-' | \
        'more-h' | \
        'more-he' | \
        'more-hel' | \
        'more-help' )
            echo "$GETDEFS_LONGUSAGE_TEXT" | ${PAGER-more}
            exit 0
            ;;

        'sa' | \
        'sav' | \
        'save' | \
        'save-' | \
        'save-o' | \
        'save-op' | \
        'save-opt' | \
        'save-opts' )
            echo 'Warning:  Cannot save options files' >&2
            OPT_ARG_NEEDED=OK
            ;;

        'lo' | \
        'loa' | \
        'load' | \
        'load-' | \
        'load-o' | \
        'load-op' | \
        'load-opt' | \
        'load-opts' )
            echo 'Warning:  Cannot load options files' >&2
            OPT_ARG_NEEDED=YES
            ;;

        'no-' | \
        'no-l' | \
        'no-lo' | \
        'no-loa' | \
        'no-load' | \
        'no-load-' | \
        'no-load-o' | \
        'no-load-op' | \
        'no-load-opt' | \
        'no-load-opts' )
            echo 'Warning:  Cannot suppress the loading of options files' >&2
            OPT_ARG_NEEDED=NO
            ;;

        * )
            echo Unknown option: "${OPT_CODE}" >&2
            echo "$GETDEFS_USAGE_TEXT" >&2
            exit 1
            ;;
        esac
        case "${OPT_ARG_NEEDED}" in
        NO )
            OPT_ARG_VAL=''
            ;;
        YES )
            if [ -z "${OPT_ARG_VAL}" ]
            then
                if [ $# -eq 0 ]
                then
                    echo No argument provided for ${OPT_NAME} option
                    echo "$GETDEFS_USAGE_TEXT"
                    exit 1
                fi >&2
                OPT_ARG_VAL=${OPT_ARG}
                shift
                OPT_ARG=$1
            fi
            ;;
        OK )
            if [ -z "${OPT_ARG_VAL}" ] && [ $# -gt 0 ]
            then
                case "${OPT_ARG}" in -* ) ;; * )
                    OPT_ARG_VAL=${OPT_ARG}
                    shift
                    OPT_ARG=$1 ;; esac
            fi
            ;;
        esac
    if [ -n "${OPT_ARG_VAL}" ]
    then
        eval GETDEFS_${OPT_NAME}${OPT_ELEMENT}="'${OPT_ARG_VAL}'"
        export GETDEFS_${OPT_NAME}${OPT_ELEMENT}
    fi
done
OPTION_COUNT=`expr $ARG_COUNT - $#`
OPERAND_COUNT=$#
unset OPT_PROCESS || :
unset OPT_ELEMENT || :
unset OPT_ARG     || :
unset OPT_ARG_NEEDED || :
unset OPT_NAME    || :
unset OPT_CODE    || :
unset OPT_ARG_VAL || :

# # # # # # # # # #
#
#  END OF AUTOMATED OPTION PROCESSING
#
# # # # # # # # # # -- do not modify this marker --

env | grep '^GETDEFS_'

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.