~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to ntpd/ntpd-opts.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-01-05 21:10:03 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090105211003-mh6zc3um4k1uhsj7
Tags: 1:4.2.4p4+dfsg-8
It did not properly check the return value of EVP_VerifyFinal
which results in an malformed DSA signature being treated as
a good signature rather than as an error.  (CVE-2009-0021)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*   -*- buffer-read-only: t -*- vi: set ro:
 
2
 *  
 
3
 *  DO NOT EDIT THIS FILE   (ntpd-opts.c)
 
4
 *  
 
5
 *  It has been AutoGen-ed  Monday September 10, 2007 at 08:31:16 PM EDT
 
6
 *  From the definitions    ntpd-opts.def
 
7
 *  and the template file   options
 
8
 *
 
9
 * Generated from AutoOpts 29:0:4 templates.
 
10
 */
 
11
 
 
12
/*
 
13
 *  This file was produced by an AutoOpts template.  AutoOpts is a
 
14
 *  copyrighted work.  This source file is not encumbered by AutoOpts
 
15
 *  licensing, but is provided under the licensing terms chosen by the
 
16
 *  ntpd author or copyright holder.  AutoOpts is licensed under
 
17
 *  the terms of the LGPL.  The redistributable library (``libopts'') is
 
18
 *  licensed under the terms of either the LGPL or, at the users discretion,
 
19
 *  the BSD license.  See the AutoOpts and/or libopts sources for details.
 
20
 *
 
21
 * This source file is copyrighted and licensed under the following terms:
 
22
 *
 
23
 * ntpd copyright 1970-2007 David L. Mills and/or others - all rights reserved
 
24
 *
 
25
 * see html/copyright.html
 
26
 */
 
27
 
 
28
 
 
29
#include <limits.h>
 
30
 
 
31
#define OPTION_CODE_COMPILE 1
 
32
#include "ntpd-opts.h"
 
33
 
 
34
#ifdef  __cplusplus
 
