/contrib/ntp/ntpq/ntpq-opts.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 208 lines · 136 code · 12 blank · 60 comment · 7 complexity · 615b622df5c3375dca95cd698b79a600 MD5 · raw file

  1. /*
  2. * EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
  3. *
  4. * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:26 AM EST
  5. * From the definitions ntpq-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. * ntpq 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. * ntpq 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 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
  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_DEBUG_LEVEL = 3,
  56. INDEX_OPT_SET_DEBUG_LEVEL = 4,
  57. INDEX_OPT_PEERS = 5,
  58. INDEX_OPT_INTERACTIVE = 6,
  59. INDEX_OPT_NUMERIC = 7,
  60. INDEX_OPT_VERSION = 8,
  61. INDEX_OPT_HELP = 9,
  62. INDEX_OPT_MORE_HELP = 10,
  63. INDEX_OPT_SAVE_OPTS = 11,
  64. INDEX_OPT_LOAD_OPTS = 12
  65. } teOptIndex;
  66. #define OPTION_CT 13
  67. #define NTPQ_VERSION "4.2.4p8"
  68. #define NTPQ_FULL_VERSION "ntpq - standard NTP query program - Ver. 4.2.4p8"
  69. /*
  70. * Interface defines for all options. Replace "n" with the UPPER_CASED
  71. * option name (as in the teOptIndex enumeration above).
  72. * e.g. HAVE_OPT( IPV4 )
  73. */
  74. #define DESC(n) (ntpqOptions.pOptDesc[INDEX_OPT_## n])
  75. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  76. #define OPT_ARG(n) (DESC(n).optArg.argString)
  77. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  78. #define COUNT_OPT(n) (DESC(n).optOccCt)
  79. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  80. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  81. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  82. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  83. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  84. #define CLEAR_OPT(n) STMTS( \
  85. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  86. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  87. DESC(n).fOptState |= OPTST_DISABLED; \
  88. DESC(n).optCookie = NULL )
  89. /*
  90. * Make sure there are no #define name conflicts with the option names
  91. */
  92. #ifndef NO_OPTION_NAME_WARNINGS
  93. # ifdef IPV4
  94. # warning undefining IPV4 due to option name conflict
  95. # undef IPV4
  96. # endif
  97. # ifdef IPV6
  98. # warning undefining IPV6 due to option name conflict
  99. # undef IPV6
  100. # endif
  101. # ifdef COMMAND
  102. # warning undefining COMMAND due to option name conflict
  103. # undef COMMAND
  104. # endif
  105. # ifdef DEBUG_LEVEL
  106. # warning undefining DEBUG_LEVEL due to option name conflict
  107. # undef DEBUG_LEVEL
  108. # endif
  109. # ifdef SET_DEBUG_LEVEL
  110. # warning undefining SET_DEBUG_LEVEL due to option name conflict
  111. # undef SET_DEBUG_LEVEL
  112. # endif
  113. # ifdef PEERS
  114. # warning undefining PEERS due to option name conflict
  115. # undef PEERS
  116. # endif
  117. # ifdef INTERACTIVE
  118. # warning undefining INTERACTIVE due to option name conflict
  119. # undef INTERACTIVE
  120. # endif
  121. # ifdef NUMERIC
  122. # warning undefining NUMERIC due to option name conflict
  123. # undef NUMERIC
  124. # endif
  125. #else /* NO_OPTION_NAME_WARNINGS */
  126. # undef IPV4
  127. # undef IPV6
  128. # undef COMMAND
  129. # undef DEBUG_LEVEL
  130. # undef SET_DEBUG_LEVEL
  131. # undef PEERS
  132. # undef INTERACTIVE
  133. # undef NUMERIC
  134. #endif /* NO_OPTION_NAME_WARNINGS */
  135. /*
  136. * Interface defines for specific options.
  137. */
  138. #define VALUE_OPT_IPV4 '4'
  139. #define WHICH_OPT_IPV4 (DESC(IPV4).optActualValue)
  140. #define WHICH_IDX_IPV4 (DESC(IPV4).optActualIndex)
  141. #define VALUE_OPT_IPV6 '6'
  142. #define VALUE_OPT_COMMAND 'c'
  143. #ifdef DEBUG
  144. #define VALUE_OPT_DEBUG_LEVEL 'd'
  145. #endif /* DEBUG */
  146. #ifdef DEBUG
  147. #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
  148. #endif /* DEBUG */
  149. #define VALUE_OPT_PEERS 'p'
  150. #define VALUE_OPT_INTERACTIVE 'i'
  151. #define VALUE_OPT_NUMERIC 'n'
  152. #define VALUE_OPT_VERSION 'v'
  153. #define VALUE_OPT_HELP '?'
  154. #define VALUE_OPT_MORE_HELP '!'
  155. #define VALUE_OPT_SAVE_OPTS '>'
  156. #define VALUE_OPT_LOAD_OPTS '<'
  157. #define SET_OPT_SAVE_OPTS(a) STMTS( \
  158. DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  159. DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  160. DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
  161. /*
  162. * Interface defines not associated with particular options
  163. */
  164. #define ERRSKIP_OPTERR STMTS( ntpqOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  165. #define ERRSTOP_OPTERR STMTS( ntpqOptions.fOptSet |= OPTPROC_ERRSTOP )
  166. #define RESTART_OPT(n) STMTS( \
  167. ntpqOptions.curOptIdx = (n); \
  168. ntpqOptions.pzCurOpt = NULL )
  169. #define START_OPT RESTART_OPT(1)
  170. #define USAGE(c) (*ntpqOptions.pUsageProc)( &ntpqOptions, c )
  171. /* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
  172. /* * * * * *
  173. *
  174. * Declare the ntpq option descriptor.
  175. */
  176. #ifdef __cplusplus
  177. extern "C" {
  178. #endif
  179. extern tOptions ntpqOptions;
  180. #ifndef _
  181. # if ENABLE_NLS
  182. # include <stdio.h>
  183. static inline char* aoGetsText( char const* pz ) {
  184. if (pz == NULL) return NULL;
  185. return (char*)gettext( pz );
  186. }
  187. # define _(s) aoGetsText(s)
  188. # else /* ENABLE_NLS */
  189. # define _(s) s
  190. # endif /* ENABLE_NLS */
  191. #endif
  192. #ifdef __cplusplus
  193. }
  194. #endif
  195. #endif /* AUTOOPTS_NTPQ_OPTS_H_GUARD */
  196. /* ntpq-opts.h ends here */