Deleted Added
full compact
ntpq-opts.h (302408) ntpq-opts.h (181834)
1/*
1/*
2 * EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
2 * EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
3 *
4 * It has been AutoGen-ed June 2, 2016 at 07:37:04 AM by AutoGen 5.18.5
3 *
4 * It has been AutoGen-ed Sunday August 17, 2008 at 05:26:55 AM EDT
5 * From the definitions ntpq-opts.def
6 * and the template file options
7 *
5 * From the definitions ntpq-opts.def
6 * and the template file options
7 *
8 * Generated from AutoOpts 41:0:16 templates.
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 * ntpq 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.
9 *
19 *
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.
20 * This source file is copyrighted and licensed under the following terms:
17 *
21 *
18 * The ntpq program is copyrighted and licensed
19 * under the following terms:
22 * ntpq copyright 1970-2008 David L. Mills and/or others - all rights reserved
20 *
23 *
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
24 * can be seen at:
25 * <http://ntp.org/license>
26 * <http://opensource.org/licenses/ntp-license.php>
27 *
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.
24 * see html/copyright.html
37 */
25 */
38/**
26/*
39 * This file contains the programmatic interface to the Automated
40 * Options generated for the ntpq program.
41 * These macros are documented in the AutoGen info file in the
42 * "AutoOpts" chapter. Please refer to that doc for usage help.
43 */
44#ifndef AUTOOPTS_NTPQ_OPTS_H_GUARD
27 * This file contains the programmatic interface to the Automated
28 * Options generated for the ntpq 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_NTPQ_OPTS_H_GUARD
45#define AUTOOPTS_NTPQ_OPTS_H_GUARD 1
33#define AUTOOPTS_NTPQ_OPTS_H_GUARD
46#include "config.h"
47#include <autoopts/options.h>
48
34#include "config.h"
35#include <autoopts/options.h>
36
49/**
37/*
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.
55 */
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 */
56#define AO_TEMPLATE_VERSION 167936
44#define AO_TEMPLATE_VERSION 118784
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
60 Choke Me.
61#endif
62
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
63/**
64 * Enumeration of each option type for ntpq
51/*
52 * Enumeration of each option:
65 */
66typedef enum {
53 */
54typedef enum {
67 INDEX_OPT_IPV4 = 0,
68 INDEX_OPT_IPV6 = 1,
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_NUMERIC = 6,
74 INDEX_OPT_OLD_RV = 7,
75 INDEX_OPT_PEERS = 8,
76 INDEX_OPT_REFID = 9,
77 INDEX_OPT_WIDE = 10,
78 INDEX_OPT_VERSION = 11,
79 INDEX_OPT_HELP = 12,
80 INDEX_OPT_MORE_HELP = 13,
81 INDEX_OPT_SAVE_OPTS = 14,
82 INDEX_OPT_LOAD_OPTS = 15
55 INDEX_OPT_IPV4 = 0,
56 INDEX_OPT_IPV6 = 1,
57 INDEX_OPT_COMMAND = 2,
58 INDEX_OPT_DEBUG_LEVEL = 3,
59 INDEX_OPT_SET_DEBUG_LEVEL = 4,
60 INDEX_OPT_PEERS = 5,
61 INDEX_OPT_INTERACTIVE = 6,
62 INDEX_OPT_NUMERIC = 7,
63 INDEX_OPT_VERSION = 8,
64 INDEX_OPT_HELP = 9,
65 INDEX_OPT_MORE_HELP = 10,
66 INDEX_OPT_SAVE_OPTS = 11,
67 INDEX_OPT_LOAD_OPTS = 12
83} teOptIndex;
68} teOptIndex;
84/** count of all options for ntpq */
85#define OPTION_CT 16
86/** ntpq version */
87#define NTPQ_VERSION "4.2.8p8"
88/** Full ntpq version text */
89#define NTPQ_FULL_VERSION "ntpq 4.2.8p8"
90
69
91/**
70#define OPTION_CT 13
71#define NTPQ_VERSION "4.2.4p5"
72#define NTPQ_FULL_VERSION "ntpq - standard NTP query program - Ver. 4.2.4p5"
73
74/*
92 * Interface defines for all options. Replace "n" with the UPPER_CASED
93 * option name (as in the teOptIndex enumeration above).
75 * Interface defines for all options. Replace "n" with the UPPER_CASED
76 * option name (as in the teOptIndex enumeration above).
94 * e.g. HAVE_OPT(IPV4)
77 * e.g. HAVE_OPT( IPV4 )
95 */
96#define DESC(n) (ntpqOptions.pOptDesc[INDEX_OPT_## n])
78 */
79#define DESC(n) (ntpqOptions.pOptDesc[INDEX_OPT_## n])
97/** 'true' if an option has been specified in any way */
98#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
80#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
99/** The string argument to an option. The argument type must be \"string\". */
100#define OPT_ARG(n) (DESC(n).optArg.argString)
81#define OPT_ARG(n) (DESC(n).optArg.argString)
101/** Mask the option state revealing how an option was specified.
102 * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
103 * \a OPTST_DEFINED, \a OPTST_RESET or zero.
104 */
105#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
82#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
106/** Count of option's occurrances *on the command line*. */
107#define COUNT_OPT(n) (DESC(n).optOccCt)
83#define COUNT_OPT(n) (DESC(n).optOccCt)
108/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
109#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
84#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
110/** 'true' if \a HAVE_OPT would yield 'false'. */
111#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
85#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
112/** 'true' if OPTST_DISABLED bit not set. */
113#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
86#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
114/** number of stacked option arguments.
115 * Valid only for stacked option arguments. */
116#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
87#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
117/** stacked argument vector.
118 * Valid only for stacked option arguments. */
119#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
88#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
120/** Reset an option. */
121#define CLEAR_OPT(n) STMTS( \
122 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
89#define CLEAR_OPT(n) STMTS( \
90 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
123 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
91 if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
124 DESC(n).fOptState |= OPTST_DISABLED; \
125 DESC(n).optCookie = NULL )
92 DESC(n).fOptState |= OPTST_DISABLED; \
93 DESC(n).optCookie = NULL )
126/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
127/**
128 * Enumeration of ntpq exit codes
129 */
130typedef enum {
131 NTPQ_EXIT_SUCCESS = 0,
132 NTPQ_EXIT_FAILURE = 1,
133 NTPQ_EXIT_USAGE_ERROR = 64,
134 NTPQ_EXIT_NO_CONFIG_INPUT = 66,
135 NTPQ_EXIT_LIBOPTS_FAILURE = 70
136} ntpq_exit_code_t;
137/** @} */
138/**
94
95/*
139 * Make sure there are no #define name conflicts with the option names
140 */
141#ifndef NO_OPTION_NAME_WARNINGS
142# ifdef IPV4
143# warning undefining IPV4 due to option name conflict
144# undef IPV4
145# endif
146# ifdef IPV6

