xref: /freebsd/contrib/ntp/sntp/sntp-opts.h (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
1ea906c41SOllivier Robert /*
2ea906c41SOllivier Robert  *  EDIT THIS FILE WITH CAUTION  (sntp-opts.h)
3ea906c41SOllivier Robert  *
4*f5f40dd6SCy Schubert  *  It has been AutoGen-ed  May 25, 2024 at 12:02:07 AM by AutoGen 5.18.16
5ea906c41SOllivier Robert  *  From the definitions    sntp-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 sntp 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 sntp 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 sntp 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_SNTP_OPTS_H_GUARD
452b15cb3dSCy Schubert #define AUTOOPTS_SNTP_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 sntp
73ea906c41SOllivier Robert  */
74ea906c41SOllivier Robert typedef enum {
75ea906c41SOllivier Robert     INDEX_OPT_IPV4             =  0,
76ea906c41SOllivier Robert     INDEX_OPT_IPV6             =  1,
772b15cb3dSCy Schubert     INDEX_OPT_AUTHENTICATION   =  2,
782b15cb3dSCy Schubert     INDEX_OPT_BROADCAST        =  3,
792b15cb3dSCy Schubert     INDEX_OPT_CONCURRENT       =  4,
802b15cb3dSCy Schubert     INDEX_OPT_DEBUG_LEVEL      =  5,
812b15cb3dSCy Schubert     INDEX_OPT_SET_DEBUG_LEVEL  =  6,
822b15cb3dSCy Schubert     INDEX_OPT_GAP              =  7,
832b15cb3dSCy Schubert     INDEX_OPT_KOD              =  8,
842b15cb3dSCy Schubert     INDEX_OPT_KEYFILE          =  9,
852b15cb3dSCy Schubert     INDEX_OPT_LOGFILE          = 10,
862b15cb3dSCy Schubert     INDEX_OPT_STEPLIMIT        = 11,
872b15cb3dSCy Schubert     INDEX_OPT_NTPVERSION       = 12,
882b15cb3dSCy Schubert     INDEX_OPT_USERESERVEDPORT  = 13,
892b15cb3dSCy Schubert     INDEX_OPT_STEP             = 14,
902b15cb3dSCy Schubert     INDEX_OPT_SLEW             = 15,
912b15cb3dSCy Schubert     INDEX_OPT_TIMEOUT          = 16,
922b15cb3dSCy Schubert     INDEX_OPT_WAIT             = 17,
932b15cb3dSCy Schubert     INDEX_OPT_VERSION          = 18,
942b15cb3dSCy Schubert     INDEX_OPT_HELP             = 19,
952b15cb3dSCy Schubert     INDEX_OPT_MORE_HELP        = 20,
962b15cb3dSCy Schubert     INDEX_OPT_SAVE_OPTS        = 21,
972b15cb3dSCy Schubert     INDEX_OPT_LOAD_OPTS        = 22
98ea906c41SOllivier Robert } teOptIndex;
992b15cb3dSCy Schubert /** count of all options for sntp */
1002b15cb3dSCy Schubert #define OPTION_CT    23
1012b15cb3dSCy Schubert /** sntp version */
102*f5f40dd6SCy Schubert #define SNTP_VERSION       "4.2.8p18"
1032b15cb3dSCy Schubert /** Full sntp version text */
104*f5f40dd6SCy Schubert #define SNTP_FULL_VERSION  "sntp 4.2.8p18"
105ea906c41SOllivier Robert 
1062b15cb3dSCy Schubert /**
107ea906c41SOllivier Robert  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
108ea906c41SOllivier Robert  *  option name (as in the teOptIndex enumeration above).
109ea906c41SOllivier Robert  *  e.g. HAVE_OPT(IPV4)
110ea906c41SOllivier Robert  */
111ea906c41SOllivier Robert #define         DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n])
1122b15cb3dSCy Schubert /** 'true' if an option has been specified in any way */
113ea906c41SOllivier Robert #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
1142b15cb3dSCy Schubert /** The string argument to an option. The argument type must be \"string\". */
115ea906c41SOllivier Robert #define      OPT_ARG(n) (DESC(n).optArg.argString)
1162b15cb3dSCy Schubert /** Mask the option state revealing how an option was specified.
1172b15cb3dSCy Schubert  *  It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
1182b15cb3dSCy Schubert  * \a OPTST_DEFINED, \a OPTST_RESET or zero.
1192b15cb3dSCy Schubert  */
120ea906c41SOllivier Robert #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
1212b15cb3dSCy Schubert /** Count of option's occurrances *on the command line*. */
122ea906c41SOllivier Robert #define    COUNT_OPT(n) (DESC(n).optOccCt)
1232b15cb3dSCy Schubert /** mask of \a OPTST_SET and \a OPTST_DEFINED. */
124ea906c41SOllivier Robert #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
1252b15cb3dSCy Schubert /** 'true' if \a HAVE_OPT would yield 'false'. */
126ea906c41SOllivier Robert #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
1272b15cb3dSCy Schubert /** 'true' if OPTST_DISABLED bit not set. */
128ea906c41SOllivier Robert #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
1292b15cb3dSCy Schubert /** number of stacked option arguments.
1302b15cb3dSCy Schubert  *  Valid only for stacked option arguments. */
131ea906c41SOllivier Robert #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
1322b15cb3dSCy Schubert /** stacked argument vector.
1332b15cb3dSCy Schubert  *  Valid only for stacked option arguments. */
134ea906c41SOllivier Robert #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
1352b15cb3dSCy Schubert /** Reset an option. */
136ea906c41SOllivier Robert #define    CLEAR_OPT(n) STMTS( \
137ea906c41SOllivier Robert                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
138ea906c41SOllivier Robert                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
139ea906c41SOllivier Robert                     DESC(n).fOptState |= OPTST_DISABLED; \
140ea906c41SOllivier Robert                 DESC(n).optCookie = NULL )
1412b15cb3dSCy Schubert /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1422b15cb3dSCy Schubert /**
1432b15cb3dSCy Schubert  *  Enumeration of sntp exit codes
1442b15cb3dSCy Schubert  */
1452b15cb3dSCy Schubert typedef enum {
1462b15cb3dSCy Schubert     SNTP_EXIT_SUCCESS         = 0,
1472b15cb3dSCy Schubert     SNTP_EXIT_FAILURE         = 1,
1482b15cb3dSCy Schubert     SNTP_EXIT_USAGE_ERROR     = 64,
1492b15cb3dSCy Schubert     SNTP_EXIT_NO_CONFIG_INPUT = 66,
1502b15cb3dSCy Schubert     SNTP_EXIT_LIBOPTS_FAILURE = 70
1512b15cb3dSCy Schubert }   sntp_exit_code_t;
1522b15cb3dSCy Schubert /** @} */
1532b15cb3dSCy Schubert /**
154ea906c41SOllivier Robert  *  Make sure there are no #define name conflicts with the option names
155ea906c41SOllivier Robert  */
156ea906c41SOllivier Robert #ifndef     NO_OPTION_NAME_WARNINGS
157ea906c41SOllivier Robert # ifdef    IPV4
158ea906c41SOllivier Robert #  warning undefining IPV4 due to option name conflict
159ea906c41SOllivier Robert #  undef   IPV4
160ea906c41SOllivier Robert # endif
161ea906c41SOllivier Robert # ifdef    IPV6
162ea906c41SOllivier Robert #  warning undefining IPV6 due to option name conflict
163ea906c41SOllivier Robert #  undef   IPV6
164ea906c41SOllivier Robert # endif
1652b15cb3dSCy Schubert # ifdef    AUTHENTICATION
1662b15cb3dSCy Schubert #  warning undefining AUTHENTICATION due to option name conflict
1672b15cb3dSCy Schubert #  undef   AUTHENTICATION
168ea906c41SOllivier Robert # endif
1692b15cb3dSCy Schubert # ifdef    BROADCAST
1702b15cb3dSCy Schubert #  warning undefining BROADCAST due to option name conflict
1712b15cb3dSCy Schubert #  undef   BROADCAST
172ea906c41SOllivier Robert # endif
1732b15cb3dSCy Schubert # ifdef    CONCURRENT
1742b15cb3dSCy Schubert #  warning undefining CONCURRENT due to option name conflict
1752b15cb3dSCy Schubert #  undef   CONCURRENT
176ea906c41SOllivier Robert # endif
1772b15cb3dSCy Schubert # ifdef    DEBUG_LEVEL
1782b15cb3dSCy Schubert #  warning undefining DEBUG_LEVEL due to option name conflict
1792b15cb3dSCy Schubert #  undef   DEBUG_LEVEL
180ea906c41SOllivier Robert # endif
1812b15cb3dSCy Schubert # ifdef    SET_DEBUG_LEVEL
1822b15cb3dSCy Schubert #  warning undefining SET_DEBUG_LEVEL due to option name conflict
1832b15cb3dSCy Schubert #  undef   SET_DEBUG_LEVEL
184ea906c41SOllivier Robert # endif
1852b15cb3dSCy Schubert # ifdef    GAP
1862b15cb3dSCy Schubert #  warning undefining GAP due to option name conflict
1872b15cb3dSCy Schubert #  undef   GAP
1882b15cb3dSCy Schubert # endif
1892b15cb3dSCy Schubert # ifdef    KOD
1902b15cb3dSCy Schubert #  warning undefining KOD due to option name conflict
1912b15cb3dSCy Schubert #  undef   KOD
1922b15cb3dSCy Schubert # endif
1932b15cb3dSCy Schubert # ifdef    KEYFILE
1942b15cb3dSCy Schubert #  warning undefining KEYFILE due to option name conflict
1952b15cb3dSCy Schubert #  undef   KEYFILE
1962b15cb3dSCy Schubert # endif
1972b15cb3dSCy Schubert # ifdef    LOGFILE
1982b15cb3dSCy Schubert #  warning undefining LOGFILE due to option name conflict
1992b15cb3dSCy Schubert #  undef   LOGFILE
2002b15cb3dSCy Schubert # endif
2012b15cb3dSCy Schubert # ifdef    STEPLIMIT
2022b15cb3dSCy Schubert #  warning undefining STEPLIMIT due to option name conflict
2032b15cb3dSCy Schubert #  undef   STEPLIMIT
2042b15cb3dSCy Schubert # endif
2052b15cb3dSCy Schubert # ifdef    NTPVERSION
2062b15cb3dSCy Schubert #  warning undefining NTPVERSION due to option name conflict
2072b15cb3dSCy Schubert #  undef   NTPVERSION
2082b15cb3dSCy Schubert # endif
2092b15cb3dSCy Schubert # ifdef    USERESERVEDPORT
2102b15cb3dSCy Schubert #  warning undefining USERESERVEDPORT due to option name conflict
2112b15cb3dSCy Schubert #  undef   USERESERVEDPORT
2122b15cb3dSCy Schubert # endif
2132b15cb3dSCy Schubert # ifdef    STEP
2142b15cb3dSCy Schubert #  warning undefining STEP due to option name conflict
2152b15cb3dSCy Schubert #  undef   STEP
2162b15cb3dSCy Schubert # endif
2172b15cb3dSCy Schubert # ifdef    SLEW
2182b15cb3dSCy Schubert #  warning undefining SLEW due to option name conflict
2192b15cb3dSCy Schubert #  undef   SLEW
2202b15cb3dSCy Schubert # endif
2212b15cb3dSCy Schubert # ifdef    TIMEOUT
2222b15cb3dSCy Schubert #  warning undefining TIMEOUT due to option name conflict
2232b15cb3dSCy Schubert #  undef   TIMEOUT
2242b15cb3dSCy Schubert # endif
2252b15cb3dSCy Schubert # ifdef    WAIT
2262b15cb3dSCy Schubert #  warning undefining WAIT due to option name conflict
2272b15cb3dSCy Schubert #  undef   WAIT
228ea906c41SOllivier Robert # endif
229ea906c41SOllivier Robert #else  /* NO_OPTION_NAME_WARNINGS */
230ea906c41SOllivier Robert # undef IPV4
231ea906c41SOllivier Robert # undef IPV6
2322b15cb3dSCy Schubert # undef AUTHENTICATION
2332b15cb3dSCy Schubert # undef BROADCAST
2342b15cb3dSCy Schubert # undef CONCURRENT
2352b15cb3dSCy Schubert # undef DEBUG_LEVEL
2362b15cb3dSCy Schubert # undef SET_DEBUG_LEVEL
2372b15cb3dSCy Schubert # undef GAP
2382b15cb3dSCy Schubert # undef KOD
2392b15cb3dSCy Schubert # undef KEYFILE
2402b15cb3dSCy Schubert # undef LOGFILE
2412b15cb3dSCy Schubert # undef STEPLIMIT
2422b15cb3dSCy Schubert # undef NTPVERSION
2432b15cb3dSCy Schubert # undef USERESERVEDPORT
2442b15cb3dSCy Schubert # undef STEP
2452b15cb3dSCy Schubert # undef SLEW
2462b15cb3dSCy Schubert # undef TIMEOUT
2472b15cb3dSCy Schubert # undef WAIT
248ea906c41SOllivier Robert #endif  /*  NO_OPTION_NAME_WARNINGS */
249ea906c41SOllivier Robert 
2502b15cb3dSCy Schubert /**
251ea906c41SOllivier Robert  *  Interface defines for specific options.
2522b15cb3dSCy Schubert  * @{
253ea906c41SOllivier Robert  */
254ea906c41SOllivier Robert #define VALUE_OPT_IPV4           '4'
255ea906c41SOllivier Robert #define VALUE_OPT_IPV6           '6'
2562b15cb3dSCy Schubert #define VALUE_OPT_AUTHENTICATION 'a'
257ea906c41SOllivier Robert 
2582b15cb3dSCy Schubert #define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt)
2592b15cb3dSCy Schubert #define VALUE_OPT_BROADCAST      'b'
2602b15cb3dSCy Schubert #define VALUE_OPT_CONCURRENT     'c'
2612b15cb3dSCy Schubert #define VALUE_OPT_DEBUG_LEVEL    'd'
2622b15cb3dSCy Schubert #define VALUE_OPT_SET_DEBUG_LEVEL 'D'
2632b15cb3dSCy Schubert 
2642b15cb3dSCy Schubert #define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
2652b15cb3dSCy Schubert #define VALUE_OPT_GAP            'g'
2662b15cb3dSCy Schubert 
2672b15cb3dSCy Schubert #define OPT_VALUE_GAP            (DESC(GAP).optArg.argInt)
2682b15cb3dSCy Schubert #define VALUE_OPT_KOD            'K'
2692b15cb3dSCy Schubert #define VALUE_OPT_KEYFILE        'k'
2702b15cb3dSCy Schubert #define VALUE_OPT_LOGFILE        'l'
2712b15cb3dSCy Schubert #define VALUE_OPT_STEPLIMIT      'M'
2722b15cb3dSCy Schubert 
2732b15cb3dSCy Schubert #define OPT_VALUE_STEPLIMIT      (DESC(STEPLIMIT).optArg.argInt)
2742b15cb3dSCy Schubert #define VALUE_OPT_NTPVERSION     'o'
2752b15cb3dSCy Schubert 
2762b15cb3dSCy Schubert #define OPT_VALUE_NTPVERSION     (DESC(NTPVERSION).optArg.argInt)
2772b15cb3dSCy Schubert #define VALUE_OPT_USERESERVEDPORT 'r'
2782b15cb3dSCy Schubert #define VALUE_OPT_STEP           'S'
2792b15cb3dSCy Schubert #define VALUE_OPT_SLEW           's'
2802b15cb3dSCy Schubert #define VALUE_OPT_TIMEOUT        't'
2812b15cb3dSCy Schubert 
2822b15cb3dSCy Schubert #define OPT_VALUE_TIMEOUT        (DESC(TIMEOUT).optArg.argInt)
2832b15cb3dSCy Schubert #define VALUE_OPT_WAIT           0x1001
2842b15cb3dSCy Schubert 
2852b15cb3dSCy Schubert #define SET_OPT_WAIT   STMTS( \
2862b15cb3dSCy Schubert         DESC(WAIT).optActualIndex = 17; \
2872b15cb3dSCy Schubert         DESC(WAIT).optActualValue = VALUE_OPT_WAIT; \
2882b15cb3dSCy Schubert         DESC(WAIT).fOptState &= OPTST_PERSISTENT_MASK; \
2892b15cb3dSCy Schubert         DESC(WAIT).fOptState |= OPTST_SET )
2902b15cb3dSCy Schubert #define DISABLE_OPT_WAIT   STMTS( \
2912b15cb3dSCy Schubert         DESC(WAIT).fOptState &= OPTST_PERSISTENT_MASK; \
2922b15cb3dSCy Schubert         DESC(WAIT).fOptState |= OPTST_SET | OPTST_DISABLED; \
2932b15cb3dSCy Schubert         DESC(WAIT).optArg.argString = NULL )
2942b15cb3dSCy Schubert /** option flag (value) for help-value option */
295ea906c41SOllivier Robert #define VALUE_OPT_HELP          '?'
2962b15cb3dSCy Schubert /** option flag (value) for more-help-value option */
297ea906c41SOllivier Robert #define VALUE_OPT_MORE_HELP     '!'
2982b15cb3dSCy Schubert /** option flag (value) for version-value option */
2992b15cb3dSCy Schubert #define VALUE_OPT_VERSION       0x1002
3002b15cb3dSCy Schubert /** option flag (value) for save-opts-value option */
301ea906c41SOllivier Robert #define VALUE_OPT_SAVE_OPTS     '>'
3022b15cb3dSCy Schubert /** option flag (value) for load-opts-value option */
303ea906c41SOllivier Robert #define VALUE_OPT_LOAD_OPTS     '<'
304ea906c41SOllivier Robert #define SET_OPT_SAVE_OPTS(a)   STMTS( \
305ea906c41SOllivier Robert         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
306ea906c41SOllivier Robert         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
307ea906c41SOllivier Robert         DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
308ea906c41SOllivier Robert /*
309ea906c41SOllivier Robert  *  Interface defines not associated with particular options
310ea906c41SOllivier Robert  */
311ea906c41SOllivier Robert #define ERRSKIP_OPTERR  STMTS(sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP)
312ea906c41SOllivier Robert #define ERRSTOP_OPTERR  STMTS(sntpOptions.fOptSet |= OPTPROC_ERRSTOP)
313ea906c41SOllivier Robert #define RESTART_OPT(n)  STMTS( \
314ea906c41SOllivier Robert                 sntpOptions.curOptIdx = (n); \
315ea906c41SOllivier Robert                 sntpOptions.pzCurOpt  = NULL )
316ea906c41SOllivier Robert #define START_OPT       RESTART_OPT(1)
317ea906c41SOllivier Robert #define USAGE(c)        (*sntpOptions.pUsageProc)(&sntpOptions, c)
3182b15cb3dSCy Schubert 
3192b15cb3dSCy Schubert #ifdef  __cplusplus
3202b15cb3dSCy Schubert extern "C" {
3212b15cb3dSCy Schubert #endif
3222b15cb3dSCy Schubert 
323ea906c41SOllivier Robert 
324ea906c41SOllivier Robert /* * * * * *
325ea906c41SOllivier Robert  *
326ea906c41SOllivier Robert  *  Declare the sntp option descriptor.
327ea906c41SOllivier Robert  */
328ea906c41SOllivier Robert extern tOptions sntpOptions;
329ea906c41SOllivier Robert 
3302b15cb3dSCy Schubert #if defined(ENABLE_NLS)
331ea906c41SOllivier Robert # ifndef _
332ea906c41SOllivier Robert #   include <stdio.h>
3332b15cb3dSCy Schubert #   ifndef HAVE_GETTEXT
3342b15cb3dSCy Schubert       extern char * gettext(char const *);
3352b15cb3dSCy Schubert #   else
3362b15cb3dSCy Schubert #     include <libintl.h>
3372b15cb3dSCy Schubert #   endif
3382b15cb3dSCy Schubert 
3392b15cb3dSCy Schubert # ifndef ATTRIBUTE_FORMAT_ARG
3402b15cb3dSCy Schubert #   define ATTRIBUTE_FORMAT_ARG(_a)
3412b15cb3dSCy Schubert # endif
3422b15cb3dSCy Schubert 
3432b15cb3dSCy Schubert static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
344ea906c41SOllivier Robert static inline char* aoGetsText(char const* pz) {
345ea906c41SOllivier Robert     if (pz == NULL) return NULL;
346ea906c41SOllivier Robert     return (char*)gettext(pz);
347ea906c41SOllivier Robert }
348ea906c41SOllivier Robert #   define _(s)  aoGetsText(s)
3492b15cb3dSCy Schubert # endif /* _() */
3502b15cb3dSCy Schubert 
3512b15cb3dSCy Schubert # define OPT_NO_XLAT_CFG_NAMES  STMTS(sntpOptions.fOptSet |= \
3522b15cb3dSCy Schubert                                     OPTPROC_NXLAT_OPT_CFG;)
3532b15cb3dSCy Schubert # define OPT_NO_XLAT_OPT_NAMES  STMTS(sntpOptions.fOptSet |= \
3542b15cb3dSCy Schubert                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
3552b15cb3dSCy Schubert 
3562b15cb3dSCy Schubert # define OPT_XLAT_CFG_NAMES     STMTS(sntpOptions.fOptSet &= \
3572b15cb3dSCy Schubert                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
3582b15cb3dSCy Schubert # define OPT_XLAT_OPT_NAMES     STMTS(sntpOptions.fOptSet &= \
3592b15cb3dSCy Schubert                                   ~OPTPROC_NXLAT_OPT;)
3602b15cb3dSCy Schubert 
361ea906c41SOllivier Robert #else   /* ENABLE_NLS */
3622b15cb3dSCy Schubert # define OPT_NO_XLAT_CFG_NAMES
3632b15cb3dSCy Schubert # define OPT_NO_XLAT_OPT_NAMES
3642b15cb3dSCy Schubert 
3652b15cb3dSCy Schubert # define OPT_XLAT_CFG_NAMES
3662b15cb3dSCy Schubert # define OPT_XLAT_OPT_NAMES
3672b15cb3dSCy Schubert 
3682b15cb3dSCy Schubert # ifndef _
3692b15cb3dSCy Schubert #   define _(_s)  _s
370ea906c41SOllivier Robert # endif
3712b15cb3dSCy Schubert #endif  /* ENABLE_NLS */
372ea906c41SOllivier Robert 
373a466cc55SCy Schubert 
374ea906c41SOllivier Robert #ifdef  __cplusplus
375ea906c41SOllivier Robert }
376ea906c41SOllivier Robert #endif
377ea906c41SOllivier Robert #endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */
3782b15cb3dSCy Schubert 
379ea906c41SOllivier Robert /* sntp-opts.h ends here */
380