35
extern "C" {
 
36
#endif
 
37
tSCC zCopyright[] =
 
38
       "ntpd copyright (c) 1970-2007 David L. Mills and/or others, all rights reserved";
 
39
tSCC zCopyrightNotice[] =
 
40
       
 
41
/* extracted from ../include/copyright.def near line 8 */
 
42
"see html/copyright.html";
 
43
extern tUsageProc optionUsage;
 
44
 
 
45
/*
 
46
 *  global included definitions
 
47
 */
 
48
#ifdef __windows
 
49
  extern int atoi(const char*);
 
50
#else
 
51
# include <stdlib.h>
 
52
#endif
 
53
 
 
54
#ifndef NULL
 
55
#  define NULL 0
 
56
#endif
 
57
#ifndef EXIT_SUCCESS
 
58
#  define  EXIT_SUCCESS 0
 
59
#endif
 
60
#ifndef EXIT_FAILURE
 
61
#  define  EXIT_FAILURE 1
 
62
#endif
 
63
/*
 
64
 *  Ipv4 option description:
 
65
 */
 
66
tSCC    zIpv4Text[] =
 
67
        "Force IPv4 DNS name resolution";
 
68
tSCC    zIpv4_NAME[]               = "IPV4";
 
69
tSCC    zIpv4_Name[]               = "ipv4";
 
70
#define IPV4_FLAGS       (OPTST_DISABLED)
 
71
 
 
72
/*
 
73
 *  Ipv6 option description:
 
74
 */
 
75
tSCC    zIpv6Text[] =
 
76
        "Force IPv6 DNS name resolution";
 
77
tSCC    zIpv6_NAME[]               = "IPV6";
 
78
tSCC    zIpv6_Name[]               = "ipv6";
 
79
#define IPV6_FLAGS       (OPTST_DISABLED)
 
80
 
 
81
/*
 
82
 *  Authreq option description with
 
83
 *  "Must also have options" and "Incompatible options":
 
84
 */
 
85
tSCC    zAuthreqText[] =
 
86
        "Require crypto authentication";
 
87
tSCC    zAuthreq_NAME[]            = "AUTHREQ";
 
88
tSCC    zAuthreq_Name[]            = "authreq";
 
89
static const int
 
90
    aAuthreqCantList[] = {
 
91
    INDEX_OPT_AUTHNOREQ, NO_EQUIVALENT };
 
92
#define AUTHREQ_FLAGS       (OPTST_DISABLED)
 
93
 
 
94
/*
 
95
 *  Authnoreq option description with
 
96
 *  "Must also have options" and "Incompatible options":
 
97
 */
 
98
tSCC    zAuthnoreqText[] =
 
99
        "Do not require crypto authentication";
 
100
tSCC    zAuthnoreq_NAME[]          = "AUTHNOREQ";
 
101
tSCC    zAuthnoreq_Name[]          = "authnoreq";
 
102
static const int
 
103
    aAuthnoreqCantList[] = {
 
104
    INDEX_OPT_AUTHREQ, NO_EQUIVALENT };
 
105
#define AUTHNOREQ_FLAGS       (OPTST_DISABLED)
 
106
 
 
107
/*
 
108
 *  Bcastsync option description:
 
109
 */
 
110
tSCC    zBcastsyncText[] =
 
111
        "Allow us to sync to broadcast servers";
 
112
tSCC    zBcastsync_NAME[]          = "BCASTSYNC";
 
113
tSCC    zBcastsync_Name[]          = "bcastsync";
 
114
#define BCASTSYNC_FLAGS       (OPTST_DISABLED)
 
115
 
 
116
/*
 
117
 *  Configfile option description:
 
118
 */
 
119
tSCC    zConfigfileText[] =
 
120
        "configuration file name";
 
121
tSCC    zConfigfile_NAME[]         = "CONFIGFILE";
 
122
tSCC    zConfigfile_Name[]         = "configfile";
 
123
#define CONFIGFILE_FLAGS       (OPTST_DISABLED \
 
124
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
125
 
 
126
/*
 
127
 *  Debug_Level option description:
 
128
 */
 
129
#ifdef DEBUG
 
130
tSCC    zDebug_LevelText[] =
 
131
        "Increase output debug message level";
 
132
tSCC    zDebug_Level_NAME[]        = "DEBUG_LEVEL";
 
133
tSCC    zDebug_Level_Name[]        = "debug-level";
 
134
#define DEBUG_LEVEL_FLAGS       (OPTST_DISABLED)
 
135
 
 
136
#else   /* disable Debug_Level */
 
137
#define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT
 
138
#define DEBUG_LEVEL_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
 
139
#define zDebug_LevelText       NULL
 
140
#define zDebug_Level_NAME      NULL
 
141
#define zDebug_Level_Name      NULL
 
142
#endif  /* DEBUG */
 
143
 
 
144
/*
 
145
 *  Set_Debug_Level option description:
 
146
 */
 
147
#ifdef DEBUG
 
148
tSCC    zSet_Debug_LevelText[] =
 
149
        "Set the output debug message level";
 
150
tSCC    zSet_Debug_Level_NAME[]    = "SET_DEBUG_LEVEL";
 
151
tSCC    zSet_Debug_Level_Name[]    = "set-debug-level";
 
152
#define SET_DEBUG_LEVEL_FLAGS       (OPTST_DISABLED \
 
153
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
154
 
 
155
#else   /* disable Set_Debug_Level */
 
156
#define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT
 
157
#define SET_DEBUG_LEVEL_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
 
158
#define zSet_Debug_LevelText       NULL
 
159
#define zSet_Debug_Level_NAME      NULL
 
160
#define zSet_Debug_Level_Name      NULL
 
161
#endif  /* DEBUG */
 
162
 
 
163
/*
 
164
 *  Driftfile option description:
 
165
 */
 
166
tSCC    zDriftfileText[] =
 
167
        "frequency drift file name";
 
168
tSCC    zDriftfile_NAME[]          = "DRIFTFILE";
 
169
tSCC    zDriftfile_Name[]          = "driftfile";
 
170
#define DRIFTFILE_FLAGS       (OPTST_DISABLED \
 
171
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
172
 
 
173
/*
 
174
 *  Panicgate option description:
 
175
 */
 
176
tSCC    zPanicgateText[] =
 
177
        "Allow the first adjustment to be Big";
 
178
tSCC    zPanicgate_NAME[]          = "PANICGATE";
 
179
tSCC    zPanicgate_Name[]          = "panicgate";
 
180
#define PANICGATE_FLAGS       (OPTST_DISABLED)
 
181
 
 
182
/*
 
183
 *  Jaildir option description:
 
184
 */
 
185
tSCC    zJaildirText[] =
 
186
        "Jail directory";
 
187
tSCC    zJaildir_NAME[]            = "JAILDIR";
 
188
tSCC    zJaildir_Name[]            = "jaildir";
 
189
#define JAILDIR_FLAGS       (OPTST_DISABLED \
 
190
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
191
 
 
192
/*
 
193
 *  Interface option description:
 
194
 */
 
195
tSCC    zInterfaceText[] =
 
196
        "Listen on interface";
 
197
tSCC    zInterface_NAME[]          = "INTERFACE";
 
198
tSCC    zInterface_Name[]          = "interface";
 
199
#define INTERFACE_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
200
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
201
 
 
202
/*
 
203
 *  Keyfile option description:
 
204
 */
 
205
tSCC    zKeyfileText[] =
 
206
        "path to symmetric keys";
 
207
tSCC    zKeyfile_NAME[]            = "KEYFILE";
 
208
tSCC    zKeyfile_Name[]            = "keyfile";
 
209
#define KEYFILE_FLAGS       (OPTST_DISABLED \
 
210
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
211
 
 
212
/*
 
213
 *  Logfile option description:
 
214
 */
 
215
tSCC    zLogfileText[] =
 
216
        "path to the log file";
 
217
tSCC    zLogfile_NAME[]            = "LOGFILE";
 
218
tSCC    zLogfile_Name[]            = "logfile";
 
219
#define LOGFILE_FLAGS       (OPTST_DISABLED \
 
220
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
221
 
 
222
/*
 
223
 *  Novirtualips option description:
 
224
 */
 
225
tSCC    zNovirtualipsText[] =
 
226
        "Do not listen to virtual IPs";
 
227
tSCC    zNovirtualips_NAME[]       = "NOVIRTUALIPS";
 
228
tSCC    zNovirtualips_Name[]       = "novirtualips";
 
229
#define NOVIRTUALIPS_FLAGS       (OPTST_DISABLED)
 
230
 
 
231
/*
 
232
 *  Modifymmtimer option description:
 
233
 */
 
234
#ifdef SYS_WINNT
 
235
tSCC    zModifymmtimerText[] =
 
236
        "Modify Multimedia Timer (Windows only)";
 
237
tSCC    zModifymmtimer_NAME[]      = "MODIFYMMTIMER";
 
238
tSCC    zModifymmtimer_Name[]      = "modifymmtimer";
 
239
#define MODIFYMMTIMER_FLAGS       (OPTST_DISABLED)
 
240
 
 
241
#else   /* disable Modifymmtimer */
 
242
#define VALUE_OPT_MODIFYMMTIMER NO_EQUIVALENT
 
243
#define MODIFYMMTIMER_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
 
244
#define zModifymmtimerText       NULL
 
245
#define zModifymmtimer_NAME      NULL
 
246
#define zModifymmtimer_Name      NULL
 
247
#endif  /* SYS_WINNT */
 
248
 
 
249
/*
 
250
 *  Nofork option description:
 
251
 */
 
252
tSCC    zNoforkText[] =
 
253
        "Do not fork";
 
254
tSCC    zNofork_NAME[]             = "NOFORK";
 
255
tSCC    zNofork_Name[]             = "nofork";
 
256
#define NOFORK_FLAGS       (OPTST_DISABLED)
 
257
 
 
258
/*
 
259
 *  Nice option description:
 
260
 */
 
261
tSCC    zNiceText[] =
 
262
        "Run at high priority";
 
263
tSCC    zNice_NAME[]               = "NICE";
 
264
tSCC    zNice_Name[]               = "nice";
 
265
#define NICE_FLAGS       (OPTST_DISABLED)
 
266
 
 
267
/*
 
268
 *  Pidfile option description:
 
269
 */
 
270
tSCC    zPidfileText[] =
 
271
        "path to the PID file";
 
272
tSCC    zPidfile_NAME[]            = "PIDFILE";
 
273
tSCC    zPidfile_Name[]            = "pidfile";
 
274
#define PIDFILE_FLAGS       (OPTST_DISABLED \
 
275
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
276
 
 
277
/*
 
278
 *  Priority option description:
 
279
 */
 
280
tSCC    zPriorityText[] =
 
281
        "Process priority";
 
282
tSCC    zPriority_NAME[]           = "PRIORITY";
 
283
tSCC    zPriority_Name[]           = "priority";
 
284
#define PRIORITY_FLAGS       (OPTST_DISABLED \
 
285
        | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
 
286
 
 
287
/*
 
288
 *  Quit option description:
 
289
 */
 
290
tSCC    zQuitText[] =
 
291
        "Set the time and quit";
 
292
tSCC    zQuit_NAME[]               = "QUIT";
 
293
tSCC    zQuit_Name[]               = "quit";
 
294
#define QUIT_FLAGS       (OPTST_DISABLED)
 
295
 
 
296
/*
 
297
 *  Propagationdelay option description:
 
298
 */
 
299
tSCC    zPropagationdelayText[] =
 
300
        "Broadcast/propagation delay";
 
301
tSCC    zPropagationdelay_NAME[]   = "PROPAGATIONDELAY";
 
302
tSCC    zPropagationdelay_Name[]   = "propagationdelay";
 
303
#define PROPAGATIONDELAY_FLAGS       (OPTST_DISABLED \
 
304
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
305
 
 
306
/*
 
307
 *  Updateinterval option description:
 
308
 */
 
309
tSCC    zUpdateintervalText[] =
 
310
        "interval in seconds between scans for new or dropped interfaces";
 
311
tSCC    zUpdateinterval_NAME[]     = "UPDATEINTERVAL";
 
312
tSCC    zUpdateinterval_Name[]     = "updateinterval";
 
313
#define UPDATEINTERVAL_FLAGS       (OPTST_DISABLED \
 
314
        | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
 
315
 
 
316
/*
 
317
 *  Statsdir option description:
 
318
 */
 
319
tSCC    zStatsdirText[] =
 
320
        "Statistics file location";
 
321
tSCC    zStatsdir_NAME[]           = "STATSDIR";
 
322
tSCC    zStatsdir_Name[]           = "statsdir";
 
323
#define STATSDIR_FLAGS       (OPTST_DISABLED \
 
324
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
325
 
 
326
/*
 
327
 *  Trustedkey option description:
 
328
 */
 
329
tSCC    zTrustedkeyText[] =
 
330
        "Trusted key number";
 
331
tSCC    zTrustedkey_NAME[]         = "TRUSTEDKEY";
 
332
tSCC    zTrustedkey_Name[]         = "trustedkey";
 
333
#define TRUSTEDKEY_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
334
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
335
 
 
336
/*
 
337
 *  User option description:
 
338
 */
 
339
tSCC    zUserText[] =
 
340
        "Run as userid (or userid:groupid)";
 
341
tSCC    zUser_NAME[]               = "USER";
 
342
tSCC    zUser_Name[]               = "user";
 
343
#define USER_FLAGS       (OPTST_DISABLED \
 
344
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
345
 
 
346
/*
 
347
 *  Var option description:
 
348
 */
 
349
tSCC    zVarText[] =
 
350
        "make ARG an ntp variable (RW)";
 
351
tSCC    zVar_NAME[]                = "VAR";
 
352
tSCC    zVar_Name[]                = "var";
 
353
#define VAR_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
354
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
355
 
 
356
/*
 
357
 *  Dvar option description:
 
358
 */
 
359
tSCC    zDvarText[] =
 
360
        "make ARG an ntp variable (RW|DEF)";
 
361
tSCC    zDvar_NAME[]               = "DVAR";
 
362
tSCC    zDvar_Name[]               = "dvar";
 
363
#define DVAR_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
364
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
365
 
 
366
/*
 
367
 *  Slew option description:
 
368
 */
 
369
tSCC    zSlewText[] =
 
370
        "Slew up to 600 seconds";
 
371
tSCC    zSlew_NAME[]               = "SLEW";
 
372
tSCC    zSlew_Name[]               = "slew";
 
373
#define SLEW_FLAGS       (OPTST_DISABLED)
 
374
 
 
375
/*
 
376
 *  Help/More_Help/Version option descriptions:
 
377
 */
 
378
tSCC zHelpText[]       = "Display usage information and exit";
 
379
tSCC zHelp_Name[]      = "help";
 
380
 
 
381
tSCC zMore_HelpText[]  = "Extended usage information passed thru pager";
 
382
tSCC zMore_Help_Name[] = "more-help";
 
383
 
 
384
tSCC zVersionText[]    = "Output version information and exit";
 
385
tSCC zVersion_Name[]   = "version";
 
386
/*
 
387
 *  Declare option callback procedures
 
388
 */
 
389
#ifdef DEBUG
 
390
  static tOptProc doOptSet_Debug_Level;
 
391
#else /* not DEBUG */
 
392
# define doOptSet_Debug_Level NULL
 
393
#endif /* def/not DEBUG */
 
394
#if defined(TEST_NTPD_OPTS)
 
395
/*
 
396
 *  Under test, omit argument processing, or call optionStackArg,
 
397
 *  if multiple copies are allowed.
 
398
 */
 
399
extern tOptProc
 
400
    optionNumericVal,    optionPagedUsage,    optionStackArg,
 
401
    optionVersionStderr;
 
402
static tOptProc
 
403
    doUsageOpt;
 
404
 
 
405
/*
 
406
 *  #define map the "normal" callout procs to the test ones...
 
407
 */
 
408
#define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
 
409
 
 
410
 
 
411
#else /* NOT defined TEST_NTPD_OPTS */
 
412
/*
 
413
 *  When not under test, there are different procs to use
 
414
 */
 
415
extern tOptProc
 
416
    optionNumericVal, optionPagedUsage, optionPrintVersion, optionStackArg;
 
417
static tOptProc
 
418
    doUsageOpt;
 
419
 
 
420
/*
 
421
 *  #define map the "normal" callout procs
 
422
 */
 
423
#define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
 
424
 
 
425
#define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
 
426
#endif /* defined(TEST_NTPD_OPTS) */
 
427
#ifdef TEST_NTPD_OPTS
 
428
# define DOVERPROC optionVersionStderr
 
429
#else
 
430
# define DOVERPROC optionPrintVersion
 
431
#endif /* TEST_NTPD_OPTS */
 
432
 
 
433
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
434
 *
 
435
 *  Define the Ntpd Option Descriptions.
 
436
 */
 
437
static tOptDesc optDesc[ OPTION_CT ] = {
 
438
  {  /* entry idx, value */ 0, VALUE_OPT_IPV4,
 
439
     /* equiv idx, value */ NO_EQUIVALENT, 0,
 
440
     /* equivalenced to  */ NO_EQUIVALENT,
 
441
     /* min, max, act ct */ 0, 1, 0,
 
442
     /* opt state flags  */ IPV4_FLAGS, 0,
 
443
     /* last opt argumnt */ { NULL },
 
444
     /* arg list/cookie  */ NULL,
 
445
     /* must/cannot opts */ NULL, NULL,
 
446
     /* option proc      */ NULL,
 
447
     /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name,
 
448
     /* disablement strs */ NULL, NULL },
 
449
 
 
450
  {  /* entry idx, value */ 1, VALUE_OPT_IPV6,
 
451
     /* equiv idx, value */ NOLIMIT, NOLIMIT,
 
452
     /* equivalenced to  */ INDEX_OPT_IPV4,
 
453
     /* min, max, act ct */ 0, 1, 0,
 
454
     /* opt state flags  */ IPV6_FLAGS, 0,
 
455
     /* last opt argumnt */ { NULL },
 
456
     /* arg list/cookie  */ NULL,
 
457
     /* must/cannot opts */ NULL, NULL,
 
458
     /* option proc      */ NULL,
 
459
     /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name,
 
460
     /* disablement strs */ NULL, NULL },
 
461
 
 
462
  {  /* entry idx, value */ 2, VALUE_OPT_AUTHREQ,
 
463
     /* equiv idx, value */ 2, VALUE_OPT_AUTHREQ,
 
464
     /* equivalenced to  */ NO_EQUIVALENT,
 
465
     /* min, max, act ct */ 0, 1, 0,
 
466
     /* opt state flags  */ AUTHREQ_FLAGS, 0,
 
467
     /* last opt argumnt */ { NULL },
 
468
     /* arg list/cookie  */ NULL,
 
469
     /* must/cannot opts */ NULL, aAuthreqCantList,
 
470
     /* option proc      */ NULL,
 
471
     /* desc, NAME, name */ zAuthreqText, zAuthreq_NAME, zAuthreq_Name,
 
472
     /* disablement strs */ NULL, NULL },
 
473
 
 
474
  {  /* entry idx, value */ 3, VALUE_OPT_AUTHNOREQ,
 
475
     /* equiv idx, value */ 3, VALUE_OPT_AUTHNOREQ,
 
476
     /* equivalenced to  */ NO_EQUIVALENT,
 
477
     /* min, max, act ct */ 0, 1, 0,
 
478
     /* opt state flags  */ AUTHNOREQ_FLAGS, 0,
 
479
     /* last opt argumnt */ { NULL },
 
480
     /* arg list/cookie  */ NULL,
 
481
     /* must/cannot opts */ NULL, aAuthnoreqCantList,
 
482
     /* option proc      */ NULL,
 
483
     /* desc, NAME, name */ zAuthnoreqText, zAuthnoreq_NAME, zAuthnoreq_Name,
 
484
     /* disablement strs */ NULL, NULL },
 
485
 
 
486
  {  /* entry idx, value */ 4, VALUE_OPT_BCASTSYNC,
 
487
     /* equiv idx, value */ 4, VALUE_OPT_BCASTSYNC,
 
488
     /* equivalenced to  */ NO_EQUIVALENT,
 
489
     /* min, max, act ct */ 0, 1, 0,
 
490
     /* opt state flags  */ BCASTSYNC_FLAGS, 0,
 
491
     /* last opt argumnt */ { NULL },
 
492
     /* arg list/cookie  */ NULL,
 
493
     /* must/cannot opts */ NULL, NULL,
 
494
     /* option proc      */ NULL,
 
495
     /* desc, NAME, name */ zBcastsyncText, zBcastsync_NAME, zBcastsync_Name,
 
496
     /* disablement strs */ NULL, NULL },
 
497
 
 
498
  {  /* entry idx, value */ 5, VALUE_OPT_CONFIGFILE,
 
499
     /* equiv idx, value */ 5, VALUE_OPT_CONFIGFILE,
 
500
     /* equivalenced to  */ NO_EQUIVALENT,
 
501
     /* min, max, act ct */ 0, 1, 0,
 
502
     /* opt state flags  */ CONFIGFILE_FLAGS, 0,
 
503
     /* last opt argumnt */ { NULL },
 
504
     /* arg list/cookie  */ NULL,
 
505
     /* must/cannot opts */ NULL, NULL,
 
506
     /* option proc      */ NULL,
 
507
     /* desc, NAME, name */ zConfigfileText, zConfigfile_NAME, zConfigfile_Name,
 
508
     /* disablement strs */ NULL, NULL },
 
509
 
 
510
  {  /* entry idx, value */ 6, VALUE_OPT_DEBUG_LEVEL,
 
511
     /* equiv idx, value */ 6, VALUE_OPT_DEBUG_LEVEL,
 
512
     /* equivalenced to  */ NO_EQUIVALENT,
 
513
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
514
     /* opt state flags  */ DEBUG_LEVEL_FLAGS, 0,
 
515
     /* last opt argumnt */ { NULL },
 
516
     /* arg list/cookie  */ NULL,
 
517
     /* must/cannot opts */ NULL, NULL,
 
518
     /* option proc      */ NULL,
 
519
     /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name,
 
520
     /* disablement strs */ NULL, NULL },
 
521
 
 
522
  {  /* entry idx, value */ 7, VALUE_OPT_SET_DEBUG_LEVEL,
 
523
     /* equiv idx, value */ 7, VALUE_OPT_SET_DEBUG_LEVEL,
 
524
     /* equivalenced to  */ NO_EQUIVALENT,
 
525
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
526
     /* opt state flags  */ SET_DEBUG_LEVEL_FLAGS, 0,
 
527
     /* last opt argumnt */ { NULL },
 
528
     /* arg list/cookie  */ NULL,
 
529
     /* must/cannot opts */ NULL, NULL,
 
530
     /* option proc      */ SET_DEBUG_LEVEL_OPT_PROC,
 
531
     /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name,
 
532
     /* disablement strs */ NULL, NULL },
 
533
 
 
534
  {  /* entry idx, value */ 8, VALUE_OPT_DRIFTFILE,
 
535
     /* equiv idx, value */ 8, VALUE_OPT_DRIFTFILE,
 
536
     /* equivalenced to  */ NO_EQUIVALENT,
 
537
     /* min, max, act ct */ 0, 1, 0,
 
538
     /* opt state flags  */ DRIFTFILE_FLAGS, 0,
 
539
     /* last opt argumnt */ { NULL },
 
540
     /* arg list/cookie  */ NULL,
 
541
     /* must/cannot opts */ NULL, NULL,
 
542
     /* option proc      */ NULL,
 
543
     /* desc, NAME, name */ zDriftfileText, zDriftfile_NAME, zDriftfile_Name,
 
544
     /* disablement strs */ NULL, NULL },
 
545
 
 
546
  {  /* entry idx, value */ 9, VALUE_OPT_PANICGATE,
 
547
     /* equiv idx, value */ 9, VALUE_OPT_PANICGATE,
 
548
     /* equivalenced to  */ NO_EQUIVALENT,
 
549
     /* min, max, act ct */ 0, 1, 0,
 
550
     /* opt state flags  */ PANICGATE_FLAGS, 0,
 
551
     /* last opt argumnt */ { NULL },
 
552
     /* arg list/cookie  */ NULL,
 
553
     /* must/cannot opts */ NULL, NULL,
 
554
     /* option proc      */ NULL,
 
555
     /* desc, NAME, name */ zPanicgateText, zPanicgate_NAME, zPanicgate_Name,
 
556
     /* disablement strs */ NULL, NULL },
 
557
 
 
558
  {  /* entry idx, value */ 10, VALUE_OPT_JAILDIR,
 
559
     /* equiv idx, value */ 10, VALUE_OPT_JAILDIR,
 
560
     /* equivalenced to  */ NO_EQUIVALENT,
 
561
     /* min, max, act ct */ 0, 1, 0,
 
562
     /* opt state flags  */ JAILDIR_FLAGS, 0,
 
563
     /* last opt argumnt */ { NULL },
 
564
     /* arg list/cookie  */ NULL,
 
565
     /* must/cannot opts */ NULL, NULL,
 
566
     /* option proc      */ NULL,
 
567
     /* desc, NAME, name */ zJaildirText, zJaildir_NAME, zJaildir_Name,
 
568
     /* disablement strs */ NULL, NULL },
 
569
 
 
570
  {  /* entry idx, value */ 11, VALUE_OPT_INTERFACE,
 
571
     /* equiv idx, value */ 11, VALUE_OPT_INTERFACE,
 
572
     /* equivalenced to  */ NO_EQUIVALENT,
 
573
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
574
     /* opt state flags  */ INTERFACE_FLAGS, 0,
 
575
     /* last opt argumnt */ { NULL },
 
576
     /* arg list/cookie  */ NULL,
 
577
     /* must/cannot opts */ NULL, NULL,
 
578
     /* option proc      */ optionStackArg,
 
579
     /* desc, NAME, name */ zInterfaceText, zInterface_NAME, zInterface_Name,
 
580
     /* disablement strs */ NULL, NULL },
 
581
 
 
582
  {  /* entry idx, value */ 12, VALUE_OPT_KEYFILE,
 
583
     /* equiv idx, value */ 12, VALUE_OPT_KEYFILE,
 
584
     /* equivalenced to  */ NO_EQUIVALENT,
 
585
     /* min, max, act ct */ 0, 1, 0,
 
586
     /* opt state flags  */ KEYFILE_FLAGS, 0,
 
587
     /* last opt argumnt */ { NULL },
 
588
     /* arg list/cookie  */ NULL,
 
589
     /* must/cannot opts */ NULL, NULL,
 
590
     /* option proc      */ NULL,
 
591
     /* desc, NAME, name */ zKeyfileText, zKeyfile_NAME, zKeyfile_Name,
 
592
     /* disablement strs */ NULL, NULL },
 
593
 
 
594
  {  /* entry idx, value */ 13, VALUE_OPT_LOGFILE,
 
595
     /* equiv idx, value */ 13, VALUE_OPT_LOGFILE,
 
596
     /* equivalenced to  */ NO_EQUIVALENT,
 
597
     /* min, max, act ct */ 0, 1, 0,
 
598
     /* opt state flags  */ LOGFILE_FLAGS, 0,
 
599
     /* last opt argumnt */ { NULL },
 
600
     /* arg list/cookie  */ NULL,
 
601
     /* must/cannot opts */ NULL, NULL,
 
602
     /* option proc      */ NULL,
 
603
     /* desc, NAME, name */ zLogfileText, zLogfile_NAME, zLogfile_Name,
 
604
     /* disablement strs */ NULL, NULL },
 
605
 
 
606
  {  /* entry idx, value */ 14, VALUE_OPT_NOVIRTUALIPS,
 
607
     /* equiv idx, value */ 14, VALUE_OPT_NOVIRTUALIPS,
 
608
     /* equivalenced to  */ NO_EQUIVALENT,
 
609
     /* min, max, act ct */ 0, 1, 0,
 
610
     /* opt state flags  */ NOVIRTUALIPS_FLAGS, 0,
 
611
     /* last opt argumnt */ { NULL },
 
612
     /* arg list/cookie  */ NULL,
 
613
     /* must/cannot opts */ NULL, NULL,
 
614
     /* option proc      */ NULL,
 
615
     /* desc, NAME, name */ zNovirtualipsText, zNovirtualips_NAME, zNovirtualips_Name,
 
616
     /* disablement strs */ NULL, NULL },
 
617
 
 
618
  {  /* entry idx, value */ 15, VALUE_OPT_MODIFYMMTIMER,
 
619
     /* equiv idx, value */ 15, VALUE_OPT_MODIFYMMTIMER,
 
620
     /* equivalenced to  */ NO_EQUIVALENT,
 
621
     /* min, max, act ct */ 0, 1, 0,
 
622
     /* opt state flags  */ MODIFYMMTIMER_FLAGS, 0,
 
623
     /* last opt argumnt */ { NULL },
 
624
     /* arg list/cookie  */ NULL,
 
625
     /* must/cannot opts */ NULL, NULL,
 
626
     /* option proc      */ NULL,
 
627
     /* desc, NAME, name */ zModifymmtimerText, zModifymmtimer_NAME, zModifymmtimer_Name,
 
628
     /* disablement strs */ NULL, NULL },
 
629
 
 
630
  {  /* entry idx, value */ 16, VALUE_OPT_NOFORK,
 
631
     /* equiv idx, value */ 16, VALUE_OPT_NOFORK,
 
632
     /* equivalenced to  */ NO_EQUIVALENT,
 
633
     /* min, max, act ct */ 0, 1, 0,
 
634
     /* opt state flags  */ NOFORK_FLAGS, 0,
 
635
     /* last opt argumnt */ { NULL },
 
636
     /* arg list/cookie  */ NULL,
 
637
     /* must/cannot opts */ NULL, NULL,
 
638
     /* option proc      */ NULL,
 
639
     /* desc, NAME, name */ zNoforkText, zNofork_NAME, zNofork_Name,
 
640
     /* disablement strs */ NULL, NULL },
 
641
 
 
642
  {  /* entry idx, value */ 17, VALUE_OPT_NICE,
 
643
     /* equiv idx, value */ 17, VALUE_OPT_NICE,
 
644
     /* equivalenced to  */ NO_EQUIVALENT,
 
645
     /* min, max, act ct */ 0, 1, 0,
 
646
     /* opt state flags  */ NICE_FLAGS, 0,
 
647
     /* last opt argumnt */ { NULL },
 
648
     /* arg list/cookie  */ NULL,
 
649
     /* must/cannot opts */ NULL, NULL,
 
650
     /* option proc      */ NULL,
 
651
     /* desc, NAME, name */ zNiceText, zNice_NAME, zNice_Name,
 
652
     /* disablement strs */ NULL, NULL },
 
653
 
 
654
  {  /* entry idx, value */ 18, VALUE_OPT_PIDFILE,
 
655
     /* equiv idx, value */ 18, VALUE_OPT_PIDFILE,
 
656
     /* equivalenced to  */ NO_EQUIVALENT,
 
657
     /* min, max, act ct */ 0, 1, 0,
 
658
     /* opt state flags  */ PIDFILE_FLAGS, 0,
 
659
     /* last opt argumnt */ { NULL },
 
660
     /* arg list/cookie  */ NULL,
 
661
     /* must/cannot opts */ NULL, NULL,
 
662
     /* option proc      */ NULL,
 
663
     /* desc, NAME, name */ zPidfileText, zPidfile_NAME, zPidfile_Name,
 
664
     /* disablement strs */ NULL, NULL },
 
665
 
 
666
  {  /* entry idx, value */ 19, VALUE_OPT_PRIORITY,
 
667
     /* equiv idx, value */ 19, VALUE_OPT_PRIORITY,
 
668
     /* equivalenced to  */ NO_EQUIVALENT,
 
669
     /* min, max, act ct */ 0, 1, 0,
 
670
     /* opt state flags  */ PRIORITY_FLAGS, 0,
 
671
     /* last opt argumnt */ { NULL },
 
672
     /* arg list/cookie  */ NULL,
 
673
     /* must/cannot opts */ NULL, NULL,
 
674
     /* option proc      */ optionNumericVal,
 
675
     /* desc, NAME, name */ zPriorityText, zPriority_NAME, zPriority_Name,
 
676
     /* disablement strs */ NULL, NULL },
 
677
 
 
678
  {  /* entry idx, value */ 20, VALUE_OPT_QUIT,
 
679
     /* equiv idx, value */ 20, VALUE_OPT_QUIT,
 
680
     /* equivalenced to  */ NO_EQUIVALENT,
 
681
     /* min, max, act ct */ 0, 1, 0,
 
682
     /* opt state flags  */ QUIT_FLAGS, 0,
 
683
     /* last opt argumnt */ { NULL },
 
684
     /* arg list/cookie  */ NULL,
 
685
     /* must/cannot opts */ NULL, NULL,
 
686
     /* option proc      */ NULL,
 
687
     /* desc, NAME, name */ zQuitText, zQuit_NAME, zQuit_Name,
 
688
     /* disablement strs */ NULL, NULL },
 
689
 
 
690
  {  /* entry idx, value */ 21, VALUE_OPT_PROPAGATIONDELAY,
 
691
     /* equiv idx, value */ 21, VALUE_OPT_PROPAGATIONDELAY,
 
692
     /* equivalenced to  */ NO_EQUIVALENT,
 
693
     /* min, max, act ct */ 0, 1, 0,
 
694
     /* opt state flags  */ PROPAGATIONDELAY_FLAGS, 0,
 
695
     /* last opt argumnt */ { NULL },
 
696
     /* arg list/cookie  */ NULL,
 
697
     /* must/cannot opts */ NULL, NULL,
 
698
     /* option proc      */ NULL,
 
699
     /* desc, NAME, name */ zPropagationdelayText, zPropagationdelay_NAME, zPropagationdelay_Name,
 
700
     /* disablement strs */ NULL, NULL },
 
701
 
 
702
  {  /* entry idx, value */ 22, VALUE_OPT_UPDATEINTERVAL,
 
703
     /* equiv idx, value */ 22, VALUE_OPT_UPDATEINTERVAL,
 
704
     /* equivalenced to  */ NO_EQUIVALENT,
 
705
     /* min, max, act ct */ 0, 1, 0,
 
706
     /* opt state flags  */ UPDATEINTERVAL_FLAGS, 0,
 
707
     /* last opt argumnt */ { NULL },
 
708
     /* arg list/cookie  */ NULL,
 
709
     /* must/cannot opts */ NULL, NULL,
 
710
     /* option proc      */ optionNumericVal,
 
711
     /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name,
 
712
     /* disablement strs */ NULL, NULL },
 
713
 
 
714
  {  /* entry idx, value */ 23, VALUE_OPT_STATSDIR,
 
715
     /* equiv idx, value */ 23, VALUE_OPT_STATSDIR,
 
716
     /* equivalenced to  */ NO_EQUIVALENT,
 
717
     /* min, max, act ct */ 0, 1, 0,
 
718
     /* opt state flags  */ STATSDIR_FLAGS, 0,
 
719
     /* last opt argumnt */ { NULL },
 
720
     /* arg list/cookie  */ NULL,
 
721
     /* must/cannot opts */ NULL, NULL,
 
722
     /* option proc      */ NULL,
 
723
     /* desc, NAME, name */ zStatsdirText, zStatsdir_NAME, zStatsdir_Name,
 
724
     /* disablement strs */ NULL, NULL },
 
725
 
 
726
  {  /* entry idx, value */ 24, VALUE_OPT_TRUSTEDKEY,
 
727
     /* equiv idx, value */ 24, VALUE_OPT_TRUSTEDKEY,
 
728
     /* equivalenced to  */ NO_EQUIVALENT,
 
729
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
730
     /* opt state flags  */ TRUSTEDKEY_FLAGS, 0,
 
731
     /* last opt argumnt */ { NULL },
 
732
     /* arg list/cookie  */ NULL,
 
733
     /* must/cannot opts */ NULL, NULL,
 
734
     /* option proc      */ optionStackArg,
 
735
     /* desc, NAME, name */ zTrustedkeyText, zTrustedkey_NAME, zTrustedkey_Name,
 
736
     /* disablement strs */ NULL, NULL },
 
737
 
 
738
  {  /* entry idx, value */ 25, VALUE_OPT_USER,
 
739
     /* equiv idx, value */ 25, VALUE_OPT_USER,
 
740
     /* equivalenced to  */ NO_EQUIVALENT,
 
741
     /* min, max, act ct */ 0, 1, 0,
 
742
     /* opt state flags  */ USER_FLAGS, 0,
 
743
     /* last opt argumnt */ { NULL },
 
744
     /* arg list/cookie  */ NULL,
 
745
     /* must/cannot opts */ NULL, NULL,
 
746
     /* option proc      */ NULL,
 
747
     /* desc, NAME, name */ zUserText, zUser_NAME, zUser_Name,
 
748
     /* disablement strs */ NULL, NULL },
 
749
 
 
750
  {  /* entry idx, value */ 26, VALUE_OPT_VAR,
 
751
     /* equiv idx, value */ 26, VALUE_OPT_VAR,
 
752
     /* equivalenced to  */ NO_EQUIVALENT,
 
753
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
754
     /* opt state flags  */ VAR_FLAGS, 0,
 
755
     /* last opt argumnt */ { NULL },
 
756
     /* arg list/cookie  */ NULL,
 
757
     /* must/cannot opts */ NULL, NULL,
 
758
     /* option proc      */ optionStackArg,
 
759
     /* desc, NAME, name */ zVarText, zVar_NAME, zVar_Name,
 
760
     /* disablement strs */ NULL, NULL },
 
761
 
 
762
  {  /* entry idx, value */ 27, VALUE_OPT_DVAR,
 
763
     /* equiv idx, value */ 27, VALUE_OPT_DVAR,
 
764
     /* equivalenced to  */ NO_EQUIVALENT,
 
765
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
766
     /* opt state flags  */ DVAR_FLAGS, 0,
 
767
     /* last opt argumnt */ { NULL },
 
768
     /* arg list/cookie  */ NULL,
 
769
     /* must/cannot opts */ NULL, NULL,
 
770
     /* option proc      */ optionStackArg,
 
771
     /* desc, NAME, name */ zDvarText, zDvar_NAME, zDvar_Name,
 
772
     /* disablement strs */ NULL, NULL },
 
773
 
 
774
  {  /* entry idx, value */ 28, VALUE_OPT_SLEW,
 
775
     /* equiv idx, value */ 28, VALUE_OPT_SLEW,
 
776
     /* equivalenced to  */ NO_EQUIVALENT,
 
777
     /* min, max, act ct */ 0, 1, 0,
 
778
     /* opt state flags  */ SLEW_FLAGS, 0,
 
779
     /* last opt argumnt */ { NULL },
 
780
     /* arg list/cookie  */ NULL,
 
781
     /* must/cannot opts */ NULL, NULL,
 
782
     /* option proc      */ NULL,
 
783
     /* desc, NAME, name */ zSlewText, zSlew_NAME, zSlew_Name,
 
784
     /* disablement strs */ NULL, NULL },
 
785
 
 
786
#ifdef NO_OPTIONAL_OPT_ARGS
 
787
#  define VERSION_OPT_FLAGS     OPTST_IMM | OPTST_NO_INIT
 
788
#else
 
789
#  define VERSION_OPT_FLAGS     OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
 
790
                                OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
 
791
#endif
 
792
 
 
793
  {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
 
794
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
795
     /* equivalenced to  */ NO_EQUIVALENT,
 
796
     /* min, max, act ct */ 0, 1, 0,
 
797
     /* opt state flags  */ VERSION_OPT_FLAGS, 0,
 
798
     /* last opt argumnt */ { NULL },
 
799
     /* arg list/cookie  */ NULL,
 
800
     /* must/cannot opts */ NULL, NULL,
 
801
     /* option proc      */ DOVERPROC,
 
802
     /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
 
803
     /* disablement strs */ NULL, NULL },
 
804
 
 
805
#undef VERSION_OPT_FLAGS
 
806
 
 
807
 
 
808
  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
 
809
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
810
     /* equivalenced to  */ NO_EQUIVALENT,
 
811
     /* min, max, act ct */ 0, 1, 0,
 
812
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
 
813
     /* last opt argumnt */ { NULL },
 
814
     /* arg list/cookie  */ NULL,
 
815
     /* must/cannot opts */ NULL, NULL,
 
816
     /* option proc      */ doUsageOpt,
 
817
     /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
 
818
     /* disablement strs */ NULL, NULL },
 
819
 
 
820
  {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
 
821
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
822
     /* equivalenced to  */ NO_EQUIVALENT,
 
823
     /* min, max, act ct */ 0, 1, 0,
 
824
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
 
825
     /* last opt argumnt */ { NULL },
 
826
     /* arg list/cookie  */ NULL,
 
827
     /* must/cannot opts */ NULL,  NULL,
 
828
     /* option proc      */ optionPagedUsage,
 
829
     /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
 
830
     /* disablement strs */ NULL, NULL }
 
831
};
 
