Deleted Added
full compact
2c2
< *
---
> *
4,5c4,5
< *
< * It has been AutoGen-ed
---
> *
> * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:35 PM PDT
9c9,19
< * Generated from AutoOpts 41:0:16 templates.
---
> * Generated from AutoOpts 29:0:4 templates.
> */
>
> /*
> * This file was produced by an AutoOpts template. AutoOpts is a
> * copyrighted work. This header file is not encumbered by AutoOpts
> * licensing, but is provided under the licensing terms chosen by the
> * genshellopt author or copyright holder. AutoOpts is licensed under
> * the terms of the LGPL. The redistributable library (``libopts'') is
> * licensed under the terms of either the LGPL or, at the users discretion,
> * the BSD license. See the AutoOpts and/or libopts sources for details.
11,17c21
< * AutoOpts is a copyrighted work. This header file is not encumbered
< * by AutoOpts licensing, but is provided under the licensing terms chosen
< * by the genshellopt author or copyright holder. AutoOpts is
< * licensed under the terms of the LGPL. The redistributable library
< * (``libopts'') is licensed under the terms of either the LGPL or, at the
< * users discretion, the BSD license. See the AutoOpts and/or libopts sources
< * for details.
---
> * This source file is copyrighted and licensed under the following terms:
19,20c23
< * The genshellopt program is copyrighted and licensed
< * under the following terms:
---
> * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved
22,39c25,39
< * Copyright (C) 1999-2014 Bruce Korb, all rights reserved.
< * This is free software. It is licensed for use, modification and
< * redistribution under the terms of the GNU Lesser General Public License,
< * version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
< *
< * The genshellopt library is free software; you can redistribute it and/or
< * modify it under the terms of the GNU Library General Public License as
< * published by the Free Software Foundation; either version 2 of the
< * License, or (at your option) any later version.
< *
< * This library is distributed in the hope that it will be useful, but
< * WITHOUT ANY WARRANTY; without even the implied warranty of
< * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
< * Library General Public License for more details.
< *
< * You should have received a copy of the GNU Library General Public
< * License along with this library; if not, see
< * <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html>
---
> * genshellopt is free software; you can redistribute it and/or
> * modify it under the terms of the GNU Lesser General Public
> * License as published by the Free Software Foundation; either
> * version 2.1 of the License, or (at your option) any later version.
> *
> * genshellopt is distributed in the hope that it will be useful,
> * but WITHOUT ANY WARRANTY; without even the implied warranty of
> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> * Lesser General Public License for more details.
> *
> * You should have received a copy of the GNU Lesser General Public
> * License along with genshellopt. If not, write to:
> * The Free Software Foundation, Inc.,
> * 51 Franklin Street, Fifth Floor
> * Boston, MA 02110-1301, USA.
41c41
< /**
---
> /*
48c48
< #define AUTOOPTS_GENSHELL_H_GUARD 1
---
> #define AUTOOPTS_GENSHELL_H_GUARD
51c51
< /**
---
> /*
58c58
< #define AO_TEMPLATE_VERSION 167936
---
> #define AO_TEMPLATE_VERSION 118784
65,66c65,66
< /**
< * Enumeration of each option type for genshellopt
---
> /*
> * Enumeration of each option:
69,77c69,76
< INDEX_GENSHELL_OPT_SCRIPT = 0,
< INDEX_GENSHELL_OPT_SHELL = 1,
< INDEX_GENSHELL_OPT_VERSION = 2,
< INDEX_GENSHELL_OPT_HELP = 3,
< INDEX_GENSHELL_OPT_MORE_HELP = 4
< } teGenshell_OptIndex;
< /** count of all options for genshellopt */
< #define GENSHELL_OPTION_CT 5
< /** genshellopt version */
---
> INDEX_OPT_SCRIPT = 0,
> INDEX_OPT_SHELL = 1,
> INDEX_OPT_VERSION = 2,
> INDEX_OPT_HELP = 3,
> INDEX_OPT_MORE_HELP = 4
> } teOptIndex;
>
> #define OPTION_CT 5
79,80c78
< /** Full genshellopt version text */
< #define GENSHELLOPT_FULL_VERSION "genshellopt 1"
---
> #define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1"
82c80
< /**
---
> /*
84,85c82,83
< * option name (as in the teGenshell_OptIndex enumeration above).
< * e.g. HAVE_GENSHELL_OPT(SCRIPT)
---
> * option name (as in the teOptIndex enumeration above).
> * e.g. HAVE_OPT( SCRIPT )
87,127c85,101
< #define GENSHELL_DESC(n) (genshelloptOptions.pOptDesc[INDEX_GENSHELL_OPT_## n])
< /** 'true' if an option has been specified in any way */
< #define HAVE_GENSHELL_OPT(n) (! UNUSED_OPT(& GENSHELL_DESC(n)))
< /** The string argument to an option. The argument type must be \"string\". */
< #define GENSHELL_OPT_ARG(n) (GENSHELL_DESC(n).optArg.argString)
< /** Mask the option state revealing how an option was specified.
< * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
< * \a OPTST_DEFINED, \a OPTST_RESET or zero.
< */
< #define STATE_GENSHELL_OPT(n) (GENSHELL_DESC(n).fOptState & OPTST_SET_MASK)
< /** Count of option's occurrances *on the command line*. */
< #define COUNT_GENSHELL_OPT(n) (GENSHELL_DESC(n).optOccCt)
< /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
< #define ISSEL_GENSHELL_OPT(n) (SELECTED_OPT(&GENSHELL_DESC(n)))
< /** 'true' if \a HAVE_OPT would yield 'false'. */
< #define ISUNUSED_GENSHELL_OPT(n) (UNUSED_OPT(& GENSHELL_DESC(n)))
< /** 'true' if OPTST_DISABLED bit not set. */
< #define ENABLED_GENSHELL_OPT(n) (! DISABLED_OPT(& GENSHELL_DESC(n)))
< /** number of stacked option arguments.
< * Valid only for stacked option arguments. */
< #define STACKCT_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->useCt)
< /** stacked argument vector.
< * Valid only for stacked option arguments. */
< #define STACKLST_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->apzArgs)
< /** Reset an option. */
< #define CLEAR_GENSHELL_OPT(n) STMTS( \
< GENSHELL_DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
< if ((GENSHELL_DESC(n).fOptState & OPTST_INITENABLED) == 0) \
< GENSHELL_DESC(n).fOptState |= OPTST_DISABLED; \
< GENSHELL_DESC(n).optCookie = NULL )
< /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
< /**
< * Enumeration of genshellopt exit codes
< */
< typedef enum {
< GENSHELLOPT_EXIT_SUCCESS = 0,
< GENSHELLOPT_EXIT_FAILURE = 1,
< GENSHELLOPT_EXIT_USAGE_ERROR = 64,
< GENSHELLOPT_EXIT_LIBOPTS_FAILURE = 70
< } genshellopt_exit_code_t;
< /**
---
> #define DESC(n) (genshelloptOptions.pOptDesc[INDEX_OPT_## n])
> #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
> #define OPT_ARG(n) (DESC(n).optArg.argString)
> #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
> #define COUNT_OPT(n) (DESC(n).optOccCt)
> #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
> #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
> #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
> #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
> #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
> #define CLEAR_OPT(n) STMTS( \
> DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
> if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
> DESC(n).fOptState |= OPTST_DISABLED; \
> DESC(n).optCookie = NULL )
>
> /*
129d102
< * @{
131,138c104,109
< #define VALUE_GENSHELL_OPT_SCRIPT 'o'
< #define VALUE_GENSHELL_OPT_SHELL 's'
< /** option flag (value) for help-value option */
< #define VALUE_GENSHELL_OPT_HELP '?'
< /** option flag (value) for more-help-value option */
< #define VALUE_GENSHELL_OPT_MORE_HELP '!'
< /** option flag (value) for version-value option */
< #define VALUE_GENSHELL_OPT_VERSION 'v'
---
> #define VALUE_OPT_SCRIPT 'o'
> #define VALUE_OPT_SHELL 's'
>
> #define VALUE_OPT_VERSION 'v'
> #define VALUE_OPT_HELP '?'
> #define VALUE_OPT_MORE_HELP '!'
142,144c113,115
< #define ERRSKIP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP)
< #define ERRSTOP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP)
< #define RESTART_GENSHELL_OPT(n) STMTS( \
---
> #define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP )
> #define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP )
> #define RESTART_OPT(n) STMTS( \
147,148c118,120
< #define START_GENSHELL_OPT RESTART_GENSHELL_OPT(1)
< #define GENSHELL_USAGE(c) (*genshelloptOptions.pUsageProc)(&genshelloptOptions, c)
---
> #define START_OPT RESTART_OPT(1)
> #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c )
> /* extracted from opthead.tpl near line 360 */
150,154d121
< #ifdef __cplusplus
< extern "C" {
< #endif
<
<
159c126,128
< extern tOptions genshelloptOptions;
---
> #ifdef __cplusplus
> extern "C" {
> #endif
161,168c130
< #if defined(ENABLE_NLS)
< # ifndef _
< # include <stdio.h>
< # ifndef HAVE_GETTEXT
< extern char * gettext(char const *);
< # else
< # include <libintl.h>
< # endif
---
> extern tOptions genshelloptOptions;
170,172c132,143
< # ifndef ATTRIBUTE_FORMAT_ARG
< # define ATTRIBUTE_FORMAT_ARG(_a)
< # endif
---
> #ifndef _
> # if ENABLE_NLS
> # include <stdio.h>
> static inline char* aoGetsText( char const* pz ) {
> if (pz == NULL) return NULL;
> return (char*)gettext( pz );
> }
> # define _(s) aoGetsText(s)
> # else /* ENABLE_NLS */
> # define _(s) s
> # endif /* ENABLE_NLS */
> #endif
174,203d144
< static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
< static inline char* aoGetsText(char const* pz) {
< if (pz == NULL) return NULL;
< return (char*)gettext(pz);
< }
< # define _(s) aoGetsText(s)
< # endif /* _() */
<
< # define OPT_NO_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet |= \
< OPTPROC_NXLAT_OPT_CFG;)
< # define OPT_NO_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet |= \
< OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
<
< # define OPT_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet &= \
< ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
< # define OPT_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet &= \
< ~OPTPROC_NXLAT_OPT;)
<
< #else /* ENABLE_NLS */
< # define OPT_NO_XLAT_CFG_NAMES
< # define OPT_NO_XLAT_OPT_NAMES
<
< # define OPT_XLAT_CFG_NAMES
< # define OPT_XLAT_OPT_NAMES
<
< # ifndef _
< # define _(_s) _s
< # endif
< #endif /* ENABLE_NLS */
<
208d148
<