2 * EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
4 * It has been AutoGen-ed June 2, 2016 at 07:36:34 AM by AutoGen 5.18.5
5 * From the definitions ntpdc-opts.def
6 * and the template file options
8 * Generated from AutoOpts 41:0:16 templates.
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 ntpdc 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
18 * The ntpdc program is copyrighted and licensed
19 * under the following terms:
21 * Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.
22 * This is free software. It is licensed for use, modification and
23 * redistribution under the terms of the NTP License, copies of which
25 * <http://ntp.org/license>
26 * <http://opensource.org/licenses/ntp-license.php>
28 * Permission to use, copy, modify, and distribute this software and its
29 * documentation for any purpose with or without fee is hereby granted,
30 * provided that the above copyright notice appears in all copies and that
31 * both the copyright notice and this permission notice appear in
32 * supporting documentation, and that the name The University of Delaware not be used in
33 * advertising or publicity pertaining to distribution of the software
34 * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
35 * representations about the suitability this software for any purpose. It
36 * is provided "as is" without express or implied warranty.
39 * This file contains the programmatic interface to the Automated
40 * Options generated for the ntpdc program.
41 * These macros are documented in the AutoGen info file in the
42 * "AutoOpts" chapter. Please refer to that doc for usage help.
44 #ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD
45 #define AUTOOPTS_NTPDC_OPTS_H_GUARD 1
47 #include <autoopts/options.h>
50 * Ensure that the library used for compiling this generated header is at
51 * least as new as the version current when the header template was released
52 * (not counting patch version increments). Also ensure that the oldest
53 * tolerable version is at least as old as what was current when the header
54 * template was released.
56 #define AO_TEMPLATE_VERSION 167936
57 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
58 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
59 # error option template version mismatches autoopts/options.h header
64 * Enumeration of each option type for ntpdc
69 INDEX_OPT_COMMAND = 2,
70 INDEX_OPT_DEBUG_LEVEL = 3,
71 INDEX_OPT_SET_DEBUG_LEVEL = 4,
72 INDEX_OPT_INTERACTIVE = 5,
73 INDEX_OPT_LISTPEERS = 6,
74 INDEX_OPT_NUMERIC = 7,
76 INDEX_OPT_SHOWPEERS = 9,
77 INDEX_OPT_VERSION = 10,
79 INDEX_OPT_MORE_HELP = 12,
80 INDEX_OPT_SAVE_OPTS = 13,
81 INDEX_OPT_LOAD_OPTS = 14
83 /** count of all options for ntpdc */
86 #define NTPDC_VERSION "4.2.8p8"
87 /** Full ntpdc version text */
88 #define NTPDC_FULL_VERSION "ntpdc 4.2.8p8"
91 * Interface defines for all options. Replace "n" with the UPPER_CASED
92 * option name (as in the teOptIndex enumeration above).
95 #define DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n])
96 /** 'true' if an option has been specified in any way */
97 #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
98 /** The string argument to an option. The argument type must be \"string\". */
99 #define OPT_ARG(n) (DESC(n).optArg.argString)
100 /** Mask the option state revealing how an option was specified.
101 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
102 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
104 #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
105 /** Count of option's occurrances *on the command line*. */
106 #define COUNT_OPT(n) (DESC(n).optOccCt)
107 /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
108 #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
109 /** 'true' if \a HAVE_OPT would yield 'false'. */
110 #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
111 /** 'true' if OPTST_DISABLED bit not set. */
112 #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
113 /** number of stacked option arguments.
114 * Valid only for stacked option arguments. */
115 #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
116 /** stacked argument vector.
117 * Valid only for stacked option arguments. */
118 #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
119 /** Reset an option. */
120 #define CLEAR_OPT(n) STMTS( \
121 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
122 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
123 DESC(n).fOptState |= OPTST_DISABLED; \
124 DESC(n).optCookie = NULL )
125 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
127 * Enumeration of ntpdc exit codes
130 NTPDC_EXIT_SUCCESS = 0,
131 NTPDC_EXIT_FAILURE = 1,
132 NTPDC_EXIT_USAGE_ERROR = 64,
133 NTPDC_EXIT_NO_CONFIG_INPUT = 66,
134 NTPDC_EXIT_LIBOPTS_FAILURE = 70
138 * Make sure there are no #define name conflicts with the option names
140 #ifndef NO_OPTION_NAME_WARNINGS
142 # warning undefining IPV4 due to option name conflict
146 # warning undefining IPV6 due to option name conflict
150 # warning undefining COMMAND due to option name conflict
154 # warning undefining DEBUG_LEVEL due to option name conflict
157 # ifdef SET_DEBUG_LEVEL
158 # warning undefining SET_DEBUG_LEVEL due to option name conflict
159 # undef SET_DEBUG_LEVEL
162 # warning undefining INTERACTIVE due to option name conflict
166 # warning undefining LISTPEERS due to option name conflict
170 # warning undefining NUMERIC due to option name conflict
174 # warning undefining PEERS due to option name conflict
178 # warning undefining SHOWPEERS due to option name conflict
181 #else /* NO_OPTION_NAME_WARNINGS */
186 # undef SET_DEBUG_LEVEL
192 #endif /* NO_OPTION_NAME_WARNINGS */
195 * Interface defines for specific options.
198 #define VALUE_OPT_IPV4 '4'
199 #define VALUE_OPT_IPV6 '6'
200 #define VALUE_OPT_COMMAND 'c'
201 #define VALUE_OPT_DEBUG_LEVEL 'd'
202 #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
204 #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
205 #define VALUE_OPT_INTERACTIVE 'i'
206 #define VALUE_OPT_LISTPEERS 'l'
207 #define VALUE_OPT_NUMERIC 'n'
208 #define VALUE_OPT_PEERS 'p'
209 #define VALUE_OPT_SHOWPEERS 's'
210 /** option flag (value) for help-value option */
211 #define VALUE_OPT_HELP '?'
212 /** option flag (value) for more-help-value option */
213 #define VALUE_OPT_MORE_HELP '!'
214 /** option flag (value) for version-value option */
215 #define VALUE_OPT_VERSION 0x1001
216 /** option flag (value) for save-opts-value option */
217 #define VALUE_OPT_SAVE_OPTS '>'
218 /** option flag (value) for load-opts-value option */
219 #define VALUE_OPT_LOAD_OPTS '<'
220 #define SET_OPT_SAVE_OPTS(a) STMTS( \
221 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
222 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
223 DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
225 * Interface defines not associated with particular options
227 #define ERRSKIP_OPTERR STMTS(ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP)
228 #define ERRSTOP_OPTERR STMTS(ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP)
229 #define RESTART_OPT(n) STMTS( \
230 ntpdcOptions.curOptIdx = (n); \
231 ntpdcOptions.pzCurOpt = NULL )
232 #define START_OPT RESTART_OPT(1)
233 #define USAGE(c) (*ntpdcOptions.pUsageProc)(&ntpdcOptions, c)
242 * Declare the ntpdc option descriptor.
244 extern tOptions ntpdcOptions;
246 #if defined(ENABLE_NLS)
249 # ifndef HAVE_GETTEXT
250 extern char * gettext(char const *);
252 # include <libintl.h>
255 # ifndef ATTRIBUTE_FORMAT_ARG
256 # define ATTRIBUTE_FORMAT_ARG(_a)
259 static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
260 static inline char* aoGetsText(char const* pz) {
261 if (pz == NULL) return NULL;
262 return (char*)gettext(pz);
264 # define _(s) aoGetsText(s)
267 # define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet |= \
268 OPTPROC_NXLAT_OPT_CFG;)
269 # define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet |= \
270 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
272 # define OPT_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet &= \
273 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
274 # define OPT_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet &= \
277 #else /* ENABLE_NLS */
278 # define OPT_NO_XLAT_CFG_NAMES
279 # define OPT_NO_XLAT_OPT_NAMES
281 # define OPT_XLAT_CFG_NAMES
282 # define OPT_XLAT_OPT_NAMES
287 #endif /* ENABLE_NLS */
292 #endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */
294 /* ntpdc-opts.h ends here */