832
 
 
833
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
834
 *
 
835
 *  Define the Ntpd Option Environment
 
836
 */
 
837
tSCC   zPROGNAME[]   = "NTPD";
 
838
tSCC   zUsageTitle[] =
 
839
"ntpd - NTP daemon program - Ver. 4.2.4p4\n\
 
840
USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
 
841
#define zRcName     NULL
 
842
#define apzHomeList NULL
 
843
 
 
844
tSCC   zBugsAddr[]    = "http://bugs.ntp.isc.org, bugs@ntp.org";
 
845
#define zExplain NULL
 
846
tSCC    zDetail[]     = "\n\n";
 
847
tSCC    zFullVersion[] = NTPD_FULL_VERSION;
 
848
/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */
 
849
 
 
850
#if defined(ENABLE_NLS)
 
851
# define OPTPROC_BASE OPTPROC_TRANSLATE
 
852
  static tOptionXlateProc translate_option_strings;
 
853
#else
 
854
# define OPTPROC_BASE OPTPROC_NONE
 
855
# define translate_option_strings NULL
 
856
#endif /* ENABLE_NLS */
 
857
 
 
858
tOptions ntpdOptions = {
 
859
    OPTIONS_STRUCT_VERSION,
 
860
    0, NULL,                    /* original argc + argv    */
 
861
    ( OPTPROC_BASE
 
862
    + OPTPROC_ERRSTOP
 
863
    + OPTPROC_SHORTOPT
 
864
    + OPTPROC_LONGOPT
 
865
    + OPTPROC_NO_REQ_OPT
 
866
    + OPTPROC_ENVIRON
 
867
    + OPTPROC_NO_ARGS ),
 
868
    0, NULL,                    /* current option index, current option */
 
869
    NULL,         NULL,         zPROGNAME,
 
870
    zRcName,      zCopyright,   zCopyrightNotice,
 
871
    zFullVersion, apzHomeList,  zUsageTitle,
 
872
    zExplain,     zDetail,      optDesc,
 
873
    zBugsAddr,                  /* address to send bugs to */
 
874
    NULL, NULL,                 /* extensions/saved state  */
 
875
    optionUsage,       /* usage procedure */
 
876
    translate_option_strings,   /* translation procedure */
 
877
    /*
 
878
     *  Indexes to special options
 
879
     */
 
880
    { INDEX_OPT_MORE_HELP,
 
881
       0 /* no option state saving */,
 
882
      NO_EQUIVALENT /* index of '-#' option */,
 
883
      NO_EQUIVALENT /* index of default opt */
 
884
    },
 
885
    32 /* full option count */, 29 /* user option count */
 
886
};
 
