xref: /freebsd/contrib/ntp/util/ntp-keygen-opts.h (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
1ea906c41SOllivier Robert /*
2ea906c41SOllivier Robert  *  EDIT THIS FILE WITH CAUTION  (ntp-keygen-opts.h)
3ea906c41SOllivier Robert  *
4*f5f40dd6SCy Schubert  *  It has been AutoGen-ed  May 25, 2024 at 12:04:42 AM by AutoGen 5.18.16
5ea906c41SOllivier Robert  *  From the definitions    ntp-keygen-opts.def
6ea906c41SOllivier Robert  *  and the template file   options
7ea906c41SOllivier Robert  *
8a466cc55SCy Schubert  * Generated from AutoOpts 42:1:17 templates.
92b15cb3dSCy Schubert  *
102b15cb3dSCy Schubert  *  AutoOpts is a copyrighted work.  This header file is not encumbered
112b15cb3dSCy Schubert  *  by AutoOpts licensing, but is provided under the licensing terms chosen
122b15cb3dSCy Schubert  *  by the ntp-keygen author or copyright holder.  AutoOpts is
132b15cb3dSCy Schubert  *  licensed under the terms of the LGPL.  The redistributable library
142b15cb3dSCy Schubert  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
152b15cb3dSCy Schubert  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
162b15cb3dSCy Schubert  *  for details.
172b15cb3dSCy Schubert  *
182b15cb3dSCy Schubert  * The ntp-keygen program is copyrighted and licensed
192b15cb3dSCy Schubert  * under the following terms:
202b15cb3dSCy Schubert  *
21*f5f40dd6SCy Schubert  *  Copyright (C) 1992-2024 The University of Delaware and Network Time Foundation, all rights reserved.
222b15cb3dSCy Schubert  *  This is free software. It is licensed for use, modification and
232b15cb3dSCy Schubert  *  redistribution under the terms of the NTP License, copies of which
242b15cb3dSCy Schubert  *  can be seen at:
252b15cb3dSCy Schubert  *    <http://ntp.org/license>
262b15cb3dSCy Schubert  *    <http://opensource.org/licenses/ntp-license.php>
272b15cb3dSCy Schubert  *
282b15cb3dSCy Schubert  *  Permission to use, copy, modify, and distribute this software and its
292b15cb3dSCy Schubert  *  documentation for any purpose with or without fee is hereby granted,
302b15cb3dSCy Schubert  *  provided that the above copyright notice appears in all copies and that
312b15cb3dSCy Schubert  *  both the copyright notice and this permission notice appear in
322b15cb3dSCy Schubert  *  supporting documentation, and that the name The University of Delaware not be used in
332b15cb3dSCy Schubert  *  advertising or publicity pertaining to distribution of the software
342b15cb3dSCy Schubert  *  without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
352b15cb3dSCy Schubert  *  representations about the suitability this software for any purpose. It
362b15cb3dSCy Schubert  *  is provided "as is" without express or implied warranty.
37ea906c41SOllivier Robert  */
382b15cb3dSCy Schubert /**
39ea906c41SOllivier Robert  *  This file contains the programmatic interface to the Automated
40ea906c41SOllivier Robert  *  Options generated for the ntp-keygen program.
41ea906c41SOllivier Robert  *  These macros are documented in the AutoGen info file in the
42ea906c41SOllivier Robert  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
43ea906c41SOllivier Robert  */
44ea906c41SOllivier Robert #ifndef AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD
452b15cb3dSCy Schubert #define AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD 1
46ea906c41SOllivier Robert #include "config.h"
47ea906c41SOllivier Robert #include <autoopts/options.h>
48a466cc55SCy Schubert #include <stdarg.h>
49a466cc55SCy Schubert #include <stdnoreturn.h>
50ea906c41SOllivier Robert 
512b15cb3dSCy Schubert /**
52ea906c41SOllivier Robert  *  Ensure that the library used for compiling this generated header is at
53ea906c41SOllivier Robert  *  least as new as the version current when the header template was released
54ea906c41SOllivier Robert  *  (not counting patch version increments).  Also ensure that the oldest
55ea906c41SOllivier Robert  *  tolerable version is at least as old as what was current when the header
56ea906c41SOllivier Robert  *  template was released.
57ea906c41SOllivier Robert  */
58a466cc55SCy Schubert #define AO_TEMPLATE_VERSION 172033
59ea906c41SOllivier Robert #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
60ea906c41SOllivier Robert  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
61ea906c41SOllivier Robert # error option template version mismatches autoopts/options.h header
62ea906c41SOllivier Robert   Choke Me.
63ea906c41SOllivier Robert #endif
64ea906c41SOllivier Robert 
65a466cc55SCy Schubert #if GCC_VERSION > 40400
66a466cc55SCy Schubert #define NOT_REACHED __builtin_unreachable();
67a466cc55SCy Schubert #else
68a466cc55SCy Schubert #define NOT_REACHED
69a466cc55SCy Schubert #endif
70a466cc55SCy Schubert 
712b15cb3dSCy Schubert /**
722b15cb3dSCy Schubert  *  Enumeration of each option type for ntp-keygen
73ea906c41SOllivier Robert  */
74ea906c41SOllivier Robert typedef enum {
752b15cb3dSCy Schubert     INDEX_OPT_IMBITS           =  0,
762b15cb3dSCy Schubert     INDEX_OPT_CERTIFICATE      =  1,
772b15cb3dSCy Schubert     INDEX_OPT_CIPHER           =  2,
782b15cb3dSCy Schubert     INDEX_OPT_DEBUG_LEVEL      =  3,
792b15cb3dSCy Schubert     INDEX_OPT_SET_DEBUG_LEVEL  =  4,
802b15cb3dSCy Schubert     INDEX_OPT_ID_KEY           =  5,
812b15cb3dSCy Schubert     INDEX_OPT_GQ_PARAMS        =  6,
822b15cb3dSCy Schubert     INDEX_OPT_HOST_KEY         =  7,
832b15cb3dSCy Schubert     INDEX_OPT_IFFKEY           =  8,
842b15cb3dSCy Schubert     INDEX_OPT_IDENT            =  9,
852b15cb3dSCy Schubert     INDEX_OPT_LIFETIME         = 10,
8609100258SXin LI     INDEX_OPT_MODULUS          = 11,
8709100258SXin LI     INDEX_OPT_MD5KEY           = 12,
882b15cb3dSCy Schubert     INDEX_OPT_PVT_CERT         = 13,
892b15cb3dSCy Schubert     INDEX_OPT_PASSWORD         = 14,
902b15cb3dSCy Schubert     INDEX_OPT_EXPORT_PASSWD    = 15,
9109100258SXin LI     INDEX_OPT_SUBJECT_NAME     = 16,
9209100258SXin LI     INDEX_OPT_SIGN_KEY         = 17,
932b15cb3dSCy Schubert     INDEX_OPT_TRUSTED_CERT     = 18,
942b15cb3dSCy Schubert     INDEX_OPT_MV_PARAMS        = 19,
952b15cb3dSCy Schubert     INDEX_OPT_MV_KEYS          = 20,
962b15cb3dSCy Schubert     INDEX_OPT_VERSION          = 21,
972b15cb3dSCy Schubert     INDEX_OPT_HELP             = 22,
982b15cb3dSCy Schubert     INDEX_OPT_MORE_HELP        = 23,
992b15cb3dSCy Schubert     INDEX_OPT_SAVE_OPTS        = 24,
1002b15cb3dSCy Schubert     INDEX_OPT_LOAD_OPTS        = 25
101ea906c41SOllivier Robert } teOptIndex;
1022b15cb3dSCy Schubert /** count of all options for ntp-keygen */
1032b15cb3dSCy Schubert #define OPTION_CT    26
1042b15cb3dSCy Schubert /** ntp-keygen version */
105*f5f40dd6SCy Schubert #define NTP_KEYGEN_VERSION       "4.2.8p18"
1062b15cb3dSCy Schubert /** Full ntp-keygen version text */
107*f5f40dd6SCy Schubert #define NTP_KEYGEN_FULL_VERSION  "ntp-keygen (ntp) 4.2.8p18"
108ea906c41SOllivier Robert 
1092b15cb3dSCy Schubert /**
110ea906c41SOllivier Robert  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
111ea906c41SOllivier Robert  *  option name (as in the teOptIndex enumeration above).
1122b15cb3dSCy Schubert  *  e.g. HAVE_OPT(IMBITS)
113ea906c41SOllivier Robert  */
114ea906c41SOllivier Robert #define         DESC(n) (ntp_keygenOptions.pOptDesc[INDEX_OPT_## n])
1152b15cb3dSCy Schubert /** 'true' if an option has been specified in any way */
116ea906c41SOllivier Robert #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
1172b15cb3dSCy Schubert /** The string argument to an option. The argument type must be \"string\". */
118ea906c41SOllivier Robert #define      OPT_ARG(n) (DESC(n).optArg.argString)
1192b15cb3dSCy Schubert /** Mask the option state revealing how an option was specified.
1202b15cb3dSCy Schubert  *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
1212b15cb3dSCy Schubert  * \a OPTST_DEFINED, \a OPTST_RESET or zero.
1222b15cb3dSCy Schubert  */
123ea906c41SOllivier Robert #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
1242b15cb3dSCy Schubert /** Count of option's occurrances *on the command line*. */
125ea906c41SOllivier Robert #define    COUNT_OPT(n) (DESC(n).optOccCt)
1262b15cb3dSCy Schubert /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
127ea906c41SOllivier Robert #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
1282b15cb3dSCy Schubert /** 'true' if \a HAVE_OPT would yield 'false'. */
129ea906c41SOllivier Robert #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
1302b15cb3dSCy Schubert /** 'true' if OPTST_DISABLED bit not set. */
131ea906c41SOllivier Robert #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
1322b15cb3dSCy Schubert /** number of stacked option arguments.
1332b15cb3dSCy Schubert  *  Valid only for stacked option arguments. */
134ea906c41SOllivier Robert #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
1352b15cb3dSCy Schubert /** stacked argument vector.
1362b15cb3dSCy Schubert  *  Valid only for stacked option arguments. */
137ea906c41SOllivier Robert #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
1382b15cb3dSCy Schubert /** Reset an option. */
139ea906c41SOllivier Robert #define    CLEAR_OPT(n) STMTS( \
140ea906c41SOllivier Robert                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
141ea906c41SOllivier Robert                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
142ea906c41SOllivier Robert                     DESC(n).fOptState |= OPTST_DISABLED; \
143ea906c41SOllivier Robert                 DESC(n).optCookie = NULL )
1442b15cb3dSCy Schubert /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1452b15cb3dSCy Schubert /**
1462b15cb3dSCy Schubert  *  Enumeration of ntp-keygen exit codes
1472b15cb3dSCy Schubert  */
1482b15cb3dSCy Schubert typedef enum {
1492b15cb3dSCy Schubert     NTP_KEYGEN_EXIT_SUCCESS         = 0,
1502b15cb3dSCy Schubert     NTP_KEYGEN_EXIT_FAILURE         = 1,
1512b15cb3dSCy Schubert     NTP_KEYGEN_EXIT_USAGE_ERROR     = 64,
1522b15cb3dSCy Schubert     NTP_KEYGEN_EXIT_NO_CONFIG_INPUT = 66,
1532b15cb3dSCy Schubert     NTP_KEYGEN_EXIT_LIBOPTS_FAILURE = 70
1542b15cb3dSCy Schubert }   ntp_keygen_exit_code_t;
1552b15cb3dSCy Schubert /** @} */
1562b15cb3dSCy Schubert /**
157ea906c41SOllivier Robert  *  Make sure there are no #define name conflicts with the option names
158ea906c41SOllivier Robert  */
159ea906c41SOllivier Robert #ifndef     NO_OPTION_NAME_WARNINGS
1602b15cb3dSCy Schubert # ifdef    IMBITS
1612b15cb3dSCy Schubert #  warning undefining IMBITS due to option name conflict
1622b15cb3dSCy Schubert #  undef   IMBITS
1632b15cb3dSCy Schubert # endif
164ea906c41SOllivier Robert # ifdef    CERTIFICATE
165ea906c41SOllivier Robert #  warning undefining CERTIFICATE due to option name conflict
166ea906c41SOllivier Robert #  undef   CERTIFICATE
167ea906c41SOllivier Robert # endif
1682b15cb3dSCy Schubert # ifdef    CIPHER
1692b15cb3dSCy Schubert #  warning undefining CIPHER due to option name conflict
1702b15cb3dSCy Schubert #  undef   CIPHER
1712b15cb3dSCy Schubert # endif
172ea906c41SOllivier Robert # ifdef    DEBUG_LEVEL
173ea906c41SOllivier Robert #  warning undefining DEBUG_LEVEL due to option name conflict
174ea906c41SOllivier Robert #  undef   DEBUG_LEVEL
175ea906c41SOllivier Robert # endif
176ea906c41SOllivier Robert # ifdef    SET_DEBUG_LEVEL
177ea906c41SOllivier Robert #  warning undefining SET_DEBUG_LEVEL due to option name conflict
178ea906c41SOllivier Robert #  undef   SET_DEBUG_LEVEL
179ea906c41SOllivier Robert # endif
180ea906c41SOllivier Robert # ifdef    ID_KEY
181ea906c41SOllivier Robert #  warning undefining ID_KEY due to option name conflict
182ea906c41SOllivier Robert #  undef   ID_KEY
183ea906c41SOllivier Robert # endif
184ea906c41SOllivier Robert # ifdef    GQ_PARAMS
185ea906c41SOllivier Robert #  warning undefining GQ_PARAMS due to option name conflict
186ea906c41SOllivier Robert #  undef   GQ_PARAMS
187ea906c41SOllivier Robert # endif
188ea906c41SOllivier Robert # ifdef    HOST_KEY
189ea906c41SOllivier Robert #  warning undefining HOST_KEY due to option name conflict
190ea906c41SOllivier Robert #  undef   HOST_KEY
191ea906c41SOllivier Robert # endif
192ea906c41SOllivier Robert # ifdef    IFFKEY
193ea906c41SOllivier Robert #  warning undefining IFFKEY due to option name conflict
194ea906c41SOllivier Robert #  undef   IFFKEY
195ea906c41SOllivier Robert # endif
1962b15cb3dSCy Schubert # ifdef    IDENT
1972b15cb3dSCy Schubert #  warning undefining IDENT due to option name conflict
1982b15cb3dSCy Schubert #  undef   IDENT
1992b15cb3dSCy Schubert # endif
2002b15cb3dSCy Schubert # ifdef    LIFETIME
2012b15cb3dSCy Schubert #  warning undefining LIFETIME due to option name conflict
2022b15cb3dSCy Schubert #  undef   LIFETIME
203ea906c41SOllivier Robert # endif
204ea906c41SOllivier Robert # ifdef    MODULUS
205ea906c41SOllivier Robert #  warning undefining MODULUS due to option name conflict
206ea906c41SOllivier Robert #  undef   MODULUS
207ea906c41SOllivier Robert # endif
20809100258SXin LI # ifdef    MD5KEY
20909100258SXin LI #  warning undefining MD5KEY due to option name conflict
21009100258SXin LI #  undef   MD5KEY
21109100258SXin LI # endif
212ea906c41SOllivier Robert # ifdef    PVT_CERT
213ea906c41SOllivier Robert #  warning undefining PVT_CERT due to option name conflict
214ea906c41SOllivier Robert #  undef   PVT_CERT
215ea906c41SOllivier Robert # endif
2162b15cb3dSCy Schubert # ifdef    PASSWORD
2172b15cb3dSCy Schubert #  warning undefining PASSWORD due to option name conflict
2182b15cb3dSCy Schubert #  undef   PASSWORD
219ea906c41SOllivier Robert # endif
2202b15cb3dSCy Schubert # ifdef    EXPORT_PASSWD
2212b15cb3dSCy Schubert #  warning undefining EXPORT_PASSWD due to option name conflict
2222b15cb3dSCy Schubert #  undef   EXPORT_PASSWD
223ea906c41SOllivier Robert # endif
224ea906c41SOllivier Robert # ifdef    SUBJECT_NAME
225ea906c41SOllivier Robert #  warning undefining SUBJECT_NAME due to option name conflict
226ea906c41SOllivier Robert #  undef   SUBJECT_NAME
227ea906c41SOllivier Robert # endif
22809100258SXin LI # ifdef    SIGN_KEY
22909100258SXin LI #  warning undefining SIGN_KEY due to option name conflict
23009100258SXin LI #  undef   SIGN_KEY
23109100258SXin LI # endif
232ea906c41SOllivier Robert # ifdef    TRUSTED_CERT
233ea906c41SOllivier Robert #  warning undefining TRUSTED_CERT due to option name conflict
234ea906c41SOllivier Robert #  undef   TRUSTED_CERT
235ea906c41SOllivier Robert # endif
236ea906c41SOllivier Robert # ifdef    MV_PARAMS
237ea906c41SOllivier Robert #  warning undefining MV_PARAMS due to option name conflict
238ea906c41SOllivier Robert #  undef   MV_PARAMS
239ea906c41SOllivier Robert # endif
240ea906c41SOllivier Robert # ifdef    MV_KEYS
241ea906c41SOllivier Robert #  warning undefining MV_KEYS due to option name conflict
242ea906c41SOllivier Robert #  undef   MV_KEYS
243ea906c41SOllivier Robert # endif
244ea906c41SOllivier Robert #else  /* NO_OPTION_NAME_WARNINGS */
2452b15cb3dSCy Schubert # undef IMBITS
246ea906c41SOllivier Robert # undef CERTIFICATE
2472b15cb3dSCy Schubert # undef CIPHER
248ea906c41SOllivier Robert # undef DEBUG_LEVEL
249ea906c41SOllivier Robert # undef SET_DEBUG_LEVEL
250ea906c41SOllivier Robert # undef ID_KEY
251ea906c41SOllivier Robert # undef GQ_PARAMS
252ea906c41SOllivier Robert # undef HOST_KEY
253ea906c41SOllivier Robert # undef IFFKEY
2542b15cb3dSCy Schubert # undef IDENT
2552b15cb3dSCy Schubert # undef LIFETIME
256ea906c41SOllivier Robert # undef MODULUS
25709100258SXin LI # undef MD5KEY
258ea906c41SOllivier Robert # undef PVT_CERT
2592b15cb3dSCy Schubert # undef PASSWORD
2602b15cb3dSCy Schubert # undef EXPORT_PASSWD
261ea906c41SOllivier Robert # undef SUBJECT_NAME
26209100258SXin LI # undef SIGN_KEY
263ea906c41SOllivier Robert # undef TRUSTED_CERT
264ea906c41SOllivier Robert # undef MV_PARAMS
265ea906c41SOllivier Robert # undef MV_KEYS
266ea906c41SOllivier Robert #endif  /*  NO_OPTION_NAME_WARNINGS */
267ea906c41SOllivier Robert 
2682b15cb3dSCy Schubert /**
269ea906c41SOllivier Robert  *  Interface defines for specific options.
2702b15cb3dSCy Schubert  * @{
271ea906c41SOllivier Robert  */
2722b15cb3dSCy Schubert #define VALUE_OPT_IMBITS         'b'
2732b15cb3dSCy Schubert #ifdef AUTOKEY
2742b15cb3dSCy Schubert #define OPT_VALUE_IMBITS         (DESC(IMBITS).optArg.argInt)
2752b15cb3dSCy Schubert #endif /* AUTOKEY */
276ea906c41SOllivier Robert #define VALUE_OPT_CERTIFICATE    'c'
2772b15cb3dSCy Schubert #define VALUE_OPT_CIPHER         'C'
278ea906c41SOllivier Robert #define VALUE_OPT_DEBUG_LEVEL    'd'
279ea906c41SOllivier Robert #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
280ea906c41SOllivier Robert 
2812b15cb3dSCy Schubert #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
2822b15cb3dSCy Schubert #define VALUE_OPT_ID_KEY         'e'
2832b15cb3dSCy Schubert #define VALUE_OPT_GQ_PARAMS      'G'
2842b15cb3dSCy Schubert #define VALUE_OPT_HOST_KEY       'H'
2852b15cb3dSCy Schubert #define VALUE_OPT_IFFKEY         'I'
2862b15cb3dSCy Schubert #define VALUE_OPT_IDENT          'i'
2872b15cb3dSCy Schubert #define VALUE_OPT_LIFETIME       'l'
2882b15cb3dSCy Schubert #ifdef AUTOKEY
2892b15cb3dSCy Schubert #define OPT_VALUE_LIFETIME       (DESC(LIFETIME).optArg.argInt)
2902b15cb3dSCy Schubert #endif /* AUTOKEY */
2912b15cb3dSCy Schubert #define VALUE_OPT_MODULUS        'm'
2922b15cb3dSCy Schubert #ifdef AUTOKEY
2932b15cb3dSCy Schubert #define OPT_VALUE_MODULUS        (DESC(MODULUS).optArg.argInt)
2942b15cb3dSCy Schubert #endif /* AUTOKEY */
29509100258SXin LI #define VALUE_OPT_MD5KEY         'M'
2962b15cb3dSCy Schubert #define VALUE_OPT_PVT_CERT       'P'
2972b15cb3dSCy Schubert #define VALUE_OPT_PASSWORD       'p'
2982b15cb3dSCy Schubert #define VALUE_OPT_EXPORT_PASSWD  'q'
2992b15cb3dSCy Schubert #define VALUE_OPT_SUBJECT_NAME   's'
30009100258SXin LI #define VALUE_OPT_SIGN_KEY       'S'
3012b15cb3dSCy Schubert #define VALUE_OPT_TRUSTED_CERT   'T'
3022b15cb3dSCy Schubert #define VALUE_OPT_MV_PARAMS      'V'
3032b15cb3dSCy Schubert #ifdef AUTOKEY
3042b15cb3dSCy Schubert #define OPT_VALUE_MV_PARAMS      (DESC(MV_PARAMS).optArg.argInt)
3052b15cb3dSCy Schubert #endif /* AUTOKEY */
3062b15cb3dSCy Schubert #define VALUE_OPT_MV_KEYS        'v'
3072b15cb3dSCy Schubert #ifdef AUTOKEY
3082b15cb3dSCy Schubert #define OPT_VALUE_MV_KEYS        (DESC(MV_KEYS).optArg.argInt)
3092b15cb3dSCy Schubert #endif /* AUTOKEY */
3102b15cb3dSCy Schubert /** option flag (value) for help-value option */
311ea906c41SOllivier Robert #define VALUE_OPT_HELP          '?'
3122b15cb3dSCy Schubert /** option flag (value) for more-help-value option */
313ea906c41SOllivier Robert #define VALUE_OPT_MORE_HELP     '!'
3142b15cb3dSCy Schubert /** option flag (value) for version-value option */
3152b15cb3dSCy Schubert #define VALUE_OPT_VERSION       0x1001
3162b15cb3dSCy Schubert /** option flag (value) for save-opts-value option */
317ea906c41SOllivier Robert #define VALUE_OPT_SAVE_OPTS     '>'
3182b15cb3dSCy Schubert /** option flag (value) for load-opts-value option */
319ea906c41SOllivier Robert #define VALUE_OPT_LOAD_OPTS     '<'
320ea906c41SOllivier Robert #define SET_OPT_SAVE_OPTS(a)   STMTS( \
321ea906c41SOllivier Robert         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
322ea906c41SOllivier Robert         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
323ea906c41SOllivier Robert         DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
324ea906c41SOllivier Robert /*
325ea906c41SOllivier Robert  *  Interface defines not associated with particular options
326ea906c41SOllivier Robert  */
327ea906c41SOllivier Robert #define ERRSKIP_OPTERR  STMTS(ntp_keygenOptions.fOptSet &= ~OPTPROC_ERRSTOP)
328ea906c41SOllivier Robert #define ERRSTOP_OPTERR  STMTS(ntp_keygenOptions.fOptSet |= OPTPROC_ERRSTOP)
329ea906c41SOllivier Robert #define RESTART_OPT(n)  STMTS( \
330ea906c41SOllivier Robert                 ntp_keygenOptions.curOptIdx = (n); \
331ea906c41SOllivier Robert                 ntp_keygenOptions.pzCurOpt  = NULL )
332ea906c41SOllivier Robert #define START_OPT       RESTART_OPT(1)
333ea906c41SOllivier Robert #define USAGE(c)        (*ntp_keygenOptions.pUsageProc)(&ntp_keygenOptions, c)
3342b15cb3dSCy Schubert 
3352b15cb3dSCy Schubert #ifdef  __cplusplus
3362b15cb3dSCy Schubert extern "C" {
3372b15cb3dSCy Schubert #endif
3382b15cb3dSCy Schubert 
339ea906c41SOllivier Robert 
340ea906c41SOllivier Robert /* * * * * *
341ea906c41SOllivier Robert  *
342ea906c41SOllivier Robert  *  Declare the ntp-keygen option descriptor.
343ea906c41SOllivier Robert  */
344ea906c41SOllivier Robert extern tOptions ntp_keygenOptions;
345ea906c41SOllivier Robert 
3462b15cb3dSCy Schubert #if defined(ENABLE_NLS)
347ea906c41SOllivier Robert # ifndef _
348ea906c41SOllivier Robert #   include <stdio.h>
3492b15cb3dSCy Schubert #   ifndef HAVE_GETTEXT
3502b15cb3dSCy Schubert       extern char * gettext(char const *);
3512b15cb3dSCy Schubert #   else
3522b15cb3dSCy Schubert #     include <libintl.h>
3532b15cb3dSCy Schubert #   endif
3542b15cb3dSCy Schubert 
3552b15cb3dSCy Schubert # ifndef ATTRIBUTE_FORMAT_ARG
3562b15cb3dSCy Schubert #   define ATTRIBUTE_FORMAT_ARG(_a)
3572b15cb3dSCy Schubert # endif
3582b15cb3dSCy Schubert 
3592b15cb3dSCy Schubert static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
360ea906c41SOllivier Robert static inline char* aoGetsText(char const* pz) {
361ea906c41SOllivier Robert     if (pz == NULL) return NULL;
362ea906c41SOllivier Robert     return (char*)gettext(pz);
363ea906c41SOllivier Robert }
364ea906c41SOllivier Robert #   define _(s)  aoGetsText(s)
3652b15cb3dSCy Schubert # endif /* _() */
3662b15cb3dSCy Schubert 
3672b15cb3dSCy Schubert # define OPT_NO_XLAT_CFG_NAMES  STMTS(ntp_keygenOptions.fOptSet |= \
3682b15cb3dSCy Schubert                                     OPTPROC_NXLAT_OPT_CFG;)
3692b15cb3dSCy Schubert # define OPT_NO_XLAT_OPT_NAMES  STMTS(ntp_keygenOptions.fOptSet |= \
3702b15cb3dSCy Schubert                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
3712b15cb3dSCy Schubert 
3722b15cb3dSCy Schubert # define OPT_XLAT_CFG_NAMES     STMTS(ntp_keygenOptions.fOptSet &= \
3732b15cb3dSCy Schubert                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
3742b15cb3dSCy Schubert # define OPT_XLAT_OPT_NAMES     STMTS(ntp_keygenOptions.fOptSet &= \
3752b15cb3dSCy Schubert                                   ~OPTPROC_NXLAT_OPT;)
3762b15cb3dSCy Schubert 
377ea906c41SOllivier Robert #else   /* ENABLE_NLS */
3782b15cb3dSCy Schubert # define OPT_NO_XLAT_CFG_NAMES
3792b15cb3dSCy Schubert # define OPT_NO_XLAT_OPT_NAMES
3802b15cb3dSCy Schubert 
3812b15cb3dSCy Schubert # define OPT_XLAT_CFG_NAMES
3822b15cb3dSCy Schubert # define OPT_XLAT_OPT_NAMES
3832b15cb3dSCy Schubert 
3842b15cb3dSCy Schubert # ifndef _
3852b15cb3dSCy Schubert #   define _(_s)  _s
386ea906c41SOllivier Robert # endif
3872b15cb3dSCy Schubert #endif  /* ENABLE_NLS */
388ea906c41SOllivier Robert 
389a466cc55SCy Schubert 
390ea906c41SOllivier Robert #ifdef  __cplusplus
391ea906c41SOllivier Robert }
392ea906c41SOllivier Robert #endif
393ea906c41SOllivier Robert #endif /* AUTOOPTS_NTP_KEYGEN_OPTS_H_GUARD */
3942b15cb3dSCy Schubert 
395ea906c41SOllivier Robert /* ntp-keygen-opts.h ends here */
396