]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ntp/ntpdc/ntpdc-opts.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ntp / ntpdc / ntpdc-opts.h
1 /*  
2  *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.h)
3  *  
4  *  It has been AutoGen-ed  Tuesday December  8, 2009 at 08:14:00 AM EST
5  *  From the definitions    ntpdc-opts.def
6  *  and the template file   options
7  *
8  * Generated from AutoOpts 29:0:4 templates.
9  */
10
11 /*
12  *  This file was produced by an AutoOpts template.  AutoOpts is a
13  *  copyrighted work.  This header file is not encumbered by AutoOpts
14  *  licensing, but is provided under the licensing terms chosen by the
15  *  ntpdc author or copyright holder.  AutoOpts is licensed under
16  *  the terms of the LGPL.  The redistributable library (``libopts'') is
17  *  licensed under the terms of either the LGPL or, at the users discretion,
18  *  the BSD license.  See the AutoOpts and/or libopts sources for details.
19  *
20  * This source file is copyrighted and licensed under the following terms:
21  *
22  * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved
23  *
24  * see html/copyright.html
25  */
26 /*
27  *  This file contains the programmatic interface to the Automated
28  *  Options generated for the ntpdc program.
29  *  These macros are documented in the AutoGen info file in the
30  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
31  */
32 #ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD
33 #define AUTOOPTS_NTPDC_OPTS_H_GUARD
34 #include "config.h"
35 #include <autoopts/options.h>
36
37 /*
38  *  Ensure that the library used for compiling this generated header is at
39  *  least as new as the version current when the header template was released
40  *  (not counting patch version increments).  Also ensure that the oldest
41  *  tolerable version is at least as old as what was current when the header
42  *  template was released.
43  */
44 #define AO_TEMPLATE_VERSION 118784
45 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
46  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
47 # error option template version mismatches autoopts/options.h header
48   Choke Me.
49 #endif
50
51 /*
52  *  Enumeration of each option:
53  */
54 typedef enum {
55         INDEX_OPT_IPV4             =  0,
56         INDEX_OPT_IPV6             =  1,
57         INDEX_OPT_COMMAND          =  2,
58         INDEX_OPT_LISTPEERS        =  3,
59         INDEX_OPT_PEERS            =  4,
60         INDEX_OPT_SHOWPEERS        =  5,
61         INDEX_OPT_INTERACTIVE      =  6,
62         INDEX_OPT_DEBUG_LEVEL      =  7,
63         INDEX_OPT_SET_DEBUG_LEVEL  =  8,
64         INDEX_OPT_NUMERIC          =  9,
65         INDEX_OPT_VERSION          = 10,
66         INDEX_OPT_HELP             = 11,
67         INDEX_OPT_MORE_HELP        = 12,
68         INDEX_OPT_SAVE_OPTS        = 13,
69         INDEX_OPT_LOAD_OPTS        = 14
70 } teOptIndex;
71
72 #define OPTION_CT    15
73 #define NTPDC_VERSION       "4.2.4p8"
74 #define NTPDC_FULL_VERSION  "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p8"
75
76 /*
77  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
78  *  option name (as in the teOptIndex enumeration above).
79  *  e.g. HAVE_OPT( IPV4 )
80  */
81 #define         DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n])
82 #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
83 #define      OPT_ARG(n) (DESC(n).optArg.argString)
84 #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
85 #define    COUNT_OPT(n) (DESC(n).optOccCt)
86 #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
87 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
88 #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
89 #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
90 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
91 #define    CLEAR_OPT(n) STMTS( \
92                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
93                 if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
94                     DESC(n).fOptState |= OPTST_DISABLED; \
95                 DESC(n).optCookie = NULL )
96
97 /*
98  *  Make sure there are no #define name conflicts with the option names
99  */
100 #ifndef     NO_OPTION_NAME_WARNINGS
101 # ifdef    IPV4
102 #  warning undefining IPV4 due to option name conflict
103 #  undef   IPV4
104 # endif
105 # ifdef    IPV6
106 #  warning undefining IPV6 due to option name conflict
107 #  undef   IPV6
108 # endif
109 # ifdef    COMMAND
110 #  warning undefining COMMAND due to option name conflict
111 #  undef   COMMAND
112 # endif
113 # ifdef    LISTPEERS
114 #  warning undefining LISTPEERS due to option name conflict
115 #  undef   LISTPEERS
116 # endif
117 # ifdef    PEERS
118 #  warning undefining PEERS due to option name conflict
119 #  undef   PEERS
120 # endif
121 # ifdef    SHOWPEERS
122 #  warning undefining SHOWPEERS due to option name conflict
123 #  undef   SHOWPEERS
124 # endif
125 # ifdef    INTERACTIVE
126 #  warning undefining INTERACTIVE due to option name conflict
127 #  undef   INTERACTIVE
128 # endif
129 # ifdef    DEBUG_LEVEL
130 #  warning undefining DEBUG_LEVEL due to option name conflict
131 #  undef   DEBUG_LEVEL
132 # endif
133 # ifdef    SET_DEBUG_LEVEL
134 #  warning undefining SET_DEBUG_LEVEL due to option name conflict
135 #  undef   SET_DEBUG_LEVEL
136 # endif
137 # ifdef    NUMERIC
138 #  warning undefining NUMERIC due to option name conflict
139 #  undef   NUMERIC
140 # endif
141 #else  /* NO_OPTION_NAME_WARNINGS */
142 # undef IPV4
143 # undef IPV6
144 # undef COMMAND
145 # undef LISTPEERS
146 # undef PEERS
147 # undef SHOWPEERS
148 # undef INTERACTIVE
149 # undef DEBUG_LEVEL
150 # undef SET_DEBUG_LEVEL
151 # undef NUMERIC
152 #endif  /*  NO_OPTION_NAME_WARNINGS */
153
154 /*
155  *  Interface defines for specific options.
156  */
157 #define VALUE_OPT_IPV4           '4'
158 #define WHICH_OPT_IPV4           (DESC(IPV4).optActualValue)
159 #define WHICH_IDX_IPV4           (DESC(IPV4).optActualIndex)
160 #define VALUE_OPT_IPV6           '6'
161 #define VALUE_OPT_COMMAND        'c'
162 #define VALUE_OPT_LISTPEERS      'l'
163 #define VALUE_OPT_PEERS          'p'
164 #define VALUE_OPT_SHOWPEERS      's'
165 #define VALUE_OPT_INTERACTIVE    'i'
166 #ifdef DEBUG
167 #define VALUE_OPT_DEBUG_LEVEL    'd'
168 #endif /* DEBUG */
169 #ifdef DEBUG
170 #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
171 #endif /* DEBUG */
172 #define VALUE_OPT_NUMERIC        'n'
173
174 #define VALUE_OPT_VERSION       'v'
175 #define VALUE_OPT_HELP          '?'
176 #define VALUE_OPT_MORE_HELP     '!'
177 #define VALUE_OPT_SAVE_OPTS     '>'
178 #define VALUE_OPT_LOAD_OPTS     '<'
179 #define SET_OPT_SAVE_OPTS(a)   STMTS( \
180         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
181         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
182         DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
183 /*
184  *  Interface defines not associated with particular options
185  */
186 #define ERRSKIP_OPTERR  STMTS( ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP )
187 #define ERRSTOP_OPTERR  STMTS( ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP )
188 #define RESTART_OPT(n)  STMTS( \
189                 ntpdcOptions.curOptIdx = (n); \
190                 ntpdcOptions.pzCurOpt  = NULL )
191 #define START_OPT       RESTART_OPT(1)
192 #define USAGE(c)        (*ntpdcOptions.pUsageProc)( &ntpdcOptions, c )
193 /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
194
195 /* * * * * *
196  *
197  *  Declare the ntpdc option descriptor.
198  */
199 #ifdef  __cplusplus
200 extern "C" {
201 #endif
202
203 extern tOptions   ntpdcOptions;
204
205 #ifndef _
206 #  if ENABLE_NLS
207 #    include <stdio.h>
208      static inline char* aoGetsText( char const* pz ) {
209          if (pz == NULL) return NULL;
210          return (char*)gettext( pz );
211      }
212 #    define _(s)  aoGetsText(s)
213 #  else  /* ENABLE_NLS */
214 #    define _(s)  s
215 #  endif /* ENABLE_NLS */
216 #endif
217
218 #ifdef  __cplusplus
219 }
220 #endif
221 #endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */
222 /* ntpdc-opts.h ends here */