Annotation of embedaddon/ntp/sntp/libopts/genshell.h, revision 1.1.1.1

1.1       misho       1: /*   -*- buffer-read-only: t -*- vi: set ro:
                      2:  *  
                      3:  *  DO NOT EDIT THIS FILE   (genshell.h)
                      4:  *  
                      5:  *  It has been AutoGen-ed  April 29, 2011 at 03:43:59 PM by AutoGen 5.11.9
                      6:  *  From the definitions    genshell.def
                      7:  *  and the template file   options
                      8:  *
                      9:  * Generated from AutoOpts 35:0:10 templates.
                     10:  *
                     11:  *  AutoOpts is a copyrighted work.  This header file is not encumbered
                     12:  *  by AutoOpts licensing, but is provided under the licensing terms chosen
                     13:  *  by the genshellopt author or copyright holder.  AutoOpts is
                     14:  *  licensed under the terms of the LGPL.  The redistributable library
                     15:  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
                     16:  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
                     17:  *  for details.
                     18:  *
                     19:  * This source file is copyrighted and licensed under the following terms:
                     20:  *
                     21:  * genshellopt copyright (c) 1999-2011 Bruce Korb - all rights reserved
                     22:  *
                     23:  * genshellopt is free software: you can redistribute it and/or modify it
                     24:  * under the terms of the GNU General Public License as published by the
                     25:  * Free Software Foundation, either version 3 of the License, or
                     26:  * (at your option) any later version.
                     27:  * 
                     28:  * genshellopt is distributed in the hope that it will be useful, but
                     29:  * WITHOUT ANY WARRANTY; without even the implied warranty of
                     30:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
                     31:  * See the GNU General Public License for more details.
                     32:  * 
                     33:  * You should have received a copy of the GNU General Public License along
                     34:  * with this program.  If not, see <http://www.gnu.org/licenses/>.
                     35: 
                     36:  */
                     37: /*
                     38:  *  This file contains the programmatic interface to the Automated
                     39:  *  Options generated for the genshellopt program.
                     40:  *  These macros are documented in the AutoGen info file in the
                     41:  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
                     42:  */
                     43: #ifndef AUTOOPTS_GENSHELL_H_GUARD
                     44: #define AUTOOPTS_GENSHELL_H_GUARD 1
                     45: #include <autoopts/options.h>
                     46: 
                     47: /*
                     48:  *  Ensure that the library used for compiling this generated header is at
                     49:  *  least as new as the version current when the header template was released
                     50:  *  (not counting patch version increments).  Also ensure that the oldest
                     51:  *  tolerable version is at least as old as what was current when the header
                     52:  *  template was released.
                     53:  */
                     54: #define AO_TEMPLATE_VERSION 143360
                     55: #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
                     56:  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
                     57: # error option template version mismatches autoopts/options.h header
                     58:   Choke Me.
                     59: #endif
                     60: 
                     61: /*
                     62:  *  Enumeration of each option:
                     63:  */
                     64: typedef enum {
                     65:     INDEX_GENSHELL_OPT_SCRIPT      =  0,
                     66:     INDEX_GENSHELL_OPT_SHELL       =  1,
                     67:     INDEX_GENSHELL_OPT_VERSION     =  2,
                     68:     INDEX_GENSHELL_OPT_HELP        =  3,
                     69:     INDEX_GENSHELL_OPT_MORE_HELP   =  4
                     70: } teGenshell_OptIndex;
                     71: 
                     72: #define GENSHELL_OPTION_CT    5
                     73: #define GENSHELLOPT_VERSION       "1"
                     74: #define GENSHELLOPT_FULL_VERSION  "genshellopt 1"
                     75: 
                     76: /*
                     77:  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
                     78:  *  option name (as in the teGenshell_OptIndex enumeration above).
                     79:  *  e.g. HAVE_GENSHELL_OPT(SCRIPT)
                     80:  */
                     81: #define GENSHELL_DESC(n) (genshelloptOptions.pOptDesc[INDEX_GENSHELL_OPT_## n])
                     82: #define     HAVE_GENSHELL_OPT(n) (! UNUSED_OPT(& GENSHELL_DESC(n)))
                     83: #define      GENSHELL_OPT_ARG(n) (GENSHELL_DESC(n).optArg.argString)
                     84: #define    STATE_GENSHELL_OPT(n) (GENSHELL_DESC(n).fOptState & OPTST_SET_MASK)
                     85: #define    COUNT_GENSHELL_OPT(n) (GENSHELL_DESC(n).optOccCt)
                     86: #define    ISSEL_GENSHELL_OPT(n) (SELECTED_OPT(&GENSHELL_DESC(n)))
                     87: #define ISUNUSED_GENSHELL_OPT(n) (UNUSED_OPT(& GENSHELL_DESC(n)))
                     88: #define  ENABLED_GENSHELL_OPT(n) (! DISABLED_OPT(& GENSHELL_DESC(n)))
                     89: #define  STACKCT_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->useCt)
                     90: #define STACKLST_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->apzArgs)
                     91: #define    CLEAR_GENSHELL_OPT(n) STMTS( \
                     92:                 GENSHELL_DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
                     93:                 if ((GENSHELL_DESC(n).fOptState & OPTST_INITENABLED) == 0) \
                     94:                     GENSHELL_DESC(n).fOptState |= OPTST_DISABLED; \
                     95:                 GENSHELL_DESC(n).optCookie = NULL )
                     96: 
                     97: /* * * * * *
                     98:  *
                     99:  *  Enumeration of genshellopt exit codes
                    100:  */
                    101: typedef enum {
                    102:     GENSHELLOPT_EXIT_SUCCESS = 0,
                    103:     GENSHELLOPT_EXIT_FAILURE = 1
                    104: } genshellopt_exit_code_t;
                    105: /* * * * * *
                    106:  *
                    107:  *  Interface defines for specific options.
                    108:  */
                    109: #define VALUE_GENSHELL_OPT_SCRIPT 'o'
                    110: #define VALUE_GENSHELL_OPT_SHELL 's'
                    111: #define VALUE_GENSHELL_OPT_HELP '?'
                    112: #define VALUE_GENSHELL_OPT_MORE_HELP '!'
                    113: #define VALUE_GENSHELL_OPT_VERSION 'v'
                    114: /*
                    115:  *  Interface defines not associated with particular options
                    116:  */
                    117: #define ERRSKIP_GENSHELL_OPTERR  STMTS(genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP)
                    118: #define ERRSTOP_GENSHELL_OPTERR  STMTS(genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP)
                    119: #define RESTART_GENSHELL_OPT(n)  STMTS( \
                    120:                 genshelloptOptions.curOptIdx = (n); \
                    121:                 genshelloptOptions.pzCurOpt  = NULL )
                    122: #define START_GENSHELL_OPT       RESTART_GENSHELL_OPT(1)
                    123: #define GENSHELL_USAGE(c)        (*genshelloptOptions.pUsageProc)(&genshelloptOptions, c)
                    124: /* extracted from opthead.tlib near line 451 */
                    125: 
                    126: #ifdef  __cplusplus
                    127: extern "C" {
                    128: #endif
                    129: 
                    130: /* * * * * *
                    131:  *
                    132:  *  Declare the genshellopt option descriptor.
                    133:  */
                    134: extern tOptions genshelloptOptions;
                    135: 
                    136: #if defined(ENABLE_NLS)
                    137: # ifndef _
                    138: #   include <stdio.h>
                    139:     static inline char* aoGetsText(char const* pz) {
                    140:         if (pz == NULL) return NULL;
                    141:         return (char*)gettext(pz);
                    142:     }
                    143: #   define _(s)  aoGetsText(s)
                    144: # endif /* _() */
                    145: 
                    146: # define OPT_NO_XLAT_CFG_NAMES  STMTS(genshelloptOptions.fOptSet |= \
                    147:                                     OPTPROC_NXLAT_OPT_CFG;)
                    148: # define OPT_NO_XLAT_OPT_NAMES  STMTS(genshelloptOptions.fOptSet |= \
                    149:                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
                    150: 
                    151: # define OPT_XLAT_CFG_NAMES     STMTS(genshelloptOptions.fOptSet &= \
                    152:                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
                    153: # define OPT_XLAT_OPT_NAMES     STMTS(genshelloptOptions.fOptSet &= \
                    154:                                   ~OPTPROC_NXLAT_OPT;)
                    155: 
                    156: #else   /* ENABLE_NLS */
                    157: # define OPT_NO_XLAT_CFG_NAMES
                    158: # define OPT_NO_XLAT_OPT_NAMES
                    159: 
                    160: # define OPT_XLAT_CFG_NAMES
                    161: # define OPT_XLAT_OPT_NAMES
                    162: 
                    163: # ifndef _
                    164: #   define _(_s)  _s
                    165: # endif
                    166: #endif  /* ENABLE_NLS */
                    167: 
                    168: #ifdef  __cplusplus
                    169: }
                    170: #endif
                    171: #endif /* AUTOOPTS_GENSHELL_H_GUARD */
                    172: /* genshell.h ends here */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>