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