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

« back to all changes in this revision

Viewing changes to ntpd/ntpdsim-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   (ntpdsim-opts.c)
 
4
 *  
 
5
 *  It has been AutoGen-ed  Monday September 10, 2007 at 08:31:21 PM EDT
 
6
 *  From the definitions    ntpdsim-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
 *  ntpdsim 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
 * ntpdsim 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 "ntpdsim-opts.h"
 
33
 
 
34
#ifdef  __cplusplus
 
35
extern "C" {
 
36
#endif
 
37
tSCC zCopyright[] =
 
38
       "ntpdsim 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
 *  Simbroadcastdelay option description:
 
118
 */
 
119
tSCC    zSimbroadcastdelayText[] =
 
120
        "Simulator broadcast delay";
 
121
tSCC    zSimbroadcastdelay_NAME[]  = "SIMBROADCASTDELAY";
 
122
tSCC    zSimbroadcastdelay_Name[]  = "simbroadcastdelay";
 
123
#define SIMBROADCASTDELAY_FLAGS       (OPTST_DISABLED \
 
124
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
125
 
 
126
/*
 
127
 *  Configfile option description:
 
128
 */
 
129
tSCC    zConfigfileText[] =
 
130
        "configuration file name";
 
131
tSCC    zConfigfile_NAME[]         = "CONFIGFILE";
 
132
tSCC    zConfigfile_Name[]         = "configfile";
 
133
#define CONFIGFILE_FLAGS       (OPTST_DISABLED \
 
134
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
135
 
 
136
/*
 
137
 *  Phasenoise option description:
 
138
 */
 
139
tSCC    zPhasenoiseText[] =
 
140
        "Phase noise level";
 
141
tSCC    zPhasenoise_NAME[]         = "PHASENOISE";
 
142
tSCC    zPhasenoise_Name[]         = "phasenoise";
 
143
#define PHASENOISE_FLAGS       (OPTST_DISABLED \
 
144
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
145
 
 
146
/*
 
147
 *  Debug_Level option description:
 
148
 */
 
149
#ifdef DEBUG
 
150
tSCC    zDebug_LevelText[] =
 
151
        "Increase output debug message level";
 
152
tSCC    zDebug_Level_NAME[]        = "DEBUG_LEVEL";
 
153
tSCC    zDebug_Level_Name[]        = "debug-level";
 
154
#define DEBUG_LEVEL_FLAGS       (OPTST_DISABLED)
 
155
 
 
156
#else   /* disable Debug_Level */
 
157
#define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT
 
158
#define DEBUG_LEVEL_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
 
159
#define zDebug_LevelText       NULL
 
160
#define zDebug_Level_NAME      NULL
 
161
#define zDebug_Level_Name      NULL
 
162
#endif  /* DEBUG */
 
163
 
 
164
/*
 
165
 *  Set_Debug_Level option description:
 
166
 */
 
167
#ifdef DEBUG
 
168
tSCC    zSet_Debug_LevelText[] =
 
169
        "Set the output debug message level";
 
170
tSCC    zSet_Debug_Level_NAME[]    = "SET_DEBUG_LEVEL";
 
171
tSCC    zSet_Debug_Level_Name[]    = "set-debug-level";
 
172
#define SET_DEBUG_LEVEL_FLAGS       (OPTST_DISABLED \
 
173
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
174
 
 
175
#else   /* disable Set_Debug_Level */
 
176
#define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT
 
177
#define SET_DEBUG_LEVEL_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
 
178
#define zSet_Debug_LevelText       NULL
 
179
#define zSet_Debug_Level_NAME      NULL
 
180
#define zSet_Debug_Level_Name      NULL
 
181
#endif  /* DEBUG */
 
182
 
 
183
/*
 
184
 *  Driftfile option description:
 
185
 */
 
186
tSCC    zDriftfileText[] =
 
187
        "frequency drift file name";
 
188
tSCC    zDriftfile_NAME[]          = "DRIFTFILE";
 
189
tSCC    zDriftfile_Name[]          = "driftfile";
 
190
#define DRIFTFILE_FLAGS       (OPTST_DISABLED \
 
191
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
192
 
 
193
/*
 
194
 *  Panicgate option description:
 
195
 */
 
196
tSCC    zPanicgateText[] =
 
197
        "Allow the first adjustment to be Big";
 
198
tSCC    zPanicgate_NAME[]          = "PANICGATE";
 
199
tSCC    zPanicgate_Name[]          = "panicgate";
 
200
#define PANICGATE_FLAGS       (OPTST_DISABLED)
 
201
 
 
202
/*
 
203
 *  Simslew option description:
 
204
 */
 
205
tSCC    zSimslewText[] =
 
206
        "Simuator slew";
 
207
tSCC    zSimslew_NAME[]            = "SIMSLEW";
 
208
tSCC    zSimslew_Name[]            = "simslew";
 
209
#define SIMSLEW_FLAGS       (OPTST_DISABLED \
 
210
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
211
 
 
212
/*
 
213
 *  Jaildir option description:
 
214
 */
 
215
tSCC    zJaildirText[] =
 
216
        "Jail directory";
 
217
tSCC    zJaildir_NAME[]            = "JAILDIR";
 
218
tSCC    zJaildir_Name[]            = "jaildir";
 
219
#define JAILDIR_FLAGS       (OPTST_DISABLED \
 
220
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
221
 
 
222
/*
 
223
 *  Interface option description:
 
224
 */
 
225
tSCC    zInterfaceText[] =
 
226
        "Listen on interface";
 
227
tSCC    zInterface_NAME[]          = "INTERFACE";
 
228
tSCC    zInterface_Name[]          = "interface";
 
229
#define INTERFACE_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
230
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
231
 
 
232
/*
 
233
 *  Keyfile option description:
 
234
 */
 
235
tSCC    zKeyfileText[] =
 
236
        "path to symmetric keys";
 
237
tSCC    zKeyfile_NAME[]            = "KEYFILE";
 
238
tSCC    zKeyfile_Name[]            = "keyfile";
 
239
#define KEYFILE_FLAGS       (OPTST_DISABLED \
 
240
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
241
 
 
242
/*
 
243
 *  Logfile option description:
 
244
 */
 
245
tSCC    zLogfileText[] =
 
246
        "path to the log file";
 
247
tSCC    zLogfile_NAME[]            = "LOGFILE";
 
248
tSCC    zLogfile_Name[]            = "logfile";
 
249
#define LOGFILE_FLAGS       (OPTST_DISABLED \
 
250
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
251
 
 
252
/*
 
253
 *  Novirtualips option description:
 
254
 */
 
255
tSCC    zNovirtualipsText[] =
 
256
        "Do not listen to virtual IPs";
 
257
tSCC    zNovirtualips_NAME[]       = "NOVIRTUALIPS";
 
258
tSCC    zNovirtualips_Name[]       = "novirtualips";
 
259
#define NOVIRTUALIPS_FLAGS       (OPTST_DISABLED)
 
260
 
 
261
/*
 
262
 *  Modifymmtimer option description:
 
263
 */
 
264
#ifdef SYS_WINNT
 
265
tSCC    zModifymmtimerText[] =
 
266
        "Modify Multimedia Timer (Windows only)";
 
267
tSCC    zModifymmtimer_NAME[]      = "MODIFYMMTIMER";
 
268
tSCC    zModifymmtimer_Name[]      = "modifymmtimer";
 
269
#define MODIFYMMTIMER_FLAGS       (OPTST_DISABLED)
 
270
 
 
271
#else   /* disable Modifymmtimer */
 
272
#define VALUE_OPT_MODIFYMMTIMER NO_EQUIVALENT
 
273
#define MODIFYMMTIMER_FLAGS       (OPTST_OMITTED | OPTST_NO_INIT)
 
274
#define zModifymmtimerText       NULL
 
275
#define zModifymmtimer_NAME      NULL
 
276
#define zModifymmtimer_Name      NULL
 
277
#endif  /* SYS_WINNT */
 
278
 
 
279
/*
 
280
 *  Nofork option description:
 
281
 */
 
282
tSCC    zNoforkText[] =
 
283
        "Do not fork";
 
284
tSCC    zNofork_NAME[]             = "NOFORK";
 
285
tSCC    zNofork_Name[]             = "nofork";
 
286
#define NOFORK_FLAGS       (OPTST_DISABLED)
 
287
 
 
288
/*
 
289
 *  Nice option description:
 
290
 */
 
291
tSCC    zNiceText[] =
 
292
        "Run at high priority";
 
293
tSCC    zNice_NAME[]               = "NICE";
 
294
tSCC    zNice_Name[]               = "nice";
 
295
#define NICE_FLAGS       (OPTST_DISABLED)
 
296
 
 
297
/*
 
298
 *  Servertime option description:
 
299
 */
 
300
tSCC    zServertimeText[] =
 
301
        "Server time";
 
302
tSCC    zServertime_NAME[]         = "SERVERTIME";
 
303
tSCC    zServertime_Name[]         = "servertime";
 
304
#define SERVERTIME_FLAGS       (OPTST_DISABLED \
 
305
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
306
 
 
307
/*
 
308
 *  Pidfile option description:
 
309
 */
 
310
tSCC    zPidfileText[] =
 
311
        "path to the PID file";
 
312
tSCC    zPidfile_NAME[]            = "PIDFILE";
 
313
tSCC    zPidfile_Name[]            = "pidfile";
 
314
#define PIDFILE_FLAGS       (OPTST_DISABLED \
 
315
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
316
 
 
317
/*
 
318
 *  Priority option description:
 
319
 */
 
320
tSCC    zPriorityText[] =
 
321
        "Process priority";
 
322
tSCC    zPriority_NAME[]           = "PRIORITY";
 
323
tSCC    zPriority_Name[]           = "priority";
 
324
#define PRIORITY_FLAGS       (OPTST_DISABLED \
 
325
        | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
 
326
 
 
327
/*
 
328
 *  Quit option description:
 
329
 */
 
330
tSCC    zQuitText[] =
 
331
        "Set the time and quit";
 
332
tSCC    zQuit_NAME[]               = "QUIT";
 
333
tSCC    zQuit_Name[]               = "quit";
 
334
#define QUIT_FLAGS       (OPTST_DISABLED)
 
335
 
 
336
/*
 
337
 *  Propagationdelay option description:
 
338
 */
 
339
tSCC    zPropagationdelayText[] =
 
340
        "Broadcast/propagation delay";
 
341
tSCC    zPropagationdelay_NAME[]   = "PROPAGATIONDELAY";
 
342
tSCC    zPropagationdelay_Name[]   = "propagationdelay";
 
343
#define PROPAGATIONDELAY_FLAGS       (OPTST_DISABLED \
 
344
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
345
 
 
346
/*
 
347
 *  Updateinterval option description:
 
348
 */
 
349
tSCC    zUpdateintervalText[] =
 
350
        "interval in seconds between scans for new or dropped interfaces";
 
351
tSCC    zUpdateinterval_NAME[]     = "UPDATEINTERVAL";
 
352
tSCC    zUpdateinterval_Name[]     = "updateinterval";
 
353
#define UPDATEINTERVAL_FLAGS       (OPTST_DISABLED \
 
354
        | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
 
355
 
 
356
/*
 
357
 *  Statsdir option description:
 
358
 */
 
359
tSCC    zStatsdirText[] =
 
360
        "Statistics file location";
 
361
tSCC    zStatsdir_NAME[]           = "STATSDIR";
 
362
tSCC    zStatsdir_Name[]           = "statsdir";
 
363
#define STATSDIR_FLAGS       (OPTST_DISABLED \
 
364
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
365
 
 
366
/*
 
367
 *  Endsimtime option description:
 
368
 */
 
369
tSCC    zEndsimtimeText[] =
 
370
        "Simulation end time";
 
371
tSCC    zEndsimtime_NAME[]         = "ENDSIMTIME";
 
372
tSCC    zEndsimtime_Name[]         = "endsimtime";
 
373
#define ENDSIMTIME_FLAGS       (OPTST_DISABLED \
 
374
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
375
 
 
376
/*
 
377
 *  Trustedkey option description:
 
378
 */
 
379
tSCC    zTrustedkeyText[] =
 
380
        "Trusted key number";
 
381
tSCC    zTrustedkey_NAME[]         = "TRUSTEDKEY";
 
382
tSCC    zTrustedkey_Name[]         = "trustedkey";
 
383
#define TRUSTEDKEY_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
384
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
385
 
 
386
/*
 
387
 *  Freqerr option description:
 
388
 */
 
389
tSCC    zFreqerrText[] =
 
390
        "Simulation frequency error";
 
391
tSCC    zFreqerr_NAME[]            = "FREQERR";
 
392
tSCC    zFreqerr_Name[]            = "freqerr";
 
393
#define FREQERR_FLAGS       (OPTST_DISABLED \
 
394
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
395
 
 
396
/*
 
397
 *  Walknoise option description:
 
398
 */
 
399
tSCC    zWalknoiseText[] =
 
400
        "Simulation random walk noise";
 
401
tSCC    zWalknoise_NAME[]          = "WALKNOISE";
 
402
tSCC    zWalknoise_Name[]          = "walknoise";
 
403
#define WALKNOISE_FLAGS       (OPTST_DISABLED \
 
404
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
405
 
 
406
/*
 
407
 *  User option description:
 
408
 */
 
409
tSCC    zUserText[] =
 
410
        "Run as userid (or userid:groupid)";
 
411
tSCC    zUser_NAME[]               = "USER";
 
412
tSCC    zUser_Name[]               = "user";
 
413
#define USER_FLAGS       (OPTST_DISABLED \
 
414
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
415
 
 
416
/*
 
417
 *  Var option description:
 
418
 */
 
419
tSCC    zVarText[] =
 
420
        "make ARG an ntp variable (RW)";
 
421
tSCC    zVar_NAME[]                = "VAR";
 
422
tSCC    zVar_Name[]                = "var";
 
423
#define VAR_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
424
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
425
 
 
426
/*
 
427
 *  Dvar option description:
 
428
 */
 
429
tSCC    zDvarText[] =
 
430
        "make ARG an ntp variable (RW|DEF)";
 
431
tSCC    zDvar_NAME[]               = "DVAR";
 
432
tSCC    zDvar_Name[]               = "dvar";
 
433
#define DVAR_FLAGS       (OPTST_DISABLED | OPTST_STACKED \
 
434
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
435
 
 
436
/*
 
437
 *  Slew option description:
 
438
 */
 
439
tSCC    zSlewText[] =
 
440
        "Slew up to 600 seconds";
 
441
tSCC    zSlew_NAME[]               = "SLEW";
 
442
tSCC    zSlew_Name[]               = "slew";
 
443
#define SLEW_FLAGS       (OPTST_DISABLED)
 
444
 
 
445
/*
 
446
 *  Ndelay option description:
 
447
 */
 
448
tSCC    zNdelayText[] =
 
449
        "Simulation network delay";
 
450
tSCC    zNdelay_NAME[]             = "NDELAY";
 
451
tSCC    zNdelay_Name[]             = "ndelay";
 
452
#define NDELAY_FLAGS       (OPTST_DISABLED \
 
453
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
454
 
 
455
/*
 
456
 *  Pdelay option description:
 
457
 */
 
458
tSCC    zPdelayText[] =
 
459
        "Simulation processing delay";
 
460
tSCC    zPdelay_NAME[]             = "PDELAY";
 
461
tSCC    zPdelay_Name[]             = "pdelay";
 
462
#define PDELAY_FLAGS       (OPTST_DISABLED \
 
463
        | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
464
 
 
465
/*
 
466
 *  Help/More_Help/Version option descriptions:
 
467
 */
 
468
tSCC zHelpText[]       = "Display usage information and exit";
 
469
tSCC zHelp_Name[]      = "help";
 
470
 
 
471
tSCC zMore_HelpText[]  = "Extended usage information passed thru pager";
 
472
tSCC zMore_Help_Name[] = "more-help";
 
473
 
 
474
tSCC zVersionText[]    = "Output version information and exit";
 
475
tSCC zVersion_Name[]   = "version";
 
476
 
 
477
/*
 
478
 *  Save/Load_Opts option description:
 
479
 */
 
480
tSCC zSave_OptsText[]     = "Save the option state to a config file";
 
481
tSCC zSave_Opts_Name[]    = "save-opts";
 
482
 
 
483
tSCC zLoad_OptsText[]     = "Load options from a config file";
 
484
tSCC zLoad_Opts_NAME[]    = "LOAD_OPTS";
 
485
 
 
486
tSCC zNotLoad_Opts_Name[] = "no-load-opts";
 
487
tSCC zNotLoad_Opts_Pfx[]  = "no";
 
488
#define zLoad_Opts_Name   (zNotLoad_Opts_Name + 3)
 
489
/*
 
490
 *  Declare option callback procedures
 
491
 */
 
492
#ifdef DEBUG
 
493
  static tOptProc doOptSet_Debug_Level;
 
494
#else /* not DEBUG */
 
495
# define doOptSet_Debug_Level NULL
 
496
#endif /* def/not DEBUG */
 
497
#if defined(TEST_NTPDSIM_OPTS)
 
498
/*
 
499
 *  Under test, omit argument processing, or call optionStackArg,
 
500
 *  if multiple copies are allowed.
 
501
 */
 
502
extern tOptProc
 
503
    optionNumericVal,    optionPagedUsage,    optionStackArg,
 
504
    optionVersionStderr;
 
505
static tOptProc
 
506
    doUsageOpt;
 
507
 
 
508
/*
 
509
 *  #define map the "normal" callout procs to the test ones...
 
510
 */
 
511
#define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
 
512
 
 
513
 
 
514
#else /* NOT defined TEST_NTPDSIM_OPTS */
 
515
/*
 
516
 *  When not under test, there are different procs to use
 
517
 */
 
518
extern tOptProc
 
519
    optionNumericVal, optionPagedUsage, optionPrintVersion, optionStackArg;
 
520
static tOptProc
 
521
    doUsageOpt;
 
522
 
 
523
/*
 
524
 *  #define map the "normal" callout procs
 
525
 */
 
526
#define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
 
527
 
 
528
#define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
 
529
#endif /* defined(TEST_NTPDSIM_OPTS) */
 
530
#ifdef TEST_NTPDSIM_OPTS
 
531
# define DOVERPROC optionVersionStderr
 
532
#else
 
533
# define DOVERPROC optionPrintVersion
 
534
#endif /* TEST_NTPDSIM_OPTS */
 
535
 
 
536
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
537
 *
 
538
 *  Define the Ntpdsim Option Descriptions.
 
539
 */
 
540
static tOptDesc optDesc[ OPTION_CT ] = {
 
541
  {  /* entry idx, value */ 0, VALUE_OPT_IPV4,
 
542
     /* equiv idx, value */ NO_EQUIVALENT, 0,
 
543
     /* equivalenced to  */ NO_EQUIVALENT,
 
544
     /* min, max, act ct */ 0, 1, 0,
 
545
     /* opt state flags  */ IPV4_FLAGS, 0,
 
546
     /* last opt argumnt */ { NULL },
 
547
     /* arg list/cookie  */ NULL,
 
548
     /* must/cannot opts */ NULL, NULL,
 
549
     /* option proc      */ NULL,
 
550
     /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name,
 
551
     /* disablement strs */ NULL, NULL },
 
552
 
 
553
  {  /* entry idx, value */ 1, VALUE_OPT_IPV6,
 
554
     /* equiv idx, value */ NOLIMIT, NOLIMIT,
 
555
     /* equivalenced to  */ INDEX_OPT_IPV4,
 
556
     /* min, max, act ct */ 0, 1, 0,
 
557
     /* opt state flags  */ IPV6_FLAGS, 0,
 
558
     /* last opt argumnt */ { NULL },
 
559
     /* arg list/cookie  */ NULL,
 
560
     /* must/cannot opts */ NULL, NULL,
 
561
     /* option proc      */ NULL,
 
562
     /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name,
 
563
     /* disablement strs */ NULL, NULL },
 
564
 
 
565
  {  /* entry idx, value */ 2, VALUE_OPT_AUTHREQ,
 
566
     /* equiv idx, value */ 2, VALUE_OPT_AUTHREQ,
 
567
     /* equivalenced to  */ NO_EQUIVALENT,
 
568
     /* min, max, act ct */ 0, 1, 0,
 
569
     /* opt state flags  */ AUTHREQ_FLAGS, 0,
 
570
     /* last opt argumnt */ { NULL },
 
571
     /* arg list/cookie  */ NULL,
 
572
     /* must/cannot opts */ NULL, aAuthreqCantList,
 
573
     /* option proc      */ NULL,
 
574
     /* desc, NAME, name */ zAuthreqText, zAuthreq_NAME, zAuthreq_Name,
 
575
     /* disablement strs */ NULL, NULL },
 
576
 
 
577
  {  /* entry idx, value */ 3, VALUE_OPT_AUTHNOREQ,
 
578
     /* equiv idx, value */ 3, VALUE_OPT_AUTHNOREQ,
 
579
     /* equivalenced to  */ NO_EQUIVALENT,
 
580
     /* min, max, act ct */ 0, 1, 0,
 
581
     /* opt state flags  */ AUTHNOREQ_FLAGS, 0,
 
582
     /* last opt argumnt */ { NULL },
 
583
     /* arg list/cookie  */ NULL,
 
584
     /* must/cannot opts */ NULL, aAuthnoreqCantList,
 
585
     /* option proc      */ NULL,
 
586
     /* desc, NAME, name */ zAuthnoreqText, zAuthnoreq_NAME, zAuthnoreq_Name,
 
587
     /* disablement strs */ NULL, NULL },
 
588
 
 
589
  {  /* entry idx, value */ 4, VALUE_OPT_BCASTSYNC,
 
590
     /* equiv idx, value */ 4, VALUE_OPT_BCASTSYNC,
 
591
     /* equivalenced to  */ NO_EQUIVALENT,
 
592
     /* min, max, act ct */ 0, 1, 0,
 
593
     /* opt state flags  */ BCASTSYNC_FLAGS, 0,
 
594
     /* last opt argumnt */ { NULL },
 
595
     /* arg list/cookie  */ NULL,
 
596
     /* must/cannot opts */ NULL, NULL,
 
597
     /* option proc      */ NULL,
 
598
     /* desc, NAME, name */ zBcastsyncText, zBcastsync_NAME, zBcastsync_Name,
 
599
     /* disablement strs */ NULL, NULL },
 
600
 
 
601
  {  /* entry idx, value */ 5, VALUE_OPT_SIMBROADCASTDELAY,
 
602
     /* equiv idx, value */ 5, VALUE_OPT_SIMBROADCASTDELAY,
 
603
     /* equivalenced to  */ NO_EQUIVALENT,
 
604
     /* min, max, act ct */ 0, 1, 0,
 
605
     /* opt state flags  */ SIMBROADCASTDELAY_FLAGS, 0,
 
606
     /* last opt argumnt */ { NULL },
 
607
     /* arg list/cookie  */ NULL,
 
608
     /* must/cannot opts */ NULL, NULL,
 
609
     /* option proc      */ NULL,
 
610
     /* desc, NAME, name */ zSimbroadcastdelayText, zSimbroadcastdelay_NAME, zSimbroadcastdelay_Name,
 
611
     /* disablement strs */ NULL, NULL },
 
612
 
 
613
  {  /* entry idx, value */ 6, VALUE_OPT_CONFIGFILE,
 
614
     /* equiv idx, value */ 6, VALUE_OPT_CONFIGFILE,
 
615
     /* equivalenced to  */ NO_EQUIVALENT,
 
616
     /* min, max, act ct */ 0, 1, 0,
 
617
     /* opt state flags  */ CONFIGFILE_FLAGS, 0,
 
618
     /* last opt argumnt */ { NULL },
 
619
     /* arg list/cookie  */ NULL,
 
620
     /* must/cannot opts */ NULL, NULL,
 
621
     /* option proc      */ NULL,
 
622
     /* desc, NAME, name */ zConfigfileText, zConfigfile_NAME, zConfigfile_Name,
 
623
     /* disablement strs */ NULL, NULL },
 
624
 
 
625
  {  /* entry idx, value */ 7, VALUE_OPT_PHASENOISE,
 
626
     /* equiv idx, value */ 7, VALUE_OPT_PHASENOISE,
 
627
     /* equivalenced to  */ NO_EQUIVALENT,
 
628
     /* min, max, act ct */ 0, 1, 0,
 
629
     /* opt state flags  */ PHASENOISE_FLAGS, 0,
 
630
     /* last opt argumnt */ { NULL },
 
631
     /* arg list/cookie  */ NULL,
 
632
     /* must/cannot opts */ NULL, NULL,
 
633
     /* option proc      */ NULL,
 
634
     /* desc, NAME, name */ zPhasenoiseText, zPhasenoise_NAME, zPhasenoise_Name,
 
635
     /* disablement strs */ NULL, NULL },
 
636
 
 
637
  {  /* entry idx, value */ 8, VALUE_OPT_DEBUG_LEVEL,
 
638
     /* equiv idx, value */ 8, VALUE_OPT_DEBUG_LEVEL,
 
639
     /* equivalenced to  */ NO_EQUIVALENT,
 
640
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
641
     /* opt state flags  */ DEBUG_LEVEL_FLAGS, 0,
 
642
     /* last opt argumnt */ { NULL },
 
643
     /* arg list/cookie  */ NULL,
 
644
     /* must/cannot opts */ NULL, NULL,
 
645
     /* option proc      */ NULL,
 
646
     /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name,
 
647
     /* disablement strs */ NULL, NULL },
 
648
 
 
649
  {  /* entry idx, value */ 9, VALUE_OPT_SET_DEBUG_LEVEL,
 
650
     /* equiv idx, value */ 9, VALUE_OPT_SET_DEBUG_LEVEL,
 
651
     /* equivalenced to  */ NO_EQUIVALENT,
 
652
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
653
     /* opt state flags  */ SET_DEBUG_LEVEL_FLAGS, 0,
 
654
     /* last opt argumnt */ { NULL },
 
655
     /* arg list/cookie  */ NULL,
 
656
     /* must/cannot opts */ NULL, NULL,
 
657
     /* option proc      */ SET_DEBUG_LEVEL_OPT_PROC,
 
658
     /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name,
 
659
     /* disablement strs */ NULL, NULL },
 
660
 
 
661
  {  /* entry idx, value */ 10, VALUE_OPT_DRIFTFILE,
 
662
     /* equiv idx, value */ 10, VALUE_OPT_DRIFTFILE,
 
663
     /* equivalenced to  */ NO_EQUIVALENT,
 
664
     /* min, max, act ct */ 0, 1, 0,
 
665
     /* opt state flags  */ DRIFTFILE_FLAGS, 0,
 
666
     /* last opt argumnt */ { NULL },
 
667
     /* arg list/cookie  */ NULL,
 
668
     /* must/cannot opts */ NULL, NULL,
 
669
     /* option proc      */ NULL,
 
670
     /* desc, NAME, name */ zDriftfileText, zDriftfile_NAME, zDriftfile_Name,
 
671
     /* disablement strs */ NULL, NULL },
 
672
 
 
673
  {  /* entry idx, value */ 11, VALUE_OPT_PANICGATE,
 
674
     /* equiv idx, value */ 11, VALUE_OPT_PANICGATE,
 
675
     /* equivalenced to  */ NO_EQUIVALENT,
 
676
     /* min, max, act ct */ 0, 1, 0,
 
677
     /* opt state flags  */ PANICGATE_FLAGS, 0,
 
678
     /* last opt argumnt */ { NULL },
 
679
     /* arg list/cookie  */ NULL,
 
680
     /* must/cannot opts */ NULL, NULL,
 
681
     /* option proc      */ NULL,
 
682
     /* desc, NAME, name */ zPanicgateText, zPanicgate_NAME, zPanicgate_Name,
 
683
     /* disablement strs */ NULL, NULL },
 
684
 
 
685
  {  /* entry idx, value */ 12, VALUE_OPT_SIMSLEW,
 
686
     /* equiv idx, value */ 12, VALUE_OPT_SIMSLEW,
 
687
     /* equivalenced to  */ NO_EQUIVALENT,
 
688
     /* min, max, act ct */ 0, 1, 0,
 
689
     /* opt state flags  */ SIMSLEW_FLAGS, 0,
 
690
     /* last opt argumnt */ { NULL },
 
691
     /* arg list/cookie  */ NULL,
 
692
     /* must/cannot opts */ NULL, NULL,
 
693
     /* option proc      */ NULL,
 
694
     /* desc, NAME, name */ zSimslewText, zSimslew_NAME, zSimslew_Name,
 
695
     /* disablement strs */ NULL, NULL },
 
696
 
 
697
  {  /* entry idx, value */ 13, VALUE_OPT_JAILDIR,
 
698
     /* equiv idx, value */ 13, VALUE_OPT_JAILDIR,
 
699
     /* equivalenced to  */ NO_EQUIVALENT,
 
700
     /* min, max, act ct */ 0, 1, 0,
 
701
     /* opt state flags  */ JAILDIR_FLAGS, 0,
 
702
     /* last opt argumnt */ { NULL },
 
703
     /* arg list/cookie  */ NULL,
 
704
     /* must/cannot opts */ NULL, NULL,
 
705
     /* option proc      */ NULL,
 
706
     /* desc, NAME, name */ zJaildirText, zJaildir_NAME, zJaildir_Name,
 
707
     /* disablement strs */ NULL, NULL },
 
708
 
 
709
  {  /* entry idx, value */ 14, VALUE_OPT_INTERFACE,
 
710
     /* equiv idx, value */ 14, VALUE_OPT_INTERFACE,
 
711
     /* equivalenced to  */ NO_EQUIVALENT,
 
712
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
713
     /* opt state flags  */ INTERFACE_FLAGS, 0,
 
714
     /* last opt argumnt */ { NULL },
 
715
     /* arg list/cookie  */ NULL,
 
716
     /* must/cannot opts */ NULL, NULL,
 
717
     /* option proc      */ optionStackArg,
 
718
     /* desc, NAME, name */ zInterfaceText, zInterface_NAME, zInterface_Name,
 
719
     /* disablement strs */ NULL, NULL },
 
720
 
 
721
  {  /* entry idx, value */ 15, VALUE_OPT_KEYFILE,
 
722
     /* equiv idx, value */ 15, VALUE_OPT_KEYFILE,
 
723
     /* equivalenced to  */ NO_EQUIVALENT,
 
724
     /* min, max, act ct */ 0, 1, 0,
 
725
     /* opt state flags  */ KEYFILE_FLAGS, 0,
 
726
     /* last opt argumnt */ { NULL },
 
727
     /* arg list/cookie  */ NULL,
 
728
     /* must/cannot opts */ NULL, NULL,
 
729
     /* option proc      */ NULL,
 
730
     /* desc, NAME, name */ zKeyfileText, zKeyfile_NAME, zKeyfile_Name,
 
731
     /* disablement strs */ NULL, NULL },
 
732
 
 
733
  {  /* entry idx, value */ 16, VALUE_OPT_LOGFILE,
 
734
     /* equiv idx, value */ 16, VALUE_OPT_LOGFILE,
 
735
     /* equivalenced to  */ NO_EQUIVALENT,
 
736
     /* min, max, act ct */ 0, 1, 0,
 
737
     /* opt state flags  */ LOGFILE_FLAGS, 0,
 
738
     /* last opt argumnt */ { NULL },
 
739
     /* arg list/cookie  */ NULL,
 
740
     /* must/cannot opts */ NULL, NULL,
 
741
     /* option proc      */ NULL,
 
742
     /* desc, NAME, name */ zLogfileText, zLogfile_NAME, zLogfile_Name,
 
743
     /* disablement strs */ NULL, NULL },
 
744
 
 
745
  {  /* entry idx, value */ 17, VALUE_OPT_NOVIRTUALIPS,
 
746
     /* equiv idx, value */ 17, VALUE_OPT_NOVIRTUALIPS,
 
747
     /* equivalenced to  */ NO_EQUIVALENT,
 
748
     /* min, max, act ct */ 0, 1, 0,
 
749
     /* opt state flags  */ NOVIRTUALIPS_FLAGS, 0,
 
750
     /* last opt argumnt */ { NULL },
 
751
     /* arg list/cookie  */ NULL,
 
752
     /* must/cannot opts */ NULL, NULL,
 
753
     /* option proc      */ NULL,
 
754
     /* desc, NAME, name */ zNovirtualipsText, zNovirtualips_NAME, zNovirtualips_Name,
 
755
     /* disablement strs */ NULL, NULL },
 
756
 
 
757
  {  /* entry idx, value */ 18, VALUE_OPT_MODIFYMMTIMER,
 
758
     /* equiv idx, value */ 18, VALUE_OPT_MODIFYMMTIMER,
 
759
     /* equivalenced to  */ NO_EQUIVALENT,
 
760
     /* min, max, act ct */ 0, 1, 0,
 
761
     /* opt state flags  */ MODIFYMMTIMER_FLAGS, 0,
 
762
     /* last opt argumnt */ { NULL },
 
763
     /* arg list/cookie  */ NULL,
 
764
     /* must/cannot opts */ NULL, NULL,
 
765
     /* option proc      */ NULL,
 
766
     /* desc, NAME, name */ zModifymmtimerText, zModifymmtimer_NAME, zModifymmtimer_Name,
 
767
     /* disablement strs */ NULL, NULL },
 
768
 
 
769
  {  /* entry idx, value */ 19, VALUE_OPT_NOFORK,
 
770
     /* equiv idx, value */ 19, VALUE_OPT_NOFORK,
 
771
     /* equivalenced to  */ NO_EQUIVALENT,
 
772
     /* min, max, act ct */ 0, 1, 0,
 
773
     /* opt state flags  */ NOFORK_FLAGS, 0,
 
774
     /* last opt argumnt */ { NULL },
 
775
     /* arg list/cookie  */ NULL,
 
776
     /* must/cannot opts */ NULL, NULL,
 
777
     /* option proc      */ NULL,
 
778
     /* desc, NAME, name */ zNoforkText, zNofork_NAME, zNofork_Name,
 
779
     /* disablement strs */ NULL, NULL },
 
780
 
 
781
  {  /* entry idx, value */ 20, VALUE_OPT_NICE,
 
782
     /* equiv idx, value */ 20, VALUE_OPT_NICE,
 
783
     /* equivalenced to  */ NO_EQUIVALENT,
 
784
     /* min, max, act ct */ 0, 1, 0,
 
785
     /* opt state flags  */ NICE_FLAGS, 0,
 
786
     /* last opt argumnt */ { NULL },
 
787
     /* arg list/cookie  */ NULL,
 
788
     /* must/cannot opts */ NULL, NULL,
 
789
     /* option proc      */ NULL,
 
790
     /* desc, NAME, name */ zNiceText, zNice_NAME, zNice_Name,
 
791
     /* disablement strs */ NULL, NULL },
 
792
 
 
793
  {  /* entry idx, value */ 21, VALUE_OPT_SERVERTIME,
 
794
     /* equiv idx, value */ 21, VALUE_OPT_SERVERTIME,
 
795
     /* equivalenced to  */ NO_EQUIVALENT,
 
796
     /* min, max, act ct */ 0, 1, 0,
 
797
     /* opt state flags  */ SERVERTIME_FLAGS, 0,
 
798
     /* last opt argumnt */ { NULL },
 
799
     /* arg list/cookie  */ NULL,
 
800
     /* must/cannot opts */ NULL, NULL,
 
801
     /* option proc      */ NULL,
 
802
     /* desc, NAME, name */ zServertimeText, zServertime_NAME, zServertime_Name,
 
803
     /* disablement strs */ NULL, NULL },
 
804
 
 
805
  {  /* entry idx, value */ 22, VALUE_OPT_PIDFILE,
 
806
     /* equiv idx, value */ 22, VALUE_OPT_PIDFILE,
 
807
     /* equivalenced to  */ NO_EQUIVALENT,
 
808
     /* min, max, act ct */ 0, 1, 0,
 
809
     /* opt state flags  */ PIDFILE_FLAGS, 0,
 
810
     /* last opt argumnt */ { NULL },
 
811
     /* arg list/cookie  */ NULL,
 
812
     /* must/cannot opts */ NULL, NULL,
 
813
     /* option proc      */ NULL,
 
814
     /* desc, NAME, name */ zPidfileText, zPidfile_NAME, zPidfile_Name,
 
815
     /* disablement strs */ NULL, NULL },
 
816
 
 
817
  {  /* entry idx, value */ 23, VALUE_OPT_PRIORITY,
 
818
     /* equiv idx, value */ 23, VALUE_OPT_PRIORITY,
 
819
     /* equivalenced to  */ NO_EQUIVALENT,
 
820
     /* min, max, act ct */ 0, 1, 0,
 
821
     /* opt state flags  */ PRIORITY_FLAGS, 0,
 
822
     /* last opt argumnt */ { NULL },
 
823
     /* arg list/cookie  */ NULL,
 
824
     /* must/cannot opts */ NULL, NULL,
 
825
     /* option proc      */ optionNumericVal,
 
826
     /* desc, NAME, name */ zPriorityText, zPriority_NAME, zPriority_Name,
 
827
     /* disablement strs */ NULL, NULL },
 
828
 
 
829
  {  /* entry idx, value */ 24, VALUE_OPT_QUIT,
 
830
     /* equiv idx, value */ 24, VALUE_OPT_QUIT,
 
831
     /* equivalenced to  */ NO_EQUIVALENT,
 
832
     /* min, max, act ct */ 0, 1, 0,
 
833
     /* opt state flags  */ QUIT_FLAGS, 0,
 
834
     /* last opt argumnt */ { NULL },
 
835
     /* arg list/cookie  */ NULL,
 
836
     /* must/cannot opts */ NULL, NULL,
 
837
     /* option proc      */ NULL,
 
838
     /* desc, NAME, name */ zQuitText, zQuit_NAME, zQuit_Name,
 
839
     /* disablement strs */ NULL, NULL },
 
840
 
 
841
  {  /* entry idx, value */ 25, VALUE_OPT_PROPAGATIONDELAY,
 
842
     /* equiv idx, value */ 25, VALUE_OPT_PROPAGATIONDELAY,
 
843
     /* equivalenced to  */ NO_EQUIVALENT,
 
844
     /* min, max, act ct */ 0, 1, 0,
 
845
     /* opt state flags  */ PROPAGATIONDELAY_FLAGS, 0,
 
846
     /* last opt argumnt */ { NULL },
 
847
     /* arg list/cookie  */ NULL,
 
848
     /* must/cannot opts */ NULL, NULL,
 
849
     /* option proc      */ NULL,
 
850
     /* desc, NAME, name */ zPropagationdelayText, zPropagationdelay_NAME, zPropagationdelay_Name,
 
851
     /* disablement strs */ NULL, NULL },
 
852
 
 
853
  {  /* entry idx, value */ 26, VALUE_OPT_UPDATEINTERVAL,
 
854
     /* equiv idx, value */ 26, VALUE_OPT_UPDATEINTERVAL,
 
855
     /* equivalenced to  */ NO_EQUIVALENT,
 
856
     /* min, max, act ct */ 0, 1, 0,
 
857
     /* opt state flags  */ UPDATEINTERVAL_FLAGS, 0,
 
858
     /* last opt argumnt */ { NULL },
 
859
     /* arg list/cookie  */ NULL,
 
860
     /* must/cannot opts */ NULL, NULL,
 
861
     /* option proc      */ optionNumericVal,
 
862
     /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name,
 
863
     /* disablement strs */ NULL, NULL },
 
864
 
 
865
  {  /* entry idx, value */ 27, VALUE_OPT_STATSDIR,
 
866
     /* equiv idx, value */ 27, VALUE_OPT_STATSDIR,
 
867
     /* equivalenced to  */ NO_EQUIVALENT,
 
868
     /* min, max, act ct */ 0, 1, 0,
 
869
     /* opt state flags  */ STATSDIR_FLAGS, 0,
 
870
     /* last opt argumnt */ { NULL },
 
871
     /* arg list/cookie  */ NULL,
 
872
     /* must/cannot opts */ NULL, NULL,
 
873
     /* option proc      */ NULL,
 
874
     /* desc, NAME, name */ zStatsdirText, zStatsdir_NAME, zStatsdir_Name,
 
875
     /* disablement strs */ NULL, NULL },
 
876
 
 
877
  {  /* entry idx, value */ 28, VALUE_OPT_ENDSIMTIME,
 
878
     /* equiv idx, value */ 28, VALUE_OPT_ENDSIMTIME,
 
879
     /* equivalenced to  */ NO_EQUIVALENT,
 
880
     /* min, max, act ct */ 0, 1, 0,
 
881
     /* opt state flags  */ ENDSIMTIME_FLAGS, 0,
 
882
     /* last opt argumnt */ { NULL },
 
883
     /* arg list/cookie  */ NULL,
 
884
     /* must/cannot opts */ NULL, NULL,
 
885
     /* option proc      */ NULL,
 
886
     /* desc, NAME, name */ zEndsimtimeText, zEndsimtime_NAME, zEndsimtime_Name,
 
887
     /* disablement strs */ NULL, NULL },
 
888
 
 
889
  {  /* entry idx, value */ 29, VALUE_OPT_TRUSTEDKEY,
 
890
     /* equiv idx, value */ 29, VALUE_OPT_TRUSTEDKEY,
 
891
     /* equivalenced to  */ NO_EQUIVALENT,
 
892
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
893
     /* opt state flags  */ TRUSTEDKEY_FLAGS, 0,
 
894
     /* last opt argumnt */ { NULL },
 
895
     /* arg list/cookie  */ NULL,
 
896
     /* must/cannot opts */ NULL, NULL,
 
897
     /* option proc      */ optionStackArg,
 
898
     /* desc, NAME, name */ zTrustedkeyText, zTrustedkey_NAME, zTrustedkey_Name,
 
899
     /* disablement strs */ NULL, NULL },
 
900
 
 
901
  {  /* entry idx, value */ 30, VALUE_OPT_FREQERR,
 
902
     /* equiv idx, value */ 30, VALUE_OPT_FREQERR,
 
903
     /* equivalenced to  */ NO_EQUIVALENT,
 
904
     /* min, max, act ct */ 0, 1, 0,
 
905
     /* opt state flags  */ FREQERR_FLAGS, 0,
 
906
     /* last opt argumnt */ { NULL },
 
907
     /* arg list/cookie  */ NULL,
 
908
     /* must/cannot opts */ NULL, NULL,
 
909
     /* option proc      */ NULL,
 
910
     /* desc, NAME, name */ zFreqerrText, zFreqerr_NAME, zFreqerr_Name,
 
911
     /* disablement strs */ NULL, NULL },
 
912
 
 
913
  {  /* entry idx, value */ 31, VALUE_OPT_WALKNOISE,
 
914
     /* equiv idx, value */ 31, VALUE_OPT_WALKNOISE,
 
915
     /* equivalenced to  */ NO_EQUIVALENT,
 
916
     /* min, max, act ct */ 0, 1, 0,
 
917
     /* opt state flags  */ WALKNOISE_FLAGS, 0,
 
918
     /* last opt argumnt */ { NULL },
 
919
     /* arg list/cookie  */ NULL,
 
920
     /* must/cannot opts */ NULL, NULL,
 
921
     /* option proc      */ NULL,
 
922
     /* desc, NAME, name */ zWalknoiseText, zWalknoise_NAME, zWalknoise_Name,
 
923
     /* disablement strs */ NULL, NULL },
 
924
 
 
925
  {  /* entry idx, value */ 32, VALUE_OPT_USER,
 
926
     /* equiv idx, value */ 32, VALUE_OPT_USER,
 
927
     /* equivalenced to  */ NO_EQUIVALENT,
 
928
     /* min, max, act ct */ 0, 1, 0,
 
929
     /* opt state flags  */ USER_FLAGS, 0,
 
930
     /* last opt argumnt */ { NULL },
 
931
     /* arg list/cookie  */ NULL,
 
932
     /* must/cannot opts */ NULL, NULL,
 
933
     /* option proc      */ NULL,
 
934
     /* desc, NAME, name */ zUserText, zUser_NAME, zUser_Name,
 
935
     /* disablement strs */ NULL, NULL },
 
936
 
 
937
  {  /* entry idx, value */ 33, VALUE_OPT_VAR,
 
938
     /* equiv idx, value */ 33, VALUE_OPT_VAR,
 
939
     /* equivalenced to  */ NO_EQUIVALENT,
 
940
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
941
     /* opt state flags  */ VAR_FLAGS, 0,
 
942
     /* last opt argumnt */ { NULL },
 
943
     /* arg list/cookie  */ NULL,
 
944
     /* must/cannot opts */ NULL, NULL,
 
945
     /* option proc      */ optionStackArg,
 
946
     /* desc, NAME, name */ zVarText, zVar_NAME, zVar_Name,
 
947
     /* disablement strs */ NULL, NULL },
 
948
 
 
949
  {  /* entry idx, value */ 34, VALUE_OPT_DVAR,
 
950
     /* equiv idx, value */ 34, VALUE_OPT_DVAR,
 
951
     /* equivalenced to  */ NO_EQUIVALENT,
 
952
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
953
     /* opt state flags  */ DVAR_FLAGS, 0,
 
954
     /* last opt argumnt */ { NULL },
 
955
     /* arg list/cookie  */ NULL,
 
956
     /* must/cannot opts */ NULL, NULL,
 
957
     /* option proc      */ optionStackArg,
 
958
     /* desc, NAME, name */ zDvarText, zDvar_NAME, zDvar_Name,
 
959
     /* disablement strs */ NULL, NULL },
 
960
 
 
961
  {  /* entry idx, value */ 35, VALUE_OPT_SLEW,
 
962
     /* equiv idx, value */ 35, VALUE_OPT_SLEW,
 
963
     /* equivalenced to  */ NO_EQUIVALENT,
 
964
     /* min, max, act ct */ 0, 1, 0,
 
965
     /* opt state flags  */ SLEW_FLAGS, 0,
 
966
     /* last opt argumnt */ { NULL },
 
967
     /* arg list/cookie  */ NULL,
 
968
     /* must/cannot opts */ NULL, NULL,
 
969
     /* option proc      */ NULL,
 
970
     /* desc, NAME, name */ zSlewText, zSlew_NAME, zSlew_Name,
 
971
     /* disablement strs */ NULL, NULL },
 
972
 
 
973
  {  /* entry idx, value */ 36, VALUE_OPT_NDELAY,
 
974
     /* equiv idx, value */ 36, VALUE_OPT_NDELAY,
 
975
     /* equivalenced to  */ NO_EQUIVALENT,
 
976
     /* min, max, act ct */ 0, 1, 0,
 
977
     /* opt state flags  */ NDELAY_FLAGS, 0,
 
978
     /* last opt argumnt */ { NULL },
 
979
     /* arg list/cookie  */ NULL,
 
980
     /* must/cannot opts */ NULL, NULL,
 
981
     /* option proc      */ NULL,
 
982
     /* desc, NAME, name */ zNdelayText, zNdelay_NAME, zNdelay_Name,
 
983
     /* disablement strs */ NULL, NULL },
 
984
 
 
985
  {  /* entry idx, value */ 37, VALUE_OPT_PDELAY,
 
986
     /* equiv idx, value */ 37, VALUE_OPT_PDELAY,
 
987
     /* equivalenced to  */ NO_EQUIVALENT,
 
988
     /* min, max, act ct */ 0, 1, 0,
 
989
     /* opt state flags  */ PDELAY_FLAGS, 0,
 
990
     /* last opt argumnt */ { NULL },
 
991
     /* arg list/cookie  */ NULL,
 
992
     /* must/cannot opts */ NULL, NULL,
 
993
     /* option proc      */ NULL,
 
994
     /* desc, NAME, name */ zPdelayText, zPdelay_NAME, zPdelay_Name,
 
995
     /* disablement strs */ NULL, NULL },
 
996
 
 
997
#ifdef NO_OPTIONAL_OPT_ARGS
 
998
#  define VERSION_OPT_FLAGS     OPTST_IMM | OPTST_NO_INIT
 
999
#else
 
1000
#  define VERSION_OPT_FLAGS     OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
 
1001
                                OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
 
1002
#endif
 
1003
 
 
1004
  {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
 
1005
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
1006
     /* equivalenced to  */ NO_EQUIVALENT,
 
1007
     /* min, max, act ct */ 0, 1, 0,
 
1008
     /* opt state flags  */ VERSION_OPT_FLAGS, 0,
 
1009
     /* last opt argumnt */ { NULL },
 
1010
     /* arg list/cookie  */ NULL,
 
1011
     /* must/cannot opts */ NULL, NULL,
 
1012
     /* option proc      */ DOVERPROC,
 
1013
     /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
 
1014
     /* disablement strs */ NULL, NULL },
 
1015
 
 
1016
#undef VERSION_OPT_FLAGS
 
1017
 
 
1018
 
 
1019
  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
 
1020
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
1021
     /* equivalenced to  */ NO_EQUIVALENT,
 
1022
     /* min, max, act ct */ 0, 1, 0,
 
1023
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
 
1024
     /* last opt argumnt */ { NULL },
 
1025
     /* arg list/cookie  */ NULL,
 
1026
     /* must/cannot opts */ NULL, NULL,
 
1027
     /* option proc      */ doUsageOpt,
 
1028
     /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
 
1029
     /* disablement strs */ NULL, NULL },
 
1030
 
 
1031
  {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
 
1032
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
1033
     /* equivalenced to  */ NO_EQUIVALENT,
 
1034
     /* min, max, act ct */ 0, 1, 0,
 
1035
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
 
1036
     /* last opt argumnt */ { NULL },
 
1037
     /* arg list/cookie  */ NULL,
 
1038
     /* must/cannot opts */ NULL,  NULL,
 
1039
     /* option proc      */ optionPagedUsage,
 
1040
     /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
 
1041
     /* disablement strs */ NULL, NULL },
 
1042
 
 
1043
  {  /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
 
1044
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
1045
     /* equivalenced to  */ NO_EQUIVALENT,
 
1046
     /* min, max, act ct */ 0, 1, 0,
 
1047
     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
 
1048
                          | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
 
1049
     /* last opt argumnt */ { NULL },
 
1050
     /* arg list/cookie  */ NULL,
 
1051
     /* must/cannot opts */ NULL,  NULL,
 
1052
     /* option proc      */ NULL,
 
1053
     /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
 
1054
     /* disablement strs */ NULL, NULL },
 
1055
 
 
1056
  {  /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
 
1057
     /* equiv idx value  */ NO_EQUIVALENT, 0,
 
1058
     /* equivalenced to  */ NO_EQUIVALENT,
 
1059
     /* min, max, act ct */ 0, NOLIMIT, 0,
 
1060
     /* opt state flags  */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \
 
1061
                          | OPTST_DISABLE_IMM, 0,
 
1062
     /* last opt argumnt */ { NULL },
 
1063
     /* arg list/cookie  */ NULL,
 
1064
     /* must/cannot opts */ NULL, NULL,
 
1065
     /* option proc      */ optionLoadOpt,
 
1066
     /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
 
1067
     /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
 
1068
};
 
1069
 
 
1070
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
1071
 *
 
1072
 *  Define the Ntpdsim Option Environment
 
1073
 */
 
1074
tSCC   zPROGNAME[]   = "NTPDSIM";
 
1075
tSCC   zUsageTitle[] =
 
1076
"ntpdsim - NTP daemon simulation program - Ver. 4.2.4p4\n\
 
1077
USAGE:  %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n";
 
1078
tSCC   zRcName[]     = ".ntprc";
 
1079
tSCC*  apzHomeList[] = {
 
1080
       "$HOME",
 
1081
       ".",
 
1082
       NULL };
 
1083
 
 
1084
tSCC   zBugsAddr[]    = "http://bugs.ntp.isc.org, bugs@ntp.org";
 
1085
#define zExplain NULL
 
1086
tSCC    zDetail[]     = "\n\n";
 
1087
tSCC    zFullVersion[] = NTPDSIM_FULL_VERSION;
 
1088
/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 408 */
 
1089
 
 
1090
#if defined(ENABLE_NLS)
 
1091
# define OPTPROC_BASE OPTPROC_TRANSLATE
 
1092
  static tOptionXlateProc translate_option_strings;
 
1093
#else
 
1094
# define OPTPROC_BASE OPTPROC_NONE
 
1095
# define translate_option_strings NULL
 
1096
#endif /* ENABLE_NLS */
 
1097
 
 
1098
tOptions ntpdsimOptions = {
 
1099
    OPTIONS_STRUCT_VERSION,
 
1100
    0, NULL,                    /* original argc + argv    */
 
1101
    ( OPTPROC_BASE
 
1102
    + OPTPROC_ERRSTOP
 
1103
    + OPTPROC_SHORTOPT
 
1104
    + OPTPROC_LONGOPT
 
1105
    + OPTPROC_NO_REQ_OPT
 
1106
    + OPTPROC_ENVIRON
 
1107
    + OPTPROC_NO_ARGS
 
1108
    + OPTPROC_HAS_IMMED ),
 
1109
    0, NULL,                    /* current option index, current option */
 
1110
    NULL,         NULL,         zPROGNAME,
 
1111
    zRcName,      zCopyright,   zCopyrightNotice,
 
1112
    zFullVersion, apzHomeList,  zUsageTitle,
 
1113
    zExplain,     zDetail,      optDesc,
 
1114
    zBugsAddr,                  /* address to send bugs to */
 
1115
    NULL, NULL,                 /* extensions/saved state  */
 
1116
    optionUsage,       /* usage procedure */
 
1117
    translate_option_strings,   /* translation procedure */
 
1118
    /*
 
1119
     *  Indexes to special options
 
1120
     */
 
1121
    { INDEX_OPT_MORE_HELP,
 
1122
      INDEX_OPT_SAVE_OPTS,
 
1123
      NO_EQUIVALENT /* index of '-#' option */,
 
1124
      NO_EQUIVALENT /* index of default opt */
 
1125
    },
 
1126
    43 /* full option count */, 38 /* user option count */
 
1127
};
 
1128
 
 
1129
/*
 
1130
 *  Create the static procedure(s) declared above.
 
1131
 */
 
1132
static void
 
1133
doUsageOpt(
 
1134
    tOptions*   pOptions,
 
1135
    tOptDesc*   pOptDesc )
 
1136
{
 
1137
    USAGE( EXIT_SUCCESS );
 
1138
}
 
1139
 
 
1140
#if ! defined(TEST_NTPDSIM_OPTS)
 
1141
 
 
1142
/* * * * * * *
 
1143
 *
 
1144
 *   For the set-debug-level option, when DEBUG is #define-d.
 
1145
 */
 
1146
#ifdef DEBUG
 
1147
static void
 
1148
doOptSet_Debug_Level(
 
1149
    tOptions*   pOptions,
 
1150
    tOptDesc*   pOptDesc )
 
1151
{
 
1152
    /* extracted from ../include/debug-opt.def, line 29 */
 
1153
DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
 
1154
}
 
1155
#endif /* defined DEBUG */
 
1156
 
 
1157
#endif /* defined(TEST_NTPDSIM_OPTS) */
 
1158
 
 
1159
/* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 92 */
 
1160
 
 
1161
#if defined(TEST_NTPDSIM_OPTS) /* TEST MAIN PROCEDURE: */
 
1162
 
 
1163
int
 
1164
main( int argc, char** argv )
 
1165
{
 
1166
    int res = EXIT_SUCCESS;
 
1167
    (void)optionProcess( &ntpdsimOptions, argc, argv );
 
1168
    {
 
1169
        void optionPutShell( tOptions* );
 
1170
        optionPutShell( &ntpdsimOptions );
 
1171
    }
 
1172
    return res;
 
1173
}
 
1174
#endif  /* defined TEST_NTPDSIM_OPTS */
 
1175
/* extracted from /usr/local/gnu/share/autogen/optcode.tpl near line 514 */
 
1176
 
 
1177
#if ENABLE_NLS
 
1178
#include <stdio.h>
 
1179
#include <stdlib.h>
 
1180
#include <string.h>
 
1181
#include <unistd.h>
 
1182
#include <autoopts/usage-txt.h>
 
1183
 
 
1184
static char* AO_gettext( char const* pz );
 
1185
static void  coerce_it(void** s);
 
1186
 
 
1187
static char*
 
1188
AO_gettext( char const* pz )
 
1189
{
 
1190
    char* pzRes;
 
1191
    if (pz == NULL)
 
1192
        return NULL;
 
1193
    pzRes = _(pz);
 
1194
    if (pzRes == pz)
 
1195
        return pzRes;
 
1196
    pzRes = strdup( pzRes );
 
1197
    if (pzRes == NULL) {
 
1198
        fputs( _("No memory for duping translated strings\n"), stderr );
 
1199
        exit( EXIT_FAILURE );
 
1200
    }
 
1201
    return pzRes;
 
1202
}
 
1203
 
 
1204
static void coerce_it(void** s) { *s = AO_gettext(*s); }
 
1205
#define COERSION(_f) \
 
1206
  coerce_it((void*)&(ntpdsimOptions._f))
 
1207
 
 
1208
/*
 
1209
 *  This invokes the translation code (e.g. gettext(3)).
 
1210
 */
 
1211
static void
 
1212
translate_option_strings( void )
 
1213
{
 
1214
    /*
 
1215
     *  Guard against re-translation.  It won't work.  The strings will have
 
1216
     *  been changed by the first pass through this code.  One shot only.
 
1217
     */
 
1218
    if (option_usage_text.field_ct == 0)
 
1219
        return;
 
1220
    /*
 
1221
     *  Do the translations.  The first pointer follows the field count field.
 
1222
     *  The field count field is the size of a pointer.
 
1223
     */
 
1224
    {
 
1225
        char** ppz = (char**)(void*)&(option_usage_text);
 
1226
        int    ix  = option_usage_text.field_ct;
 
1227
 
 
1228
        do {
 
1229
            ppz++;
 
1230
            *ppz = AO_gettext(*ppz);
 
1231
        } while (--ix > 0);
 
1232
    }
 
1233
    option_usage_text.field_ct = 0;
 
1234
 
 
1235
    {
 
1236
        tOptDesc* pOD = ntpdsimOptions.pOptDesc;
 
1237
        int       ix  = ntpdsimOptions.optCt;
 
1238
 
 
1239
        for (;;) {
 
1240
            pOD->pzText           = AO_gettext(pOD->pzText);
 
1241
            pOD->pz_NAME          = AO_gettext(pOD->pz_NAME);
 
1242
            pOD->pz_Name          = AO_gettext(pOD->pz_Name);
 
1243
            pOD->pz_DisableName   = AO_gettext(pOD->pz_DisableName);
 
1244
            pOD->pz_DisablePfx    = AO_gettext(pOD->pz_DisablePfx);
 
1245
            if (--ix <= 0)
 
1246
                break;
 
1247
            pOD++;
 
1248
        }
 
1249
    }
 
1250
    COERSION(pzCopyright);
 
1251
    COERSION(pzCopyNotice);
 
1252
    COERSION(pzFullVersion);
 
1253
    COERSION(pzUsageTitle);
 
1254
    COERSION(pzExplain);
 
1255
    COERSION(pzDetail);
 
1256
}
 
1257
 
 
1258
#endif /* ENABLE_NLS */
 
1259
 
 
1260
#ifdef  __cplusplus
 
1261
}
 
1262
#endif
 
1263
/* ntpdsim-opts.c ends here */