--- 7 unchanged lines hidden (view full) ---

154# ifdef DEBUG_LEVEL
155# warning undefining DEBUG_LEVEL due to option name conflict
156# undef DEBUG_LEVEL
157# endif
158# ifdef SET_DEBUG_LEVEL
159# warning undefining SET_DEBUG_LEVEL due to option name conflict
160# undef SET_DEBUG_LEVEL
161# endif
96 * Make sure there are no #define name conflicts with the option names
97 */
98#ifndef NO_OPTION_NAME_WARNINGS
99# ifdef IPV4
100# warning undefining IPV4 due to option name conflict
101# undef IPV4
102# endif
103# ifdef IPV6

--- 7 unchanged lines hidden (view full) ---

111# ifdef DEBUG_LEVEL
112# warning undefining DEBUG_LEVEL due to option name conflict
113# undef DEBUG_LEVEL
114# endif
115# ifdef SET_DEBUG_LEVEL
116# warning undefining SET_DEBUG_LEVEL due to option name conflict
117# undef SET_DEBUG_LEVEL
118# endif
119# ifdef PEERS
120# warning undefining PEERS due to option name conflict
121# undef PEERS
122# endif
162# ifdef INTERACTIVE
163# warning undefining INTERACTIVE due to option name conflict
164# undef INTERACTIVE
165# endif
166# ifdef NUMERIC
167# warning undefining NUMERIC due to option name conflict
168# undef NUMERIC
169# endif
123# ifdef INTERACTIVE
124# warning undefining INTERACTIVE due to option name conflict
125# undef INTERACTIVE
126# endif
127# ifdef NUMERIC
128# warning undefining NUMERIC due to option name conflict
129# undef NUMERIC
130# endif
170# ifdef OLD_RV
171# warning undefining OLD_RV due to option name conflict
172# undef OLD_RV
173# endif
174# ifdef PEERS
175# warning undefining PEERS due to option name conflict
176# undef PEERS
177# endif
178# ifdef REFID
179# warning undefining REFID due to option name conflict
180# undef REFID
181# endif
182# ifdef WIDE
183# warning undefining WIDE due to option name conflict
184# undef WIDE
185# endif
186#else /* NO_OPTION_NAME_WARNINGS */
187# undef IPV4
188# undef IPV6
189# undef COMMAND
190# undef DEBUG_LEVEL
191# undef SET_DEBUG_LEVEL
131#else /* NO_OPTION_NAME_WARNINGS */
132# undef IPV4
133# undef IPV6
134# undef COMMAND
135# undef DEBUG_LEVEL
136# undef SET_DEBUG_LEVEL
137# undef PEERS
192# undef INTERACTIVE
193# undef NUMERIC
138# undef INTERACTIVE
139# undef NUMERIC
194# undef OLD_RV
195# undef PEERS
196# undef REFID
197# undef WIDE
198#endif /* NO_OPTION_NAME_WARNINGS */
199
140#endif /* NO_OPTION_NAME_WARNINGS */
141
200/**
142/*
201 * Interface defines for specific options.
143 * Interface defines for specific options.
202 * @{
203 */
204#define VALUE_OPT_IPV4 '4'
144 */
145#define VALUE_OPT_IPV4 '4'
146#define WHICH_OPT_IPV4 (DESC(IPV4).optActualValue)
147#define WHICH_IDX_IPV4 (DESC(IPV4).optActualIndex)
205#define VALUE_OPT_IPV6 '6'
206#define VALUE_OPT_COMMAND 'c'
148#define VALUE_OPT_IPV6 '6'
149#define VALUE_OPT_COMMAND 'c'
150#ifdef DEBUG
207#define VALUE_OPT_DEBUG_LEVEL 'd'
151#define VALUE_OPT_DEBUG_LEVEL 'd'
152#endif /* DEBUG */
153#ifdef DEBUG
208#define VALUE_OPT_SET_DEBUG_LEVEL 'D'
154#define VALUE_OPT_SET_DEBUG_LEVEL 'D'
209
210#define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
155#endif /* DEBUG */
156#define VALUE_OPT_PEERS 'p'
211#define VALUE_OPT_INTERACTIVE 'i'
212#define VALUE_OPT_NUMERIC 'n'
157#define VALUE_OPT_INTERACTIVE 'i'
158#define VALUE_OPT_NUMERIC 'n'
213#define VALUE_OPT_OLD_RV 0x1001
214#define VALUE_OPT_PEERS 'p'
215#define VALUE_OPT_REFID 'r'
216
159
217typedef enum {
218 REFID_HASH, REFID_IPV4
219} te_Refid;
220#define OPT_REFID_VAL2STR(_v) optionKeywordName(&DESC(REFID), (_v))
221#define OPT_VALUE_REFID (DESC(REFID).optArg.argEnum)
222#define VALUE_OPT_WIDE 'w'
223/** option flag (value) for help-value option */
160#define VALUE_OPT_VERSION 'v'
224#define VALUE_OPT_HELP '?'
161#define VALUE_OPT_HELP '?'
225/** option flag (value) for more-help-value option */
226#define VALUE_OPT_MORE_HELP '!'
162#define VALUE_OPT_MORE_HELP '!'
227/** option flag (value) for version-value option */
228#define VALUE_OPT_VERSION 0x1002
229/** option flag (value) for save-opts-value option */
230#define VALUE_OPT_SAVE_OPTS '>'
163#define VALUE_OPT_SAVE_OPTS '>'
231/** option flag (value) for load-opts-value option */
232#define VALUE_OPT_LOAD_OPTS '<'
233#define SET_OPT_SAVE_OPTS(a) STMTS( \
234 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
235 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
164#define VALUE_OPT_LOAD_OPTS '<'
165#define SET_OPT_SAVE_OPTS(a) STMTS( \
166 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
167 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
236 DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
168 DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
237/*
238 * Interface defines not associated with particular options
239 */
169/*
170 * Interface defines not associated with particular options
171 */
240#define ERRSKIP_OPTERR STMTS(ntpqOptions.fOptSet &= ~OPTPROC_ERRSTOP)
241#define ERRSTOP_OPTERR STMTS(ntpqOptions.fOptSet |= OPTPROC_ERRSTOP)
172#define ERRSKIP_OPTERR STMTS( ntpqOptions.fOptSet &= ~OPTPROC_ERRSTOP )
173#define ERRSTOP_OPTERR STMTS( ntpqOptions.fOptSet |= OPTPROC_ERRSTOP )
242#define RESTART_OPT(n) STMTS( \
243 ntpqOptions.curOptIdx = (n); \
244 ntpqOptions.pzCurOpt = NULL )
245#define START_OPT RESTART_OPT(1)
174#define RESTART_OPT(n) STMTS( \
175 ntpqOptions.curOptIdx = (n); \
176 ntpqOptions.pzCurOpt = NULL )
177#define START_OPT RESTART_OPT(1)
246#define USAGE(c) (*ntpqOptions.pUsageProc)(&ntpqOptions, c)
178#define USAGE(c) (*ntpqOptions.pUsageProc)( &ntpqOptions, c )
179/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 360 */
247
180
248#ifdef __cplusplus
249extern "C" {
250#endif
251
252
253/* * * * * *
254 *
255 * Declare the ntpq option descriptor.
256 */
181/* * * * * *
182 *
183 * Declare the ntpq option descriptor.
184 */
257extern tOptions ntpqOptions;
185#ifdef __cplusplus
186extern "C" {
187#endif
258
188
259#if defined(ENABLE_NLS)
260# ifndef _
261# include <stdio.h>
262# ifndef HAVE_GETTEXT
263 extern char * gettext(char const *);
264# else
265# include <libintl.h>
266# endif
189extern tOptions ntpqOptions;
267
190
268# ifndef ATTRIBUTE_FORMAT_ARG
269# define ATTRIBUTE_FORMAT_ARG(_a)
270# endif
191#ifndef _
192# if ENABLE_NLS
193# include <stdio.h>
194 static inline char* aoGetsText( char const* pz ) {
195 if (pz == NULL) return NULL;
196 return (char*)gettext( pz );
197 }
198# define _(s) aoGetsText(s)
199# else /* ENABLE_NLS */
200# define _(s) s
201# endif /* ENABLE_NLS */
202#endif
271
203
272static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
273static inline char* aoGetsText(char const* pz) {
274 if (pz == NULL) return NULL;
275 return (char*)gettext(pz);
276}
277# define _(s) aoGetsText(s)
278# endif /* _() */
279
280# define OPT_NO_XLAT_CFG_NAMES STMTS(ntpqOptions.fOptSet |= \
281 OPTPROC_NXLAT_OPT_CFG;)
282# define OPT_NO_XLAT_OPT_NAMES STMTS(ntpqOptions.fOptSet |= \
283 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
284
285# define OPT_XLAT_CFG_NAMES STMTS(ntpqOptions.fOptSet &= \
286 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
287# define OPT_XLAT_OPT_NAMES STMTS(ntpqOptions.fOptSet &= \
288 ~OPTPROC_NXLAT_OPT;)
289
290#else /* ENABLE_NLS */
291# define OPT_NO_XLAT_CFG_NAMES
292# define OPT_NO_XLAT_OPT_NAMES
293
294# define OPT_XLAT_CFG_NAMES
295# define OPT_XLAT_OPT_NAMES
296
297# ifndef _
298# define _(_s) _s
299# endif
300#endif /* ENABLE_NLS */
301
302#ifdef __cplusplus
303}
304#endif
305#endif /* AUTOOPTS_NTPQ_OPTS_H_GUARD */
204#ifdef __cplusplus
205}
206#endif
207#endif /* AUTOOPTS_NTPQ_OPTS_H_GUARD */
306
307/* ntpq-opts.h ends here */
208/* ntpq-opts.h ends here */