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