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