/contrib/ntp/ntpd/ntpd-opts.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 1021 lines · 748 code · 103 blank · 170 comment · 11 complexity · 9190edab53a8ec060276257ff82fa7b6 MD5 · raw file

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