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