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