887
 
 
888
/*
 
889
 *  Create the static procedure(s) declared above.
 
890
 */
 
891
static void
 
892
doUsageOpt(
 
893
    tOptions*   pOptions,
 
894
    tOptDesc*   pOptDesc )
 
895
{
 
896
    USAGE( EXIT_SUCCESS );
 
897
}
 
898
 
 
899
#if ! defined(TEST_NTPD_OPTS)
 
900
 
 
901
/* * * * * * *
 
902
 *
 
903
 *   For the set-debug-level option, when DEBUG is #define-d.
 
904
 */
 
905
#ifdef DEBUG
 
906
static void
 
907
doOptSet_Debug_Level(
 
908
    tOptions*   pOptions,
 
909
    tOptDesc*   pOptDesc )
 
910
{
 
911
    /* extracted from ../include/debug-opt.def, line 29 */
 
912
DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
 
913
}
 
914
#endif /* defined DEBUG */
 
915
 
 
916
#endif /* defined(TEST_NTPD_OPTS) */
 
917
 
 
918
/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */
 
919
 
 
920
#if defined(TEST_NTPD_OPTS) /* TEST MAIN PROCEDURE: */
 
921
 
 
922
int
 
923
main( int argc, char** argv )
 
924
{
 
925
    int res = EXIT_SUCCESS;
 
926
    (void)optionProcess( &ntpdOptions, argc, argv );
 
927
    {
 
928
        void optionPutShell( tOptions* );
 
929
        optionPutShell( &ntpdOptions );
 
930
    }
 
931
    return res;
 
932
}
 
