_gnutls_strdatum_to_buf() will account for NULL input.
[gnutls.git] / src / srptool-args.c
blob204520ef86c30b530c42964c94f0df43f19570b0
1 /* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (srptool-args.c)
4 *
5 * It has been AutoGen-ed November 8, 2012 at 11:35:51 PM by AutoGen 5.16
6 * From the definitions srptool-args.def
7 * and the template file options
9 * Generated from AutoOpts 36:4:11 templates.
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 srptool 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.
19 * The srptool program is copyrighted and licensed
20 * under the following terms:
22 * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
23 * This is free software. It is licensed for use, modification and
24 * redistribution under the terms of the
25 * GNU General Public License, version 3 or later
26 * <http://gnu.org/licenses/gpl.html>
28 * srptool is free software: you can redistribute it and/or modify it
29 * under the terms of the GNU General Public License as published by the
30 * Free Software Foundation, either version 3 of the License, or
31 * (at your option) any later version.
33 * srptool is distributed in the hope that it will be useful, but
34 * WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 * See the GNU General Public License for more details.
38 * You should have received a copy of the GNU General Public License along
39 * with this program. If not, see <http://www.gnu.org/licenses/>.
42 #ifndef __doxygen__
43 #define OPTION_CODE_COMPILE 1
44 #include "srptool-args.h"
45 #include <sys/types.h>
47 #include <limits.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <errno.h>
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 extern FILE * option_usage_fp;
57 /* TRANSLATORS: choose the translation for option names wisely because you
58 cannot ever change your mind. */
59 #define zCopyright (srptool_opt_strs+0)
60 #define zLicenseDescrip (srptool_opt_strs+278)
63 #ifndef NULL
64 # define NULL 0
65 #endif
68 * srptool option static const strings
70 static char const srptool_opt_strs[2049] =
71 /* 0 */ "srptool @VERSION@\n"
72 "Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n"
73 "This is free software. It is licensed for use, modification and\n"
74 "redistribution under the terms of the\n"
75 "GNU General Public License, version 3 or later\n"
76 " <http://gnu.org/licenses/gpl.html>\n\0"
77 /* 278 */ "srptool is free software: you can redistribute it and/or modify it under\n"
78 "the terms of the GNU General Public License as published by the Free\n"
79 "Software Foundation, either version 3 of the License, or (at your option)\n"
80 "any later version.\n\n"
81 "srptool is distributed in the hope that it will be useful, but WITHOUT ANY\n"
82 "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
83 "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n"
84 "details.\n\n"
85 "You should have received a copy of the GNU General Public License along\n"
86 "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
87 /* 881 */ "Enable debugging.\0"
88 /* 899 */ "DEBUG\0"
89 /* 905 */ "debug\0"
90 /* 911 */ "specify the index of the group parameters in tpasswd.conf to use.\0"
91 /* 977 */ "INDEX\0"
92 /* 983 */ "index\0"
93 /* 989 */ "specify a username\0"
94 /* 1008 */ "USERNAME\0"
95 /* 1017 */ "username\0"
96 /* 1026 */ "specify a password file.\0"
97 /* 1051 */ "PASSWD\0"
98 /* 1058 */ "passwd\0"
99 /* 1065 */ "specify salt size.\0"
100 /* 1084 */ "SALT\0"
101 /* 1089 */ "salt\0"
102 /* 1094 */ "just verify the password.\0"
103 /* 1120 */ "VERIFY\0"
104 /* 1127 */ "verify\0"
105 /* 1134 */ "specify a password conf file.\0"
106 /* 1164 */ "PASSWD_CONF\0"
107 /* 1176 */ "passwd-conf\0"
108 /* 1188 */ "Generate a password configuration file.\0"
109 /* 1228 */ "CREATE_CONF\0"
110 /* 1240 */ "create-conf\0"
111 /* 1252 */ "Display extended usage information and exit\0"
112 /* 1296 */ "help\0"
113 /* 1301 */ "Extended usage information passed thru pager\0"
114 /* 1346 */ "more-help\0"
115 /* 1356 */ "Output version information and exit\0"
116 /* 1392 */ "version\0"
117 /* 1400 */ "SRPTOOL\0"
118 /* 1408 */ "srptool - GnuTLS SRP tool - Ver. @VERSION@\n"
119 "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
120 /* 1509 */ "bug-gnutls@gnu.org\0"
121 /* 1528 */ "\n\n\0"
122 /* 1531 */ "\n"
123 "Simple program that emulates the programs in the Stanford SRP (Secure\n"
124 "Remote Password) libraries using GnuTLS. It is intended for use in places\n"
125 "where you don't expect SRP authentication to be the used for system users.\n\n"
126 "In brief, to use SRP you need to create two files. These are the password\n"
127 "file that holds the users and the verifiers associated with them and the\n"
128 "configuration file to hold the group parameters (called tpasswd.conf).\n\0"
129 /* 1973 */ "srptool @VERSION@\0"
130 /* 1991 */ "srptool [options]\n"
131 "srptool --help for usage instructions.\n";
134 * debug option description:
136 #define DEBUG_DESC (srptool_opt_strs+881)
137 #define DEBUG_NAME (srptool_opt_strs+899)
138 #define DEBUG_name (srptool_opt_strs+905)
139 #define DEBUG_FLAGS (OPTST_DISABLED \
140 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
143 * index option description:
145 #define INDEX_DESC (srptool_opt_strs+911)
146 #define INDEX_NAME (srptool_opt_strs+977)
147 #define INDEX_name (srptool_opt_strs+983)
148 #define INDEX_FLAGS (OPTST_DISABLED)
151 * username option description:
153 #define USERNAME_DESC (srptool_opt_strs+989)
154 #define USERNAME_NAME (srptool_opt_strs+1008)
155 #define USERNAME_name (srptool_opt_strs+1017)
156 #define USERNAME_FLAGS (OPTST_DISABLED \
157 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
160 * passwd option description:
162 #define PASSWD_DESC (srptool_opt_strs+1026)
163 #define PASSWD_NAME (srptool_opt_strs+1051)
164 #define PASSWD_name (srptool_opt_strs+1058)
165 #define PASSWD_FLAGS (OPTST_DISABLED \
166 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
169 * salt option description:
171 #define SALT_DESC (srptool_opt_strs+1065)
172 #define SALT_NAME (srptool_opt_strs+1084)
173 #define SALT_name (srptool_opt_strs+1089)
174 #define SALT_FLAGS (OPTST_DISABLED \
175 | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
178 * verify option description:
180 #define VERIFY_DESC (srptool_opt_strs+1094)
181 #define VERIFY_NAME (srptool_opt_strs+1120)
182 #define VERIFY_name (srptool_opt_strs+1127)
183 #define VERIFY_FLAGS (OPTST_DISABLED)
186 * passwd-conf option description:
188 #define PASSWD_CONF_DESC (srptool_opt_strs+1134)
189 #define PASSWD_CONF_NAME (srptool_opt_strs+1164)
190 #define PASSWD_CONF_name (srptool_opt_strs+1176)
191 #define PASSWD_CONF_FLAGS (OPTST_DISABLED \
192 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
195 * create-conf option description:
197 #define CREATE_CONF_DESC (srptool_opt_strs+1188)
198 #define CREATE_CONF_NAME (srptool_opt_strs+1228)
199 #define CREATE_CONF_name (srptool_opt_strs+1240)
200 #define CREATE_CONF_FLAGS (OPTST_DISABLED \
201 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
204 * Help/More_Help/Version option descriptions:
206 #define HELP_DESC (srptool_opt_strs+1252)
207 #define HELP_name (srptool_opt_strs+1296)
208 #ifdef HAVE_WORKING_FORK
209 #define MORE_HELP_DESC (srptool_opt_strs+1301)
210 #define MORE_HELP_name (srptool_opt_strs+1346)
211 #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
212 #else
213 #define MORE_HELP_DESC NULL
214 #define MORE_HELP_name NULL
215 #define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
216 #endif
217 #ifdef NO_OPTIONAL_OPT_ARGS
218 # define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
219 #else
220 # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
221 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
222 #endif
223 #define VER_DESC (srptool_opt_strs+1356)
224 #define VER_name (srptool_opt_strs+1392)
226 * Declare option callback procedures
228 extern tOptProc
229 optionBooleanVal, optionNestedVal, optionNumericVal,
230 optionPagedUsage, optionPrintVersion, optionResetOpt,
231 optionStackArg, optionTimeDate, optionTimeVal,
232 optionUnstackArg, optionVendorOption;
233 static tOptProc
234 doOptDebug, doUsageOpt;
235 #define VER_PROC optionPrintVersion
237 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
239 * Define the srptool Option Descriptions.
240 * This is an array of OPTION_CT entries, one for each
241 * option that the srptool program responds to.
243 static tOptDesc optDesc[OPTION_CT] = {
244 { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
245 /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
246 /* equivalenced to */ NO_EQUIVALENT,
247 /* min, max, act ct */ 0, 1, 0,
248 /* opt state flags */ DEBUG_FLAGS, 0,
249 /* last opt argumnt */ { NULL }, /* --debug */
250 /* arg list/cookie */ NULL,
251 /* must/cannot opts */ NULL, NULL,
252 /* option proc */ doOptDebug,
253 /* desc, NAME, name */ DEBUG_DESC, DEBUG_NAME, DEBUG_name,
254 /* disablement strs */ NULL, NULL },
256 { /* entry idx, value */ 1, VALUE_OPT_INDEX,
257 /* equiv idx, value */ 1, VALUE_OPT_INDEX,
258 /* equivalenced to */ NO_EQUIVALENT,
259 /* min, max, act ct */ 0, 1, 0,
260 /* opt state flags */ INDEX_FLAGS, 0,
261 /* last opt argumnt */ { NULL }, /* --index */
262 /* arg list/cookie */ NULL,
263 /* must/cannot opts */ NULL, NULL,
264 /* option proc */ NULL,
265 /* desc, NAME, name */ INDEX_DESC, INDEX_NAME, INDEX_name,
266 /* disablement strs */ NULL, NULL },
268 { /* entry idx, value */ 2, VALUE_OPT_USERNAME,
269 /* equiv idx, value */ 2, VALUE_OPT_USERNAME,
270 /* equivalenced to */ NO_EQUIVALENT,
271 /* min, max, act ct */ 0, 1, 0,
272 /* opt state flags */ USERNAME_FLAGS, 0,
273 /* last opt argumnt */ { NULL }, /* --username */
274 /* arg list/cookie */ NULL,
275 /* must/cannot opts */ NULL, NULL,
276 /* option proc */ NULL,
277 /* desc, NAME, name */ USERNAME_DESC, USERNAME_NAME, USERNAME_name,
278 /* disablement strs */ NULL, NULL },
280 { /* entry idx, value */ 3, VALUE_OPT_PASSWD,
281 /* equiv idx, value */ 3, VALUE_OPT_PASSWD,
282 /* equivalenced to */ NO_EQUIVALENT,
283 /* min, max, act ct */ 0, 1, 0,
284 /* opt state flags */ PASSWD_FLAGS, 0,
285 /* last opt argumnt */ { NULL }, /* --passwd */
286 /* arg list/cookie */ NULL,
287 /* must/cannot opts */ NULL, NULL,
288 /* option proc */ NULL,
289 /* desc, NAME, name */ PASSWD_DESC, PASSWD_NAME, PASSWD_name,
290 /* disablement strs */ NULL, NULL },
292 { /* entry idx, value */ 4, VALUE_OPT_SALT,
293 /* equiv idx, value */ 4, VALUE_OPT_SALT,
294 /* equivalenced to */ NO_EQUIVALENT,
295 /* min, max, act ct */ 0, 1, 0,
296 /* opt state flags */ SALT_FLAGS, 0,
297 /* last opt argumnt */ { NULL }, /* --salt */
298 /* arg list/cookie */ NULL,
299 /* must/cannot opts */ NULL, NULL,
300 /* option proc */ optionNumericVal,
301 /* desc, NAME, name */ SALT_DESC, SALT_NAME, SALT_name,
302 /* disablement strs */ NULL, NULL },
304 { /* entry idx, value */ 5, VALUE_OPT_VERIFY,
305 /* equiv idx, value */ 5, VALUE_OPT_VERIFY,
306 /* equivalenced to */ NO_EQUIVALENT,
307 /* min, max, act ct */ 0, 1, 0,
308 /* opt state flags */ VERIFY_FLAGS, 0,
309 /* last opt argumnt */ { NULL }, /* --verify */
310 /* arg list/cookie */ NULL,
311 /* must/cannot opts */ NULL, NULL,
312 /* option proc */ NULL,
313 /* desc, NAME, name */ VERIFY_DESC, VERIFY_NAME, VERIFY_name,
314 /* disablement strs */ NULL, NULL },
316 { /* entry idx, value */ 6, VALUE_OPT_PASSWD_CONF,
317 /* equiv idx, value */ 6, VALUE_OPT_PASSWD_CONF,
318 /* equivalenced to */ NO_EQUIVALENT,
319 /* min, max, act ct */ 0, 1, 0,
320 /* opt state flags */ PASSWD_CONF_FLAGS, 0,
321 /* last opt argumnt */ { NULL }, /* --passwd-conf */
322 /* arg list/cookie */ NULL,
323 /* must/cannot opts */ NULL, NULL,
324 /* option proc */ NULL,
325 /* desc, NAME, name */ PASSWD_CONF_DESC, PASSWD_CONF_NAME, PASSWD_CONF_name,
326 /* disablement strs */ NULL, NULL },
328 { /* entry idx, value */ 7, VALUE_OPT_CREATE_CONF,
329 /* equiv idx, value */ 7, VALUE_OPT_CREATE_CONF,
330 /* equivalenced to */ NO_EQUIVALENT,
331 /* min, max, act ct */ 0, 1, 0,
332 /* opt state flags */ CREATE_CONF_FLAGS, 0,
333 /* last opt argumnt */ { NULL }, /* --create-conf */
334 /* arg list/cookie */ NULL,
335 /* must/cannot opts */ NULL, NULL,
336 /* option proc */ NULL,
337 /* desc, NAME, name */ CREATE_CONF_DESC, CREATE_CONF_NAME, CREATE_CONF_name,
338 /* disablement strs */ NULL, NULL },
340 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
341 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
342 /* equivalenced to */ NO_EQUIVALENT,
343 /* min, max, act ct */ 0, 1, 0,
344 /* opt state flags */ VER_FLAGS, 0,
345 /* last opt argumnt */ { NULL },
346 /* arg list/cookie */ NULL,
347 /* must/cannot opts */ NULL, NULL,
348 /* option proc */ VER_PROC,
349 /* desc, NAME, name */ VER_DESC, NULL, VER_name,
350 /* disablement strs */ NULL, NULL },
354 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
355 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
356 /* equivalenced to */ NO_EQUIVALENT,
357 /* min, max, act ct */ 0, 1, 0,
358 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
359 /* last opt argumnt */ { NULL },
360 /* arg list/cookie */ NULL,
361 /* must/cannot opts */ NULL, NULL,
362 /* option proc */ doUsageOpt,
363 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
364 /* disablement strs */ NULL, NULL },
366 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
367 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
368 /* equivalenced to */ NO_EQUIVALENT,
369 /* min, max, act ct */ 0, 1, 0,
370 /* opt state flags */ MORE_HELP_FLAGS, 0,
371 /* last opt argumnt */ { NULL },
372 /* arg list/cookie */ NULL,
373 /* must/cannot opts */ NULL, NULL,
374 /* option proc */ optionPagedUsage,
375 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
376 /* disablement strs */ NULL, NULL }
380 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
382 * Define the srptool Option Environment
384 #define zPROGNAME (srptool_opt_strs+1400)
385 #define zUsageTitle (srptool_opt_strs+1408)
386 #define zRcName NULL
387 #define apzHomeList NULL
388 #define zBugsAddr (srptool_opt_strs+1509)
389 #define zExplain (srptool_opt_strs+1528)
390 #define zDetail (srptool_opt_strs+1531)
391 #define zFullVersion (srptool_opt_strs+1973)
392 /* extracted from optcode.tlib near line 350 */
394 #if defined(ENABLE_NLS)
395 # define OPTPROC_BASE OPTPROC_TRANSLATE | OPTPROC_NXLAT_OPT
396 static tOptionXlateProc translate_option_strings;
397 #else
398 # define OPTPROC_BASE OPTPROC_NONE
399 # define translate_option_strings NULL
400 #endif /* ENABLE_NLS */
403 #define srptool_full_usage (NULL)
405 #define srptool_short_usage (srptool_opt_strs+1991)
407 #endif /* not defined __doxygen__ */
410 * Create the static procedure(s) declared above.
413 * The callout function that invokes the optionUsage function.
415 * @param pOptions the AutoOpts option description structure
416 * @param pOptDesc the descriptor for the "help" (usage) option.
417 * @noreturn
419 static void
420 doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
422 optionUsage(&srptoolOptions, SRPTOOL_EXIT_SUCCESS);
423 /* NOTREACHED */
424 (void)pOptDesc;
425 (void)pOptions;
428 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
430 * Code to handle the debug option.
432 * @param pOptions the srptool options data structure
433 * @param pOptDesc the option descriptor for this option.
435 static void
436 doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
438 static struct {long rmin, rmax;} const rng[1] = {
439 { 0 , 9999 } };
440 int ix;
442 if (pOptions <= OPTPROC_EMIT_LIMIT)
443 goto emit_ranges;
444 optionNumericVal(pOptions, pOptDesc);
446 for (ix = 0; ix < 1; ix++) {
447 if (pOptDesc->optArg.argInt < rng[ix].rmin)
448 continue; /* ranges need not be ordered. */
449 if (pOptDesc->optArg.argInt == rng[ix].rmin)
450 return;
451 if (rng[ix].rmax == LONG_MIN)
452 continue;
453 if (pOptDesc->optArg.argInt <= rng[ix].rmax)
454 return;
457 option_usage_fp = stderr;
459 emit_ranges:
461 optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
463 /* extracted from optmain.tlib near line 1113 */
466 * The directory containing the data associated with srptool.
468 #ifndef PKGDATADIR
469 # define PKGDATADIR ""
470 #endif
473 * Information about the person or institution that packaged srptool
474 * for the current distribution.
476 #ifndef WITH_PACKAGER
477 # define srptool_packager_info NULL
478 #else
479 static char const srptool_packager_info[] =
480 "Packaged by " WITH_PACKAGER
482 # ifdef WITH_PACKAGER_VERSION
483 " ("WITH_PACKAGER_VERSION")"
484 # endif
486 # ifdef WITH_PACKAGER_BUG_REPORTS
487 "\nReport srptool bugs to " WITH_PACKAGER_BUG_REPORTS
488 # endif
489 "\n";
490 #endif
491 #ifndef __doxygen__
493 #endif /* __doxygen__ */
495 * The option definitions for srptool. The one structure that
496 * binds them all.
498 tOptions srptoolOptions = {
499 OPTIONS_STRUCT_VERSION,
500 0, NULL, /* original argc + argv */
501 ( OPTPROC_BASE
502 + OPTPROC_ERRSTOP
503 + OPTPROC_SHORTOPT
504 + OPTPROC_LONGOPT
505 + OPTPROC_NO_REQ_OPT
506 + OPTPROC_NO_ARGS
507 + OPTPROC_GNUUSAGE
508 + OPTPROC_MISUSE ),
509 0, NULL, /* current option index, current option */
510 NULL, NULL, zPROGNAME,
511 zRcName, zCopyright, zLicenseDescrip,
512 zFullVersion, apzHomeList, zUsageTitle,
513 zExplain, zDetail, optDesc,
514 zBugsAddr, /* address to send bugs to */
515 NULL, NULL, /* extensions/saved state */
516 optionUsage, /* usage procedure */
517 translate_option_strings, /* translation procedure */
519 * Indexes to special options
521 { INDEX_OPT_MORE_HELP, /* more-help option index */
522 NO_EQUIVALENT, /* save option index */
523 NO_EQUIVALENT, /* '-#' option index */
524 NO_EQUIVALENT /* index of default opt */
526 11 /* full option count */, 8 /* user option count */,
527 srptool_full_usage, srptool_short_usage,
528 NULL, NULL,
529 PKGDATADIR, srptool_packager_info
532 #if ENABLE_NLS
533 #include <stdio.h>
534 #include <stdlib.h>
535 #include <string.h>
536 #include <unistd.h>
537 #include <autoopts/usage-txt.h>
539 static char* AO_gettext(char const* pz);
540 static void coerce_it(void** s);
543 * AutoGen specific wrapper function for gettext.
544 * It relies on the macro _() to convert from English to the target
545 * language, then strdup-duplicates the result string.
547 * @param[in] pz the input text used as a lookup key.
548 * @returns the translated text (if there is one),
549 * or the original text (if not).
551 static char *
552 AO_gettext(char const* pz)
554 char* pzRes;
555 if (pz == NULL)
556 return NULL;
557 pzRes = _(pz);
558 if (pzRes == pz)
559 return pzRes;
560 pzRes = strdup(pzRes);
561 if (pzRes == NULL) {
562 fputs(_("No memory for duping translated strings\n"), stderr);
563 exit(SRPTOOL_EXIT_FAILURE);
565 return pzRes;
568 static void coerce_it(void** s) { *s = AO_gettext(*s);
572 * Translate all the translatable strings in the srptoolOptions
573 * structure defined above. This is done only once.
575 static void
576 translate_option_strings(void)
578 tOptions * const pOpt = &srptoolOptions;
581 * Guard against re-translation. It won't work. The strings will have
582 * been changed by the first pass through this code. One shot only.
584 if (option_usage_text.field_ct != 0) {
586 * Do the translations. The first pointer follows the field count
587 * field. The field count field is the size of a pointer.
589 tOptDesc * pOD = pOpt->pOptDesc;
590 char ** ppz = (char**)(void*)&(option_usage_text);
591 int ix = option_usage_text.field_ct;
593 do {
594 ppz++;
595 *ppz = AO_gettext(*ppz);
596 } while (--ix > 0);
598 coerce_it((void*)&(pOpt->pzCopyright));
599 coerce_it((void*)&(pOpt->pzCopyNotice));
600 coerce_it((void*)&(pOpt->pzFullVersion));
601 coerce_it((void*)&(pOpt->pzUsageTitle));
602 coerce_it((void*)&(pOpt->pzExplain));
603 coerce_it((void*)&(pOpt->pzDetail));
604 coerce_it((void*)&(pOpt->pzPackager));
605 coerce_it((void*)&(pOpt->pzShortUsage));
606 option_usage_text.field_ct = 0;
608 for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
609 coerce_it((void*)&(pOD->pzText));
612 if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
613 tOptDesc * pOD = pOpt->pOptDesc;
614 int ix;
616 for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
617 coerce_it((void*)&(pOD->pz_Name));
618 coerce_it((void*)&(pOD->pz_DisableName));
619 coerce_it((void*)&(pOD->pz_DisablePfx));
621 /* prevent re-translation */
622 srptoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
626 #endif /* ENABLE_NLS */
628 #ifdef __cplusplus
630 #endif
631 /* srptool-args.c ends here */