tcpcapinfo_opts.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (tcpcapinfo_opts.c)
  4. *
  5. * It has been AutoGen-ed
  6. * From the definitions ../../src/tcpcapinfo_opts.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 42:1:17 templates.
  10. *
  11. * AutoOpts is a copyrighted work. This source file is not encumbered
  12. * by AutoOpts licensing, but is provided under the licensing terms chosen
  13. * by the tcpcapinfo author or copyright holder. AutoOpts is
  14. * licensed under the terms of the LGPL. The redistributable library
  15. * (``libopts'') is licensed under the terms of either the LGPL or, at the
  16. * users discretion, the BSD license. See the AutoOpts and/or libopts sources
  17. * for details.
  18. *
  19. * The tcpcapinfo program is copyrighted and licensed
  20. * under the following terms:
  21. *
  22. * Copyright (C) 2000-2012 Aaron Turner and Fred Klassen, all rights reserved.
  23. * This is free software. It is licensed for use, modification and
  24. * redistribution under the terms of the GNU General Public License,
  25. * version 3 or later <http://gnu.org/licenses/gpl.html>
  26. *
  27. * tcpcapinfo is free software: you can redistribute it and/or modify it
  28. * under the terms of the GNU General Public License as published by the
  29. * Free Software Foundation, either version 3 of the License, or
  30. * (at your option) any later version.
  31. *
  32. * tcpcapinfo is distributed in the hope that it will be useful, but
  33. * WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  35. * See the GNU General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU General Public License along
  38. * with this program. If not, see <http://www.gnu.org/licenses/>.
  39. */
  40. #ifndef __doxygen__
  41. #define OPTION_CODE_COMPILE 1
  42. #include "tcpcapinfo_opts.h"
  43. #include <sys/types.h>
  44. #include <sys/stat.h>
  45. #include <errno.h>
  46. #include <fcntl.h>
  47. #include <limits.h>
  48. #include <stdio.h>
  49. #include <stdlib.h>
  50. #include <string.h>
  51. #include <unistd.h>
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55. extern FILE * option_usage_fp;
  56. #define zCopyright (tcpcapinfo_opt_strs+0)
  57. #define zLicenseDescrip (tcpcapinfo_opt_strs+290)
  58. /*
  59. * global included definitions
  60. */
  61. #include "defines.h"
  62. #include "common.h"
  63. #include "config.h"
  64. #ifndef NULL
  65. # define NULL 0
  66. #endif
  67. /**
  68. * static const strings for tcpcapinfo options
  69. */
  70. static char const tcpcapinfo_opt_strs[1631] =
  71. /* 0 */ "tcpcapinfo (Tcpreplay Suite)\n"
  72. "Copyright (C) 2000-2012 Aaron Turner and Fred Klassen, all rights reserved.\n"
  73. "This is free software. It is licensed for use, modification and\n"
  74. "redistribution under the terms of the GNU General Public License,\n"
  75. "version 3 or later <http://gnu.org/licenses/gpl.html>\n\0"
  76. /* 290 */ "tcpcapinfo is free software: you can redistribute it and/or modify it under\n"
  77. "the terms of the GNU General Public License as published by the Free\n"
  78. "Software Foundation, either version 3 of the License, or (at your option)\n"
  79. "any later version.\n\n"
  80. "tcpcapinfo is distributed in the hope that it will be useful, but WITHOUT\n"
  81. "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
  82. "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n"
  83. "more details.\n\n"
  84. "You should have received a copy of the GNU General Public License along\n"
  85. "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
  86. /* 899 */ "Enable debugging output\0"
  87. /* 923 */ "DBUG\0"
  88. /* 928 */ "dbug\0"
  89. /* 933 */ "Print version information\0"
  90. /* 959 */ "VERSION\0"
  91. /* 967 */ "version\0"
  92. /* 975 */ "display extended usage information and exit\0"
  93. /* 1019 */ "help\0"
  94. /* 1024 */ "extended usage information passed thru pager\0"
  95. /* 1069 */ "more-help\0"
  96. /* 1079 */ "TCPCAPINFO\0"
  97. /* 1090 */ "tcpcapinfo (Tcpreplay Suite) - Pcap file dissector for debugging broken pcap files\n"
  98. "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <pcap_file(s)>\n\0"
  99. /* 1246 */ "tcpreplay-users@lists.sourceforge.net\0"
  100. /* 1284 */ "tcpcapinfo is a tool for decoding the structure of a pcap(3) file with a\n"
  101. "focus on finding broken pcap files and determining how two related pcap\n"
  102. "files might differ.\n\0"
  103. /* 1450 */ "tcpcapinfo will first print out the pcap_file_header_t in human readable\n"
  104. "form followed by a per-packet summary including the pcap_pkthdr_t and\n"
  105. "simple checksum value of the packet.\n";
  106. /**
  107. * dbug option description:
  108. */
  109. #ifdef DEBUG
  110. /** Descriptive text for the dbug option */
  111. #define DBUG_DESC (tcpcapinfo_opt_strs+899)
  112. /** Upper-cased name for the dbug option */
  113. #define DBUG_NAME (tcpcapinfo_opt_strs+923)
  114. /** Name string for the dbug option */
  115. #define DBUG_name (tcpcapinfo_opt_strs+928)
  116. /** The compiled in default value for the dbug option argument */
  117. #define DBUG_DFT_ARG ((char const*)0)
  118. /** Compiled in flag settings for the dbug option */
  119. #define DBUG_FLAGS (OPTST_DISABLED | OPTST_IMM \
  120. | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
  121. #else /* disable dbug */
  122. #define DBUG_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  123. #define DBUG_DFT_ARG NULL
  124. #define DBUG_NAME NULL
  125. #define DBUG_DESC NULL
  126. #define DBUG_name NULL
  127. #endif /* DEBUG */
  128. /**
  129. * version option description:
  130. */
  131. /** Descriptive text for the version option */
  132. #define VERSION_DESC (tcpcapinfo_opt_strs+933)
  133. /** Upper-cased name for the version option */
  134. #define VERSION_NAME (tcpcapinfo_opt_strs+959)
  135. /** Name string for the version option */
  136. #define VERSION_name (tcpcapinfo_opt_strs+967)
  137. /** Compiled in flag settings for the version option */
  138. #define VERSION_FLAGS (OPTST_DISABLED)
  139. /*
  140. * Help/More_Help option descriptions:
  141. */
  142. #define HELP_DESC (tcpcapinfo_opt_strs+975)
  143. #define HELP_name (tcpcapinfo_opt_strs+1019)
  144. #ifdef HAVE_WORKING_FORK
  145. #define MORE_HELP_DESC (tcpcapinfo_opt_strs+1024)
  146. #define MORE_HELP_name (tcpcapinfo_opt_strs+1069)
  147. #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
  148. #else
  149. #define MORE_HELP_DESC HELP_DESC
  150. #define MORE_HELP_name HELP_name
  151. #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
  152. #endif
  153. /**
  154. * Declare option callback procedures
  155. */
  156. #ifdef DEBUG
  157. static tOptProc doOptDbug;
  158. #else /* not DEBUG */
  159. # define doOptDbug NULL
  160. #endif /* def/not DEBUG */
  161. extern tOptProc
  162. optionBooleanVal, optionNestedVal, optionNumericVal,
  163. optionPagedUsage, optionPrintVersion, optionResetOpt,
  164. optionStackArg, optionTimeDate, optionTimeVal,
  165. optionUnstackArg, optionVendorOption;
  166. static tOptProc
  167. doOptVersion, doUsageOpt;
  168. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  169. /**
  170. * Define the tcpcapinfo Option Descriptions.
  171. * This is an array of OPTION_CT entries, one for each
  172. * option that the tcpcapinfo program responds to.
  173. */
  174. static tOptDesc optDesc[OPTION_CT] = {
  175. { /* entry idx, value */ 0, VALUE_OPT_DBUG,
  176. /* equiv idx, value */ 0, VALUE_OPT_DBUG,
  177. /* equivalenced to */ NO_EQUIVALENT,
  178. /* min, max, act ct */ 0, 1, 0,
  179. /* opt state flags */ DBUG_FLAGS, 0,
  180. /* last opt argumnt */ { DBUG_DFT_ARG },
  181. /* arg list/cookie */ NULL,
  182. /* must/cannot opts */ NULL, NULL,
  183. /* option proc */ doOptDbug,
  184. /* desc, NAME, name */ DBUG_DESC, DBUG_NAME, DBUG_name,
  185. /* disablement strs */ NULL, NULL },
  186. { /* entry idx, value */ 1, VALUE_OPT_VERSION,
  187. /* equiv idx, value */ 1, VALUE_OPT_VERSION,
  188. /* equivalenced to */ NO_EQUIVALENT,
  189. /* min, max, act ct */ 0, 1, 0,
  190. /* opt state flags */ VERSION_FLAGS, 0,
  191. /* last opt argumnt */ { NULL }, /* --version */
  192. /* arg list/cookie */ NULL,
  193. /* must/cannot opts */ NULL, NULL,
  194. /* option proc */ doOptVersion,
  195. /* desc, NAME, name */ VERSION_DESC, VERSION_NAME, VERSION_name,
  196. /* disablement strs */ NULL, NULL },
  197. { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
  198. /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
  199. /* equivalenced to */ NO_EQUIVALENT,
  200. /* min, max, act ct */ 0, 1, 0,
  201. /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
  202. /* last opt argumnt */ { NULL },
  203. /* arg list/cookie */ NULL,
  204. /* must/cannot opts */ NULL, NULL,
  205. /* option proc */ doUsageOpt,
  206. /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
  207. /* disablement strs */ NULL, NULL },
  208. { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
  209. /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
  210. /* equivalenced to */ NO_EQUIVALENT,
  211. /* min, max, act ct */ 0, 1, 0,
  212. /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
  213. /* last opt argumnt */ { NULL },
  214. /* arg list/cookie */ NULL,
  215. /* must/cannot opts */ NULL, NULL,
  216. /* option proc */ optionPagedUsage,
  217. /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
  218. /* disablement strs */ NULL, NULL }
  219. };
  220. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  221. /** Reference to the upper cased version of tcpcapinfo. */
  222. #define zPROGNAME (tcpcapinfo_opt_strs+1079)
  223. /** Reference to the title line for tcpcapinfo usage. */
  224. #define zUsageTitle (tcpcapinfo_opt_strs+1090)
  225. /** There is no tcpcapinfo configuration file. */
  226. #define zRcName NULL
  227. /** There are no directories to search for tcpcapinfo config files. */
  228. #define apzHomeList NULL
  229. /** The tcpcapinfo program bug email address. */
  230. #define zBugsAddr (tcpcapinfo_opt_strs+1246)
  231. /** Clarification/explanation of what tcpcapinfo does. */
  232. #define zExplain (tcpcapinfo_opt_strs+1284)
  233. /** Extra detail explaining what tcpcapinfo does. */
  234. #define zDetail (tcpcapinfo_opt_strs+1450)
  235. /** The full version string for tcpcapinfo. */
  236. #define zFullVersion (NULL)
  237. /* extracted from optcode.tlib near line 342 */
  238. #if defined(ENABLE_NLS)
  239. # define OPTPROC_BASE OPTPROC_TRANSLATE
  240. static tOptionXlateProc translate_option_strings;
  241. #else
  242. # define OPTPROC_BASE OPTPROC_NONE
  243. # define translate_option_strings NULL
  244. #endif /* ENABLE_NLS */
  245. #define tcpcapinfo_full_usage (NULL)
  246. #define tcpcapinfo_short_usage (NULL)
  247. #endif /* not defined __doxygen__ */
  248. /*
  249. * Create the static procedure(s) declared above.
  250. */
  251. /**
  252. * The callout function that invokes the optionUsage function.
  253. *
  254. * @param[in] opts the AutoOpts option description structure
  255. * @param[in] od the descriptor for the "help" (usage) option.
  256. * @noreturn
  257. */
  258. static void
  259. doUsageOpt(tOptions * opts, tOptDesc * od)
  260. {
  261. int ex_code;
  262. ex_code = TCPCAPINFO_EXIT_SUCCESS;
  263. optionUsage(&tcpcapinfoOptions, ex_code);
  264. /* NOTREACHED */
  265. exit(TCPCAPINFO_EXIT_FAILURE);
  266. (void)opts;
  267. (void)od;
  268. }
  269. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  270. /**
  271. * Code to handle the dbug option, when DEBUG is #define-d.
  272. * If configured with --enable-debug, then you can specify a verbosity
  273. * level for debugging output. Higher numbers increase verbosity.
  274. * @param[in] pOptions the tcpcapinfo options data structure
  275. * @param[in,out] pOptDesc the option descriptor for this option.
  276. */
  277. #ifdef DEBUG
  278. static void
  279. doOptDbug(tOptions* pOptions, tOptDesc* pOptDesc)
  280. {
  281. static struct {long rmin, rmax;} const rng[1] = {
  282. { 0, 5 } };
  283. int ix;
  284. if (pOptions <= OPTPROC_EMIT_LIMIT)
  285. goto emit_ranges;
  286. optionNumericVal(pOptions, pOptDesc);
  287. for (ix = 0; ix < 1; ix++) {
  288. if (pOptDesc->optArg.argInt < rng[ix].rmin)
  289. continue; /* ranges need not be ordered. */
  290. if (pOptDesc->optArg.argInt == rng[ix].rmin)
  291. return;
  292. if (rng[ix].rmax == LONG_MIN)
  293. continue;
  294. if (pOptDesc->optArg.argInt <= rng[ix].rmax)
  295. return;
  296. }
  297. option_usage_fp = stderr;
  298. emit_ranges:
  299. optionShowRange(pOptions, pOptDesc, VOIDP(rng), 1);
  300. }
  301. #endif /* defined DEBUG */
  302. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  303. /**
  304. * Code to handle the version option.
  305. *
  306. * @param[in] pOptions the tcpcapinfo options data structure
  307. * @param[in,out] pOptDesc the option descriptor for this option.
  308. */
  309. static void
  310. doOptVersion(tOptions* pOptions, tOptDesc* pOptDesc)
  311. {
  312. /*
  313. * Be sure the flag-code[0] handles special values for the options pointer
  314. * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
  315. * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
  316. * reset its state.
  317. */
  318. /* extracted from tcpcapinfo_opts.def, line 99 */
  319. fprintf(stderr, "tcpcapinfo version: %s (build %s)", VERSION, git_version());
  320. #ifdef DEBUG
  321. fprintf(stderr, " (debug)");
  322. #endif
  323. fprintf(stderr, "\n");
  324. fprintf(stderr, "Copyright 2013-2024 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta\n");
  325. fprintf(stderr, "Copyright 2000-2010 by Aaron Turner <aturner at synfin dot net>\n");
  326. fprintf(stderr, "The entire Tcpreplay Suite is licensed under the GPLv3\n");
  327. exit(0);
  328. (void)pOptDesc;
  329. (void)pOptions;
  330. }
  331. /* extracted from optmain.tlib near line 1250 */
  332. /**
  333. * The directory containing the data associated with tcpcapinfo.
  334. */
  335. #ifndef PKGDATADIR
  336. # define PKGDATADIR ""
  337. #endif
  338. /**
  339. * Information about the person or institution that packaged tcpcapinfo
  340. * for the current distribution.
  341. */
  342. #ifndef WITH_PACKAGER
  343. # define tcpcapinfo_packager_info NULL
  344. #else
  345. /** Packager information for tcpcapinfo. */
  346. static char const tcpcapinfo_packager_info[] =
  347. "Packaged by " WITH_PACKAGER
  348. # ifdef WITH_PACKAGER_VERSION
  349. " ("WITH_PACKAGER_VERSION")"
  350. # endif
  351. # ifdef WITH_PACKAGER_BUG_REPORTS
  352. "\nReport tcpcapinfo bugs to " WITH_PACKAGER_BUG_REPORTS
  353. # endif
  354. "\n";
  355. #endif
  356. #ifndef __doxygen__
  357. #endif /* __doxygen__ */
  358. /**
  359. * The option definitions for tcpcapinfo. The one structure that
  360. * binds them all.
  361. */
  362. tOptions tcpcapinfoOptions = {
  363. OPTIONS_STRUCT_VERSION,
  364. 0, NULL, /* original argc + argv */
  365. ( OPTPROC_BASE
  366. + OPTPROC_ERRSTOP
  367. + OPTPROC_SHORTOPT
  368. + OPTPROC_LONGOPT
  369. + OPTPROC_NO_REQ_OPT
  370. + OPTPROC_ARGS_REQ
  371. + OPTPROC_GNUUSAGE ),
  372. 0, NULL, /* current option index, current option */
  373. NULL, NULL, zPROGNAME,
  374. zRcName, zCopyright, zLicenseDescrip,
  375. zFullVersion, apzHomeList, zUsageTitle,
  376. zExplain, zDetail, optDesc,
  377. zBugsAddr, /* address to send bugs to */
  378. NULL, NULL, /* extensions/saved state */
  379. optionUsage, /* usage procedure */
  380. translate_option_strings, /* translation procedure */
  381. /*
  382. * Indexes to special options
  383. */
  384. { INDEX_OPT_MORE_HELP, /* more-help option index */
  385. NO_EQUIVALENT, /* save option index */
  386. NO_EQUIVALENT, /* '-#' option index */
  387. NO_EQUIVALENT /* index of default opt */
  388. },
  389. 4 /* full option count */, 2 /* user option count */,
  390. tcpcapinfo_full_usage, tcpcapinfo_short_usage,
  391. NULL, NULL,
  392. PKGDATADIR, tcpcapinfo_packager_info
  393. };
  394. #if ENABLE_NLS
  395. /**
  396. * This code is designed to translate translatable option text for the
  397. * tcpcapinfo program. These translations happen upon entry
  398. * to optionProcess().
  399. */
  400. #include <stdio.h>
  401. #include <stdlib.h>
  402. #include <string.h>
  403. #include <unistd.h>
  404. #ifdef HAVE_DCGETTEXT
  405. # include <gettext.h>
  406. #endif
  407. #include <autoopts/usage-txt.h>
  408. static char * AO_gettext(char const * pz);
  409. static void coerce_it(void ** s);
  410. /**
  411. * AutoGen specific wrapper function for gettext. It relies on the macro _()
  412. * to convert from English to the target language, then strdup-duplicates the
  413. * result string. It tries the "libopts" domain first, then whatever has been
  414. * set via the \a textdomain(3) call.
  415. *
  416. * @param[in] pz the input text used as a lookup key.
  417. * @returns the translated text (if there is one),
  418. * or the original text (if not).
  419. */
  420. static char *
  421. AO_gettext(char const * pz)
  422. {
  423. char * res;
  424. if (pz == NULL)
  425. return NULL;
  426. #ifdef HAVE_DCGETTEXT
  427. /*
  428. * While processing the option_xlateable_txt data, try to use the
  429. * "libopts" domain. Once we switch to the option descriptor data,
  430. * do *not* use that domain.
  431. */
  432. if (option_xlateable_txt.field_ct != 0) {
  433. res = dgettext("libopts", pz);
  434. if (res == pz)
  435. res = (char *)VOIDP(_(pz));
  436. } else
  437. res = (char *)VOIDP(_(pz));
  438. #else
  439. res = (char *)VOIDP(_(pz));
  440. #endif
  441. if (res == pz)
  442. return res;
  443. res = strdup(res);
  444. if (res == NULL) {
  445. fputs(_("No memory for duping translated strings\n"), stderr);
  446. exit(TCPCAPINFO_EXIT_FAILURE);
  447. }
  448. return res;
  449. }
  450. /**
  451. * All the pointers we use are marked "* const", but they are stored in
  452. * writable memory. Coerce the mutability and set the pointer.
  453. */
  454. static void coerce_it(void ** s) { *s = AO_gettext(*s);
  455. }
  456. /**
  457. * Translate all the translatable strings in the tcpcapinfoOptions
  458. * structure defined above. This is done only once.
  459. */
  460. static void
  461. translate_option_strings(void)
  462. {
  463. tOptions * const opts = &tcpcapinfoOptions;
  464. /*
  465. * Guard against re-translation. It won't work. The strings will have
  466. * been changed by the first pass through this code. One shot only.
  467. */
  468. if (option_xlateable_txt.field_ct != 0) {
  469. /*
  470. * Do the translations. The first pointer follows the field count
  471. * field. The field count field is the size of a pointer.
  472. */
  473. char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
  474. int ix = option_xlateable_txt.field_ct;
  475. do {
  476. ppz++; /* skip over field_ct */
  477. *ppz = AO_gettext(*ppz);
  478. } while (--ix > 0);
  479. /* prevent re-translation and disable "libopts" domain lookup */
  480. option_xlateable_txt.field_ct = 0;
  481. coerce_it(VOIDP(&(opts->pzCopyright)));
  482. coerce_it(VOIDP(&(opts->pzCopyNotice)));
  483. coerce_it(VOIDP(&(opts->pzFullVersion)));
  484. coerce_it(VOIDP(&(opts->pzUsageTitle)));
  485. coerce_it(VOIDP(&(opts->pzExplain)));
  486. coerce_it(VOIDP(&(opts->pzDetail)));
  487. {
  488. tOptDesc * od = opts->pOptDesc;
  489. for (ix = opts->optCt; ix > 0; ix--, od++)
  490. coerce_it(VOIDP(&(od->pzText)));
  491. }
  492. }
  493. }
  494. #endif /* ENABLE_NLS */
  495. #ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT
  496. /** I18N function strictly for xgettext. Do not compile. */
  497. static void bogus_function(void) {
  498. /* TRANSLATORS:
  499. The following dummy function was crated solely so that xgettext can
  500. extract the correct strings. These strings are actually referenced
  501. by a field name in the tcpcapinfoOptions structure noted in the
  502. comments below. The literal text is defined in tcpcapinfo_opt_strs.
  503. NOTE: the strings below are segmented with respect to the source string
  504. tcpcapinfo_opt_strs. The strings above are handed off for translation
  505. at run time a paragraph at a time. Consequently, they are presented here
  506. for translation a paragraph at a time.
  507. ALSO: often the description for an option will reference another option
  508. by name. These are set off with apostrophe quotes (I hope). Do not
  509. translate option names.
  510. */
  511. /* referenced via tcpcapinfoOptions.pzCopyright */
  512. puts(_("tcpcapinfo (Tcpreplay Suite)\n\
  513. Copyright (C) 2000-2012 Aaron Turner and Fred Klassen, all rights reserved.\n\
  514. This is free software. It is licensed for use, modification and\n\
  515. redistribution under the terms of the GNU General Public License,\n\
  516. version 3 or later <http://gnu.org/licenses/gpl.html>\n"));
  517. /* referenced via tcpcapinfoOptions.pzCopyNotice */
  518. puts(_("tcpcapinfo is free software: you can redistribute it and/or modify it under\n\
  519. the terms of the GNU General Public License as published by the Free\n\
  520. Software Foundation, either version 3 of the License, or (at your option)\n\
  521. any later version.\n\n"));
  522. puts(_("tcpcapinfo is distributed in the hope that it will be useful, but WITHOUT\n\
  523. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\
  524. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n\
  525. more details.\n\n"));
  526. puts(_("You should have received a copy of the GNU General Public License along\n\
  527. with this program. If not, see <http://www.gnu.org/licenses/>.\n"));
  528. /* referenced via tcpcapinfoOptions.pOptDesc->pzText */
  529. puts(_("Enable debugging output"));
  530. /* referenced via tcpcapinfoOptions.pOptDesc->pzText */
  531. puts(_("Print version information"));
  532. /* referenced via tcpcapinfoOptions.pOptDesc->pzText */
  533. puts(_("display extended usage information and exit"));
  534. /* referenced via tcpcapinfoOptions.pOptDesc->pzText */
  535. puts(_("extended usage information passed thru pager"));
  536. /* referenced via tcpcapinfoOptions.pzUsageTitle */
  537. puts(_("tcpcapinfo (Tcpreplay Suite) - Pcap file dissector for debugging broken pcap files\n\
  538. Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... <pcap_file(s)>\n"));
  539. /* referenced via tcpcapinfoOptions.pzExplain */
  540. puts(_("tcpcapinfo is a tool for decoding the structure of a pcap(3) file with a\n\
  541. focus on finding broken pcap files and determining how two related pcap\n\
  542. files might differ.\n"));
  543. /* referenced via tcpcapinfoOptions.pzDetail */
  544. puts(_("tcpcapinfo will first print out the pcap_file_header_t in human readable\n\
  545. form followed by a per-packet summary including the pcap_pkthdr_t and\n\
  546. simple checksum value of the packet.\n"));
  547. /* referenced via tcpcapinfoOptions.pzFullUsage */
  548. puts(_("<<<NOT-FOUND>>>"));
  549. /* referenced via tcpcapinfoOptions.pzShortUsage */
  550. puts(_("<<<NOT-FOUND>>>"));
  551. /* LIBOPTS-MESSAGES: */
  552. #line 67 "../autoopts.c"
  553. puts(_("allocation of %d bytes failed\n"));
  554. #line 89 "../autoopts.c"
  555. puts(_("allocation of %d bytes failed\n"));
  556. #line 48 "../init.c"
  557. puts(_("AutoOpts function called without option descriptor\n"));
  558. #line 81 "../init.c"
  559. puts(_("\tThis exceeds the compiled library version: "));
  560. #line 79 "../init.c"
  561. puts(_("Automated Options Processing Error!\n"
  562. "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
  563. #line 78 "../autoopts.c"
  564. puts(_("realloc of %d bytes at 0x%p failed\n"));
  565. #line 83 "../init.c"
  566. puts(_("\tThis is less than the minimum library version: "));
  567. #line 121 "../version.c"
  568. puts(_("Automated Options version %s\n"
  569. "\tCopyright (C) 1999-2017 by Bruce Korb - all rights reserved\n"));
  570. #line 49 "../makeshell.c"
  571. puts(_("(AutoOpts bug): %s.\n"));
  572. #line 90 "../reset.c"
  573. puts(_("optionResetOpt() called, but reset-option not configured"));
  574. #line 241 "../usage.c"
  575. puts(_("could not locate the 'help' option"));
  576. #line 330 "../autoopts.c"
  577. puts(_("optionProcess() was called with invalid data"));
  578. #line 697 "../usage.c"
  579. puts(_("invalid argument type specified"));
  580. #line 568 "../find.c"
  581. puts(_("defaulted to option with optional arg"));
  582. #line 76 "../alias.c"
  583. puts(_("aliasing option is out of range."));
  584. #line 210 "../enum.c"
  585. puts(_("%s error: the keyword '%s' is ambiguous for %s\n"));
  586. #line 78 "../find.c"
  587. puts(_(" The following options match:\n"));
  588. #line 263 "../find.c"
  589. puts(_("%s: ambiguous option name: %s (matches %d options)\n"));
  590. #line 161 "../check.c"
  591. puts(_("%s: Command line arguments required\n"));
  592. #line 43 "../alias.c"
  593. puts(_("%d %s%s options allowed\n"));
  594. #line 56 "../makeshell.c"
  595. puts(_("%s error %d (%s) calling %s for '%s'\n"));
  596. #line 268 "../makeshell.c"
  597. puts(_("interprocess pipe"));
  598. #line 171 "../version.c"
  599. puts(_("error: version option argument '%c' invalid. Use:\n"
  600. "\t'v' - version only\n"
  601. "\t'c' - version and copyright\n"
  602. "\t'n' - version and full copyright notice\n"));
  603. #line 58 "../check.c"
  604. puts(_("%s error: the '%s' and '%s' options conflict\n"));
  605. #line 187 "../find.c"
  606. puts(_("%s: The '%s' option has been disabled."));
  607. #line 400 "../find.c"
  608. puts(_("%s: The '%s' option has been disabled."));
  609. #line 38 "../alias.c"
  610. puts(_("-equivalence"));
  611. #line 439 "../find.c"
  612. puts(_("%s: illegal option -- %c\n"));
  613. #line 110 "../reset.c"
  614. puts(_("%s: illegal option -- %c\n"));
  615. #line 241 "../find.c"
  616. puts(_("%s: illegal option -- %s\n"));
  617. #line 740 "../find.c"
  618. puts(_("%s: illegal option -- %s\n"));
  619. #line 118 "../reset.c"
  620. puts(_("%s: illegal option -- %s\n"));
  621. #line 305 "../find.c"
  622. puts(_("%s: unknown vendor extension option -- %s\n"));
  623. #line 135 "../enum.c"
  624. puts(_(" or an integer from %d through %d\n"));
  625. #line 145 "../enum.c"
  626. puts(_(" or an integer from %d through %d\n"));
  627. #line 696 "../usage.c"
  628. puts(_("%s error: invalid option descriptor for %s\n"));
  629. #line 1030 "../usage.c"
  630. puts(_("%s error: invalid option descriptor for %s\n"));
  631. #line 355 "../find.c"
  632. puts(_("%s: invalid option name: %s\n"));
  633. #line 497 "../find.c"
  634. puts(_("%s: The '%s' option requires an argument.\n"));
  635. #line 150 "../autoopts.c"
  636. puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
  637. "\t'%s' and '%s'."));
  638. #line 94 "../check.c"
  639. puts(_("%s error: The %s option is required\n"));
  640. #line 602 "../find.c"
  641. puts(_("%s: The '%s' option cannot have an argument.\n"));
  642. #line 151 "../check.c"
  643. puts(_("%s: Command line arguments are not allowed.\n"));
  644. #line 568 "../save.c"
  645. puts(_("error %d (%s) creating %s\n"));
  646. #line 210 "../enum.c"
  647. puts(_("%s error: '%s' does not match any %s keywords.\n"));
  648. #line 93 "../reset.c"
  649. puts(_("%s error: The '%s' option requires an argument.\n"));
  650. #line 122 "../save.c"
  651. puts(_("error %d (%s) stat-ing %s\n"));
  652. #line 175 "../save.c"
  653. puts(_("error %d (%s) stat-ing %s\n"));
  654. #line 143 "../restore.c"
  655. puts(_("%s error: no saved option state\n"));
  656. #line 225 "../autoopts.c"
  657. puts(_("'%s' is not a command line option.\n"));
  658. #line 113 "../time.c"
  659. puts(_("%s error: '%s' is not a recognizable date/time.\n"));
  660. #line 50 "../time.c"
  661. puts(_("%s error: '%s' is not a recognizable time duration.\n"));
  662. #line 92 "../check.c"
  663. puts(_("%s error: The %s option must appear %d times.\n"));
  664. #line 165 "../numeric.c"
  665. puts(_("%s error: '%s' is not a recognizable number.\n"));
  666. #line 176 "../enum.c"
  667. puts(_("%s error: %s exceeds %s keyword count\n"));
  668. #line 279 "../usage.c"
  669. puts(_("Try '%s %s' for more information.\n"));
  670. #line 45 "../alias.c"
  671. puts(_("one %s%s option allowed\n"));
  672. #line 170 "../makeshell.c"
  673. puts(_("standard output"));
  674. #line 905 "../makeshell.c"
  675. puts(_("standard output"));
  676. #line 223 "../usage.c"
  677. puts(_("standard output"));
  678. #line 364 "../usage.c"
  679. puts(_("standard output"));
  680. #line 574 "../usage.c"
  681. puts(_("standard output"));
  682. #line 178 "../version.c"
  683. puts(_("standard output"));
  684. #line 223 "../usage.c"
  685. puts(_("standard error"));
  686. #line 364 "../usage.c"
  687. puts(_("standard error"));
  688. #line 574 "../usage.c"
  689. puts(_("standard error"));
  690. #line 178 "../version.c"
  691. puts(_("standard error"));
  692. #line 170 "../makeshell.c"
  693. puts(_("write"));
  694. #line 905 "../makeshell.c"
  695. puts(_("write"));
  696. #line 222 "../usage.c"
  697. puts(_("write"));
  698. #line 363 "../usage.c"
  699. puts(_("write"));
  700. #line 573 "../usage.c"
  701. puts(_("write"));
  702. #line 177 "../version.c"
  703. puts(_("write"));
  704. #line 60 "../numeric.c"
  705. puts(_("%s error: %s option value %ld is out of range.\n"));
  706. #line 44 "../check.c"
  707. puts(_("%s error: %s option requires the %s option\n"));
  708. #line 121 "../save.c"
  709. puts(_("%s warning: cannot save options - %s not regular file\n"));
  710. #line 174 "../save.c"
  711. puts(_("%s warning: cannot save options - %s not regular file\n"));
  712. #line 193 "../save.c"
  713. puts(_("%s warning: cannot save options - %s not regular file\n"));
  714. #line 567 "../save.c"
  715. puts(_("%s warning: cannot save options - %s not regular file\n"));
  716. /* END-LIBOPTS-MESSAGES */
  717. /* USAGE-TEXT: */
  718. #line 822 "../usage.c"
  719. puts(_("\t\t\t\t- an alternate for '%s'\n"));
  720. #line 1097 "../usage.c"
  721. puts(_("Version, usage and configuration options:"));
  722. #line 873 "../usage.c"
  723. puts(_("\t\t\t\t- default option for unnamed options\n"));
  724. #line 786 "../usage.c"
  725. puts(_("\t\t\t\t- disabled as '--%s'\n"));
  726. #line 1066 "../usage.c"
  727. puts(_(" --- %-14s %s\n"));
  728. #line 1064 "../usage.c"
  729. puts(_("This option has been disabled"));
  730. #line 813 "../usage.c"
  731. puts(_("\t\t\t\t- enabled by default\n"));
  732. #line 40 "../alias.c"
  733. puts(_("%s error: only "));
  734. #line 1143 "../usage.c"
  735. puts(_(" - examining environment variables named %s_*\n"));
  736. #line 168 "../file.c"
  737. puts(_("\t\t\t\t- file must not pre-exist\n"));
  738. #line 172 "../file.c"
  739. puts(_("\t\t\t\t- file must pre-exist\n"));
  740. #line 329 "../usage.c"
  741. puts(_("Options are specified by doubled hyphens and their name or by a single\n"
  742. "hyphen and the flag character.\n"));
  743. #line 882 "../makeshell.c"
  744. puts(_("\n"
  745. "= = = = = = = =\n\n"
  746. "This incarnation of genshell will produce\n"
  747. "a shell script to parse the options for %s:\n\n"));
  748. #line 142 "../enum.c"
  749. puts(_(" or an integer mask with any of the lower %d bits set\n"));
  750. #line 846 "../usage.c"
  751. puts(_("\t\t\t\t- is a set membership option\n"));
  752. #line 867 "../usage.c"
  753. puts(_("\t\t\t\t- must appear between %d and %d times\n"));
  754. #line 331 "../usage.c"
  755. puts(_("Options are specified by single or double hyphens and their name.\n"));
  756. #line 853 "../usage.c"
  757. puts(_("\t\t\t\t- may appear multiple times\n"));
  758. #line 840 "../usage.c"
  759. puts(_("\t\t\t\t- may not be preset\n"));
  760. #line 1258 "../usage.c"
  761. puts(_(" Arg Option-Name Description\n"));
  762. #line 1194 "../usage.c"
  763. puts(_(" Flg Arg Option-Name Description\n"));
  764. #line 1252 "../usage.c"
  765. puts(_(" Flg Arg Option-Name Description\n"));
  766. #line 1253 "../usage.c"
  767. puts(_(" %3s %s"));
  768. #line 1259 "../usage.c"
  769. puts(_(" %3s %s"));
  770. #line 336 "../usage.c"
  771. puts(_("The '-#<number>' option may omit the hash char\n"));
  772. #line 332 "../usage.c"
  773. puts(_("All arguments are named options.\n"));
  774. #line 920 "../usage.c"
  775. puts(_(" - reading file %s"));
  776. #line 358 "../usage.c"
  777. puts(_("\n"
  778. "Please send bug reports to: <%s>\n"));
  779. #line 100 "../version.c"
  780. puts(_("\n"
  781. "Please send bug reports to: <%s>\n"));
  782. #line 129 "../version.c"
  783. puts(_("\n"
  784. "Please send bug reports to: <%s>\n"));
  785. #line 852 "../usage.c"
  786. puts(_("\t\t\t\t- may NOT appear - preset only\n"));
  787. #line 893 "../usage.c"
  788. puts(_("\n"
  789. "The following option preset mechanisms are supported:\n"));
  790. #line 1141 "../usage.c"
  791. puts(_("\n"
  792. "The following option preset mechanisms are supported:\n"));
  793. #line 631 "../usage.c"
  794. puts(_("prohibits these options:\n"));
  795. #line 626 "../usage.c"
  796. puts(_("prohibits the option '%s'\n"));
  797. #line 81 "../numeric.c"
  798. puts(_("%s%ld to %ld"));
  799. #line 79 "../numeric.c"
  800. puts(_("%sgreater than or equal to %ld"));
  801. #line 75 "../numeric.c"
  802. puts(_("%s%ld exactly"));
  803. #line 68 "../numeric.c"
  804. puts(_("%sit must lie in one of the ranges:\n"));
  805. #line 68 "../numeric.c"
  806. puts(_("%sit must be in the range:\n"));
  807. #line 88 "../numeric.c"
  808. puts(_(", or\n"));
  809. #line 66 "../numeric.c"
  810. puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
  811. #line 77 "../numeric.c"
  812. puts(_("%sless than or equal to %ld"));
  813. #line 339 "../usage.c"
  814. puts(_("Operands and options may be intermixed. They will be reordered.\n"));
  815. #line 601 "../usage.c"
  816. puts(_("requires the option '%s'\n"));
  817. #line 604 "../usage.c"
  818. puts(_("requires these options:\n"));
  819. #line 1270 "../usage.c"
  820. puts(_(" Arg Option-Name Req? Description\n"));
  821. #line 1264 "../usage.c"
  822. puts(_(" Flg Arg Option-Name Req? Description\n"));
  823. #line 143 "../enum.c"
  824. puts(_("or you may use a numeric representation. Preceding these with a '!'\n"
  825. "will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
  826. "will set them all. Multiple entries may be passed as an option\n"
  827. "argument list.\n"));
  828. #line 859 "../usage.c"
  829. puts(_("\t\t\t\t- may appear up to %d times\n"));
  830. #line 52 "../enum.c"
  831. puts(_("The valid \"%s\" option keywords are:\n"));
  832. #line 1101 "../usage.c"
  833. puts(_("The next option supports vendor supported extra options:"));
  834. #line 722 "../usage.c"
  835. puts(_("These additional options are:"));
  836. /* END-USAGE-TEXT */
  837. }
  838. #endif /* uncompilable code */
  839. #ifdef __cplusplus
  840. }
  841. #endif
  842. /* tcpcapinfo_opts.c ends here */