/contrib/ntp/ntpdc/ntpdc-opts.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 222 lines · 150 code · 12 blank · 60 comment · 7 complexity · 1f56d5b8d7a2a58635782a5d6addc00a MD5 · raw file

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