Sync usage with man page.
[netbsd-mini2440.git] / dist / ntp / libopts / genshell.h
blobd12abc3820f0c3a9cb94ab4cdb3d2a7ac0817e13
1 /* $NetBSD$ */
3 /* -*- buffer-read-only: t -*- vi: set ro:
4 *
5 * DO NOT EDIT THIS FILE (genshell.h)
6 *
7 * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:35 PM PDT
8 * From the definitions genshell.def
9 * and the template file options
11 * Generated from AutoOpts 29:0:4 templates.
15 * This file was produced by an AutoOpts template. AutoOpts is a
16 * copyrighted work. This header file is not encumbered by AutoOpts
17 * licensing, but is provided under the licensing terms chosen by the
18 * genshellopt author or copyright holder. AutoOpts is licensed under
19 * the terms of the LGPL. The redistributable library (``libopts'') is
20 * licensed under the terms of either the LGPL or, at the users discretion,
21 * the BSD license. See the AutoOpts and/or libopts sources for details.
23 * This source file is copyrighted and licensed under the following terms:
25 * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved
27 * genshellopt is free software; you can redistribute it and/or
28 * modify it under the terms of the GNU Lesser General Public
29 * License as published by the Free Software Foundation; either
30 * version 2.1 of the License, or (at your option) any later version.
32 * genshellopt is distributed in the hope that it will be useful,
33 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 * Lesser General Public License for more details.
37 * You should have received a copy of the GNU Lesser General Public
38 * License along with genshellopt. If not, write to:
39 * The Free Software Foundation, Inc.,
40 * 51 Franklin Street, Fifth Floor
41 * Boston, MA 02110-1301, USA.
44 * This file contains the programmatic interface to the Automated
45 * Options generated for the genshellopt program.
46 * These macros are documented in the AutoGen info file in the
47 * "AutoOpts" chapter. Please refer to that doc for usage help.
49 #ifndef AUTOOPTS_GENSHELL_H_GUARD
50 #define AUTOOPTS_GENSHELL_H_GUARD
51 #include <autoopts/options.h>
54 * Ensure that the library used for compiling this generated header is at
55 * least as new as the version current when the header template was released
56 * (not counting patch version increments). Also ensure that the oldest
57 * tolerable version is at least as old as what was current when the header
58 * template was released.
60 #define AO_TEMPLATE_VERSION 118784
61 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
62 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
63 # error option template version mismatches autoopts/options.h header
64 Choke Me.
65 #endif
68 * Enumeration of each option:
70 typedef enum {
71 INDEX_OPT_SCRIPT = 0,
72 INDEX_OPT_SHELL = 1,
73 INDEX_OPT_VERSION = 2,
74 INDEX_OPT_HELP = 3,
75 INDEX_OPT_MORE_HELP = 4
76 } teOptIndex;
78 #define OPTION_CT 5
79 #define GENSHELLOPT_VERSION "1"
80 #define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1"
83 * Interface defines for all options. Replace "n" with the UPPER_CASED
84 * option name (as in the teOptIndex enumeration above).
85 * e.g. HAVE_OPT( SCRIPT )
87 #define DESC(n) (genshelloptOptions.pOptDesc[INDEX_OPT_## n])
88 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
89 #define OPT_ARG(n) (DESC(n).optArg.argString)
90 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
91 #define COUNT_OPT(n) (DESC(n).optOccCt)
92 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
93 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
94 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
95 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
96 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
97 #define CLEAR_OPT(n) STMTS( \
98 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
99 if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
100 DESC(n).fOptState |= OPTST_DISABLED; \
101 DESC(n).optCookie = NULL )
104 * Interface defines for specific options.
106 #define VALUE_OPT_SCRIPT 'o'
107 #define VALUE_OPT_SHELL 's'
109 #define VALUE_OPT_VERSION 'v'
110 #define VALUE_OPT_HELP '?'
111 #define VALUE_OPT_MORE_HELP '!'
113 * Interface defines not associated with particular options
115 #define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP )
116 #define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP )
117 #define RESTART_OPT(n) STMTS( \
118 genshelloptOptions.curOptIdx = (n); \
119 genshelloptOptions.pzCurOpt = NULL )
120 #define START_OPT RESTART_OPT(1)
121 #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c )
122 /* extracted from opthead.tpl near line 360 */
124 /* * * * * *
126 * Declare the genshellopt option descriptor.
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
132 extern tOptions genshelloptOptions;
134 #ifndef _
135 # if ENABLE_NLS
136 # include <stdio.h>
137 static inline char* aoGetsText( char const* pz ) {
138 if (pz == NULL) return NULL;
139 return (char*)gettext( pz );
141 # define _(s) aoGetsText(s)
142 # else /* ENABLE_NLS */
143 # define _(s) s
144 # endif /* ENABLE_NLS */
145 #endif
147 #ifdef __cplusplus
149 #endif
150 #endif /* AUTOOPTS_GENSHELL_H_GUARD */
151 /* genshell.h ends here */