1181834Sroberto/*
2181834Sroberto *  EDIT THIS FILE WITH CAUTION  (ntpdc-opts.h)
3181834Sroberto *
4200576Sroberto *  It has been AutoGen-ed  Tuesday December  8, 2009 at 08:14:00 AM EST
5181834Sroberto *  From the definitions    ntpdc-opts.def
6181834Sroberto *  and the template file   options
7181834Sroberto *
8181834Sroberto * Generated from AutoOpts 29:0:4 templates.
9181834Sroberto */
10181834Sroberto
11181834Sroberto/*
12181834Sroberto *  This file was produced by an AutoOpts template.  AutoOpts is a
13181834Sroberto *  copyrighted work.  This header file is not encumbered by AutoOpts
14181834Sroberto *  licensing, but is provided under the licensing terms chosen by the
15181834Sroberto *  ntpdc author or copyright holder.  AutoOpts is licensed under
16181834Sroberto *  the terms of the LGPL.  The redistributable library (``libopts'') is
17181834Sroberto *  licensed under the terms of either the LGPL or, at the users discretion,
18181834Sroberto *  the BSD license.  See the AutoOpts and/or libopts sources for details.
19181834Sroberto *
20181834Sroberto * This source file is copyrighted and licensed under the following terms:
21181834Sroberto *
22200576Sroberto * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved
23181834Sroberto *
24181834Sroberto * see html/copyright.html
25181834Sroberto */
26181834Sroberto/*
27181834Sroberto *  This file contains the programmatic interface to the Automated
28181834Sroberto *  Options generated for the ntpdc program.
29181834Sroberto *  These macros are documented in the AutoGen info file in the
30181834Sroberto *  "AutoOpts" chapter.  Please refer to that doc for usage help.
31181834Sroberto */
32181834Sroberto#ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD
33181834Sroberto#define AUTOOPTS_NTPDC_OPTS_H_GUARD
34181834Sroberto#include "config.h"
35181834Sroberto#include <autoopts/options.h>
36181834Sroberto
37181834Sroberto/*
38181834Sroberto *  Ensure that the library used for compiling this generated header is at
39181834Sroberto *  least as new as the version current when the header template was released
40181834Sroberto *  (not counting patch version increments).  Also ensure that the oldest
41181834Sroberto *  tolerable version is at least as old as what was current when the header
42181834Sroberto *  template was released.
43181834Sroberto */
44181834Sroberto#define AO_TEMPLATE_VERSION 118784
45181834Sroberto#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
46181834Sroberto || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
47181834Sroberto# error option template version mismatches autoopts/options.h header
48181834Sroberto  Choke Me.
49181834Sroberto#endif
50181834Sroberto
51181834Sroberto/*
52181834Sroberto *  Enumeration of each option:
53181834Sroberto */
54181834Srobertotypedef enum {
55181834Sroberto        INDEX_OPT_IPV4             =  0,
56181834Sroberto        INDEX_OPT_IPV6             =  1,
57181834Sroberto        INDEX_OPT_COMMAND          =  2,
58181834Sroberto        INDEX_OPT_LISTPEERS        =  3,
59181834Sroberto        INDEX_OPT_PEERS            =  4,
60181834Sroberto        INDEX_OPT_SHOWPEERS        =  5,
61181834Sroberto        INDEX_OPT_INTERACTIVE      =  6,
62181834Sroberto        INDEX_OPT_DEBUG_LEVEL      =  7,
63181834Sroberto        INDEX_OPT_SET_DEBUG_LEVEL  =  8,
64181834Sroberto        INDEX_OPT_NUMERIC          =  9,
65181834Sroberto        INDEX_OPT_VERSION          = 10,
66181834Sroberto        INDEX_OPT_HELP             = 11,
67181834Sroberto        INDEX_OPT_MORE_HELP        = 12,
68181834Sroberto        INDEX_OPT_SAVE_OPTS        = 13,
69181834Sroberto        INDEX_OPT_LOAD_OPTS        = 14
70181834Sroberto} teOptIndex;
71181834Sroberto
72181834Sroberto#define OPTION_CT    15
73200576Sroberto#define NTPDC_VERSION       "4.2.4p8"
74200576Sroberto#define NTPDC_FULL_VERSION  "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p8"
75181834Sroberto
76181834Sroberto/*
77181834Sroberto *  Interface defines for all options.  Replace "n" with the UPPER_CASED
78181834Sroberto *  option name (as in the teOptIndex enumeration above).
79181834Sroberto *  e.g. HAVE_OPT( IPV4 )
80181834Sroberto */
81181834Sroberto#define         DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n])
82181834Sroberto#define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
83181834Sroberto#define      OPT_ARG(n) (DESC(n).optArg.argString)
84181834Sroberto#define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
85181834Sroberto#define    COUNT_OPT(n) (DESC(n).optOccCt)
86181834Sroberto#define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
87181834Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
88181834Sroberto#define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
89181834Sroberto#define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
90181834Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
91181834Sroberto#define    CLEAR_OPT(n) STMTS( \
92181834Sroberto                DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
93181834Sroberto                if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
94181834Sroberto                    DESC(n).fOptState |= OPTST_DISABLED; \
95181834Sroberto                DESC(n).optCookie = NULL )
96181834Sroberto
97181834Sroberto/*
98181834Sroberto *  Make sure there are no #define name conflicts with the option names
99181834Sroberto */
100181834Sroberto#ifndef     NO_OPTION_NAME_WARNINGS
101181834Sroberto# ifdef    IPV4
102181834Sroberto#  warning undefining IPV4 due to option name conflict
103181834Sroberto#  undef   IPV4
104181834Sroberto# endif
105181834Sroberto# ifdef    IPV6
106181834Sroberto#  warning undefining IPV6 due to option name conflict
107181834Sroberto#  undef   IPV6
108181834Sroberto# endif
109181834Sroberto# ifdef    COMMAND
110181834Sroberto#  warning undefining COMMAND due to option name conflict
111181834Sroberto#  undef   COMMAND
112181834Sroberto# endif
113181834Sroberto# ifdef    LISTPEERS
114181834Sroberto#  warning undefining LISTPEERS due to option name conflict
115181834Sroberto#  undef   LISTPEERS
116181834Sroberto# endif
117181834Sroberto# ifdef    PEERS
118181834Sroberto#  warning undefining PEERS due to option name conflict
119181834Sroberto#  undef   PEERS
120181834Sroberto# endif
121181834Sroberto# ifdef    SHOWPEERS
122181834Sroberto#  warning undefining SHOWPEERS due to option name conflict
123181834Sroberto#  undef   SHOWPEERS
124181834Sroberto# endif
125181834Sroberto# ifdef    INTERACTIVE
126181834Sroberto#  warning undefining INTERACTIVE due to option name conflict
127181834Sroberto#  undef   INTERACTIVE
128181834Sroberto# endif
129181834Sroberto# ifdef    DEBUG_LEVEL
130181834Sroberto#  warning undefining DEBUG_LEVEL due to option name conflict
131181834Sroberto#  undef   DEBUG_LEVEL
132181834Sroberto# endif
133181834Sroberto# ifdef    SET_DEBUG_LEVEL
134181834Sroberto#  warning undefining SET_DEBUG_LEVEL due to option name conflict
135181834Sroberto#  undef   SET_DEBUG_LEVEL
136181834Sroberto# endif
137181834Sroberto# ifdef    NUMERIC
138181834Sroberto#  warning undefining NUMERIC due to option name conflict
139181834Sroberto#  undef   NUMERIC
140181834Sroberto# endif
141181834Sroberto#else  /* NO_OPTION_NAME_WARNINGS */
142181834Sroberto# undef IPV4
143181834Sroberto# undef IPV6
144181834Sroberto# undef COMMAND
145181834Sroberto# undef LISTPEERS
146181834Sroberto# undef PEERS
147181834Sroberto# undef SHOWPEERS
148181834Sroberto# undef INTERACTIVE
149181834Sroberto# undef DEBUG_LEVEL
150181834Sroberto# undef SET_DEBUG_LEVEL
151181834Sroberto# undef NUMERIC
152181834Sroberto#endif  /*  NO_OPTION_NAME_WARNINGS */
153181834Sroberto
154181834Sroberto/*
155181834Sroberto *  Interface defines for specific options.
156181834Sroberto */
157181834Sroberto#define VALUE_OPT_IPV4           '4'
158181834Sroberto#define WHICH_OPT_IPV4           (DESC(IPV4).optActualValue)
159181834Sroberto#define WHICH_IDX_IPV4           (DESC(IPV4).optActualIndex)
160181834Sroberto#define VALUE_OPT_IPV6           '6'
161181834Sroberto#define VALUE_OPT_COMMAND        'c'
162181834Sroberto#define VALUE_OPT_LISTPEERS      'l'
163181834Sroberto#define VALUE_OPT_PEERS          'p'
164181834Sroberto#define VALUE_OPT_SHOWPEERS      's'
165181834Sroberto#define VALUE_OPT_INTERACTIVE    'i'
166181834Sroberto#ifdef DEBUG
167181834Sroberto#define VALUE_OPT_DEBUG_LEVEL    'd'
168181834Sroberto#endif /* DEBUG */
169181834Sroberto#ifdef DEBUG
170181834Sroberto#define VALUE_OPT_SET_DEBUG_LEVEL 'D'
171181834Sroberto#endif /* DEBUG */
172181834Sroberto#define VALUE_OPT_NUMERIC        'n'
173181834Sroberto
174181834Sroberto#define VALUE_OPT_VERSION       'v'
175181834Sroberto#define VALUE_OPT_HELP          '?'
176181834Sroberto#define VALUE_OPT_MORE_HELP     '!'
177181834Sroberto#define VALUE_OPT_SAVE_OPTS     '>'
178181834Sroberto#define VALUE_OPT_LOAD_OPTS     '<'
179181834Sroberto#define SET_OPT_SAVE_OPTS(a)   STMTS( \
180181834Sroberto        DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
181181834Sroberto        DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
182181834Sroberto        DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
183181834Sroberto/*
184181834Sroberto *  Interface defines not associated with particular options
185181834Sroberto */
186181834Sroberto#define ERRSKIP_OPTERR  STMTS( ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP )
187181834Sroberto#define ERRSTOP_OPTERR  STMTS( ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP )
188181834Sroberto#define RESTART_OPT(n)  STMTS( \
189181834Sroberto                ntpdcOptions.curOptIdx = (n); \
190181834Sroberto                ntpdcOptions.pzCurOpt  = NULL )
191181834Sroberto#define START_OPT       RESTART_OPT(1)
192181834Sroberto#define USAGE(c)        (*ntpdcOptions.pUsageProc)( &ntpdcOptions, c )
193200576Sroberto/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
194181834Sroberto
195181834Sroberto/* * * * * *
196181834Sroberto *
197181834Sroberto *  Declare the ntpdc option descriptor.
198181834Sroberto */
199181834Sroberto#ifdef  __cplusplus
200181834Srobertoextern "C" {
201181834Sroberto#endif
202181834Sroberto
203181834Srobertoextern tOptions   ntpdcOptions;
204181834Sroberto
205181834Sroberto#ifndef _
206181834Sroberto#  if ENABLE_NLS
207181834Sroberto#    include <stdio.h>
208181834Sroberto     static inline char* aoGetsText( char const* pz ) {
209181834Sroberto         if (pz == NULL) return NULL;
210181834Sroberto         return (char*)gettext( pz );
211181834Sroberto     }
212181834Sroberto#    define _(s)  aoGetsText(s)
213181834Sroberto#  else  /* ENABLE_NLS */
214181834Sroberto#    define _(s)  s
215181834Sroberto#  endif /* ENABLE_NLS */
216181834Sroberto#endif
217181834Sroberto
218181834Sroberto#ifdef  __cplusplus
219181834Sroberto}
220181834Sroberto#endif
221181834Sroberto#endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */
222181834Sroberto/* ntpdc-opts.h ends here */
223