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