1/*
2 *  EDIT THIS FILE WITH CAUTION  (ntpq-opts.h)
3 *
4 *  It has been AutoGen-ed  December 10, 2009 at 05:03:03 AM by AutoGen 5.10
5 *  From the definitions    ntpq-opts.def
6 *  and the template file   options
7 *
8 * Generated from AutoOpts 33:0:8 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.
19 *
20 * This source file is copyrighted and licensed under the following terms:
21 *
22 * ntpq copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved
23 *
24 * see html/copyright.html
25 */
26/*
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
33#define AUTOOPTS_NTPQ_OPTS_H_GUARD 1
34#include "config.h"
35#include <autoopts/options.h>
36
37/*
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 */
44#define AO_TEMPLATE_VERSION 135168
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
51/*
52 *  Enumeration of each option:
53 */
54typedef enum {
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_OLD_RV           =  8,
64    INDEX_OPT_VERSION          =  9,
65    INDEX_OPT_HELP             = 10,
66    INDEX_OPT_MORE_HELP        = 11,
67    INDEX_OPT_SAVE_OPTS        = 12,
68    INDEX_OPT_LOAD_OPTS        = 13
69} teOptIndex;
70
71#define OPTION_CT    14
72#define NTPQ_VERSION       "4.2.6"
73#define NTPQ_FULL_VERSION  "ntpq - standard NTP query program - Ver. 4.2.6"
74
75/*
76 *  Interface defines for all options.  Replace "n" with the UPPER_CASED
77 *  option name (as in the teOptIndex enumeration above).
78 *  e.g. HAVE_OPT( IPV4 )
79 */
80#define         DESC(n) (ntpqOptions.pOptDesc[INDEX_OPT_## n])
81#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
82#define      OPT_ARG(n) (DESC(n).optArg.argString)
83#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
84#define    COUNT_OPT(n) (DESC(n).optOccCt)
85#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
86#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
87#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
88#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
89#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
90#define    CLEAR_OPT(n) STMTS( \
91                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
92                if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
93                    DESC(n).fOptState |= OPTST_DISABLED; \
94                DESC(n).optCookie = NULL )
95
96/*
97 *  Make sure there are no #define name conflicts with the option names
98 */
99#ifndef     NO_OPTION_NAME_WARNINGS
100# ifdef    IPV4
101#  warning undefining IPV4 due to option name conflict
102#  undef   IPV4
103# endif
104# ifdef    IPV6
105#  warning undefining IPV6 due to option name conflict
106#  undef   IPV6
107# endif
108# ifdef    COMMAND
109#  warning undefining COMMAND due to option name conflict
110#  undef   COMMAND
111# endif
112# ifdef    DEBUG_LEVEL
113#  warning undefining DEBUG_LEVEL due to option name conflict
114#  undef   DEBUG_LEVEL
115# endif
116# ifdef    SET_DEBUG_LEVEL
117#  warning undefining SET_DEBUG_LEVEL due to option name conflict
118#  undef   SET_DEBUG_LEVEL
119# endif
120# ifdef    PEERS
121#  warning undefining PEERS due to option name conflict
122#  undef   PEERS
123# endif
124# ifdef    INTERACTIVE
125#  warning undefining INTERACTIVE due to option name conflict
126#  undef   INTERACTIVE
127# endif
128# ifdef    NUMERIC
129#  warning undefining NUMERIC due to option name conflict
130#  undef   NUMERIC
131# endif
132# ifdef    OLD_RV
133#  warning undefining OLD_RV due to option name conflict
134#  undef   OLD_RV
135# endif
136#else  /* NO_OPTION_NAME_WARNINGS */
137# undef IPV4
138# undef IPV6
139# undef COMMAND
140# undef DEBUG_LEVEL
141# undef SET_DEBUG_LEVEL
142# undef PEERS
143# undef INTERACTIVE
144# undef NUMERIC
145# undef OLD_RV
146#endif  /*  NO_OPTION_NAME_WARNINGS */
147
148/* * * * * *
149 *
150 *  Interface defines for specific options.
151 */
152#define VALUE_OPT_IPV4           '4'
153#define VALUE_OPT_IPV6           '6'
154#define VALUE_OPT_COMMAND        'c'
155#define VALUE_OPT_DEBUG_LEVEL    'd'
156#define VALUE_OPT_SET_DEBUG_LEVEL 'D'
157#define VALUE_OPT_PEERS          'p'
158#define VALUE_OPT_INTERACTIVE    'i'
159#define VALUE_OPT_NUMERIC        'n'
160#define VALUE_OPT_OLD_RV         8
161#define VALUE_OPT_HELP          '?'
162#define VALUE_OPT_MORE_HELP     '!'
163#define VALUE_OPT_VERSION       INDEX_OPT_VERSION
164#define VALUE_OPT_SAVE_OPTS     '>'
165#define VALUE_OPT_LOAD_OPTS     '<'
166#define SET_OPT_SAVE_OPTS(a)   STMTS( \
167        DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
168        DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
169        DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
170/*
171 *  Interface defines not associated with particular options
172 */
173#define ERRSKIP_OPTERR  STMTS( ntpqOptions.fOptSet &= ~OPTPROC_ERRSTOP )
174#define ERRSTOP_OPTERR  STMTS( ntpqOptions.fOptSet |= OPTPROC_ERRSTOP )
175#define RESTART_OPT(n)  STMTS( \
176                ntpqOptions.curOptIdx = (n); \
177                ntpqOptions.pzCurOpt  = NULL )
178#define START_OPT       RESTART_OPT(1)
179#define USAGE(c)        (*ntpqOptions.pUsageProc)( &ntpqOptions, c )
180/* extracted from /usr/local/gnu/share/autogen/opthead.tpl near line 409 */
181
182/* * * * * *
183 *
184 *  Declare the ntpq option descriptor.
185 */
186#ifdef  __cplusplus
187extern "C" {
188#endif
189
190extern tOptions   ntpqOptions;
191
192#if defined(ENABLE_NLS)
193# ifndef _
194#   include <stdio.h>
195    static inline char* aoGetsText( char const* pz ) {
196        if (pz == NULL) return NULL;
197        return (char*)gettext( pz );
198    }
199#   define _(s)  aoGetsText(s)
200# endif /* _() */
201
202# define OPT_NO_XLAT_CFG_NAMES  STMTS(ntpqOptions.fOptSet |= \
203                                    OPTPROC_NXLAT_OPT_CFG;)
204# define OPT_NO_XLAT_OPT_NAMES  STMTS(ntpqOptions.fOptSet |= \
205                                    OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
206
207# define OPT_XLAT_CFG_NAMES     STMTS(ntpqOptions.fOptSet &= \
208                                  ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
209# define OPT_XLAT_OPT_NAMES     STMTS(ntpqOptions.fOptSet &= \
210                                  ~OPTPROC_NXLAT_OPT;)
211
212#else   /* ENABLE_NLS */
213# define OPT_NO_XLAT_CFG_NAMES
214# define OPT_NO_XLAT_OPT_NAMES
215
216# define OPT_XLAT_CFG_NAMES
217# define OPT_XLAT_OPT_NAMES
218
219# ifndef _
220#   define _(_s)  _s
221# endif
222#endif  /* ENABLE_NLS */
223
224#ifdef  __cplusplus
225}
226#endif
227#endif /* AUTOOPTS_NTPQ_OPTS_H_GUARD */
228/* ntpq-opts.h ends here */
229