933
#endif  /* defined TEST_NTPD_OPTS */
 
934
/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */
 
935
 
 
936
#if ENABLE_NLS
 
937
#include <stdio.h>
 
938
#include <stdlib.h>
 
939
#include <string.h>
 
940
#include <unistd.h>
 
941
#include <autoopts/usage-txt.h>
 
942
 
 
943
static char* AO_gettext( char const* pz );
 
944
static void  coerce_it(void** s);
 
945
 
 
946
static char*
 
947
AO_gettext( char const* pz )
 
948
{
 
949
    char* pzRes;
 
950
    if (pz == NULL)
 
951
        return NULL;
 
952
    pzRes = _(pz);
 
953
    if (pzRes == pz)
 
954
        return pzRes;
 
955
    pzRes = strdup( pzRes );
 
956
    if (pzRes == NULL) {
 
957
        fputs( _("No memory for duping translated strings\n"), stderr );
 
958
        exit( EXIT_FAILURE );
 
959
    }
 
960
    return pzRes;
 
961
}
 
962
 
 
963
static void coerce_it(void** s) { *s = AO_gettext(*s); }
 
964
#define COERSION(_f) \
 
965
  coerce_it((void*)&(ntpdOptions._f))
 
966
 
 
967
/*
 
968
 *  This invokes the translation code (e.g. gettext(3)).
 
969
 */
 
970
static void
 
971
translate_option_strings( void )
 
972
{
 
973
    /*
 
974
     *  Guard against re-translation.  It won't work.  The strings will have
 
975
     *  been changed by the first pass through this code.  One shot only.
 
976
     */
 
977
    if (option_usage_text.field_ct == 0)
 
978
        return;
 
979
    /*
 
980
     *  Do the translations.  The first pointer follows the field count field.
 
981
     *  The field count field is the size of a pointer.
 
982
     */
 
983
    {
 
984
        char** ppz = (char**)(void*)&(option_usage_text);
 
985
        int    ix  = option_usage_text.field_ct;
 
986
 
 
987
        do {
 
988
            ppz++;
 
989
            *ppz = AO_gettext(*ppz);
 
990
        } while (--ix > 0);
 
991
    }
 
992
    option_usage_text.field_ct = 0;
 
993
 
 
994
    {
 
995
        tOptDesc* pOD = ntpdOptions.pOptDesc;
 
996
        int       ix  = ntpdOptions.optCt;
 
997
 
 
998
        for (;;) {
 
999
            pOD->pzText           = AO_gettext(pOD->pzText);
 
1000
            pOD->pz_NAME          = AO_gettext(pOD->pz_NAME);
 
1001
            pOD->pz_Name          = AO_gettext(pOD->pz_Name);
 
1002
            pOD->pz_DisableName   = AO_gettext(pOD->pz_DisableName);
 
1003
            pOD->pz_DisablePfx    = AO_gettext(pOD->pz_DisablePfx);
 
1004
            if (--ix <= 0)
 
1005
                break;
 
1006
            pOD++;
 
1007
        }
 
1008
    }
 
1009
    COERSION(pzCopyright);
 
1010
    COERSION(pzCopyNotice);
 
1011
    COERSION(pzFullVersion);
 
1012
    COERSION(pzUsageTitle);
 
1013
    COERSION(pzExplain);
 
1014
    COERSION(pzDetail);
 
1015
}
 
1016
 
 
1017
#endif /* ENABLE_NLS */
 
1018
 
 
1019
#ifdef  __cplusplus
 
1020
}
 
1021
#endif
 
1022
/* ntpd-opts.c ends here */