From: Nikos Mavrogiannopoulos Date: Sat, 21 Jan 2012 10:34:02 +0000 (+0100) Subject: Added missing files. X-Git-Tag: gnutls_3_0_13~247 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2f8a10a352a41f72e7faf3fa2ee87b2c3c3b892;p=thirdparty%2Fgnutls.git Added missing files. --- diff --git a/.gitignore b/.gitignore index a80e064204..82e33e3893 100644 --- a/.gitignore +++ b/.gitignore @@ -421,12 +421,8 @@ po/quot.sed po/remove-potcdate.sed po/remove-potcdate.sin po/stamp-po -src/cli-debug-args.c src/cli-debug-args.def -src/cli-debug-args.h -src/psk-args.c src/psk-args.def -src/psk-args.h src/cli-args.def src/srptool-args.def src/Makefile diff --git a/doc/manpages/gnutls-cli-debug.1 b/doc/manpages/gnutls-cli-debug.1 index 95ab9f34f7..75a3a0af09 100644 --- a/doc/manpages/gnutls-cli-debug.1 +++ b/doc/manpages/gnutls-cli-debug.1 @@ -2,7 +2,7 @@ .\" .\" DO NOT EDIT THIS FILE (cli-debug-args.man) .\" -.\" It has been AutoGen-ed January 21, 2012 at 02:00:25 AM by AutoGen 5.12 +.\" It has been AutoGen-ed January 21, 2012 at 11:32:41 AM by AutoGen 5.12 .\" From the definitions ../../src/cli-debug-args.def .\" and the template file agman-cmd.tpl .\" diff --git a/doc/manpages/gnutls-serv.1 b/doc/manpages/gnutls-serv.1 index fda8e23885..97da0e6f28 100644 --- a/doc/manpages/gnutls-serv.1 +++ b/doc/manpages/gnutls-serv.1 @@ -2,7 +2,7 @@ .\" .\" DO NOT EDIT THIS FILE (serv-args.man) .\" -.\" It has been AutoGen-ed January 21, 2012 at 01:58:11 AM by AutoGen 5.12 +.\" It has been AutoGen-ed January 21, 2012 at 11:32:41 AM by AutoGen 5.12 .\" From the definitions ../../src/serv-args.def .\" and the template file agman-cmd.tpl .\" @@ -11,9 +11,9 @@ gnutls-serv \- GnuTLS server .SH SYNOPSIS .B gnutls-serv .\" Mixture of short (flag) options and long options -.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \-\-\fIopt\-name\fP " [[=| ]\fIvalue\fP]]..." +.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \-\-\fIopt\-name\fP " [[=| ]\fIvalue\fP]]..." .PP -Operands and options may be intermixed. They will be reordered. +All arguments must be options. .SH "DESCRIPTION" Server program that listens to incoming TLS connections. .SH "OPTIONS" diff --git a/doc/manpages/psktool.1 b/doc/manpages/psktool.1 index e976db6c56..bfc21d740e 100644 --- a/doc/manpages/psktool.1 +++ b/doc/manpages/psktool.1 @@ -2,7 +2,7 @@ .\" .\" DO NOT EDIT THIS FILE (psk-args.man) .\" -.\" It has been AutoGen-ed January 21, 2012 at 02:00:25 AM by AutoGen 5.12 +.\" It has been AutoGen-ed January 21, 2012 at 11:32:41 AM by AutoGen 5.12 .\" From the definitions ../../src/psk-args.def .\" and the template file agman-cmd.tpl .\" diff --git a/doc/manpages/srptool.1 b/doc/manpages/srptool.1 index 12f21541d3..f21bdd8e6d 100644 --- a/doc/manpages/srptool.1 +++ b/doc/manpages/srptool.1 @@ -2,7 +2,7 @@ .\" .\" DO NOT EDIT THIS FILE (srptool-args.man) .\" -.\" It has been AutoGen-ed January 21, 2012 at 02:00:25 AM by AutoGen 5.12 +.\" It has been AutoGen-ed January 21, 2012 at 11:32:42 AM by AutoGen 5.12 .\" From the definitions ../../src/srptool-args.def .\" and the template file agman-cmd.tpl .\" @@ -58,12 +58,12 @@ just verify the password.. .sp Verifies the password provided against the password file. .TP -.BR \-v " \fIfile\fP, " \-\-passwd\-conf "=" \fIfile\fP +.BR \-v " \fIstring\fP, " \-\-passwd\-conf "=" \fIstring\fP specify a password conf file.. .sp Specify a filename or a PKCS #11 URL to read the CAs from. .TP -.BR \-\-create\-conf "=\fIfile\fP" +.BR \-\-create\-conf "=\fIstring\fP" Generate a password configuration file.. .sp This generates a password configuration file (tpasswd.conf) diff --git a/src/cli-args.c b/src/cli-args.c index ade11abe99..ad9d1625b8 100644 --- a/src/cli-args.c +++ b/src/cli-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (cli-args.c) * - * It has been AutoGen-ed January 21, 2012 at 02:15:53 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 11:30:16 AM by AutoGen 5.12 * From the definitions cli-args.def * and the template file options * diff --git a/src/cli-args.h b/src/cli-args.h index 49cf4459f4..1540c63437 100644 --- a/src/cli-args.h +++ b/src/cli-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (cli-args.h) * - * It has been AutoGen-ed January 21, 2012 at 02:15:53 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 11:30:16 AM by AutoGen 5.12 * From the definitions cli-args.def * and the template file options * diff --git a/src/cli-debug-args.c b/src/cli-debug-args.c new file mode 100644 index 0000000000..3d0568bef9 --- /dev/null +++ b/src/cli-debug-args.c @@ -0,0 +1,480 @@ +/* -*- buffer-read-only: t -*- vi: set ro: + * + * DO NOT EDIT THIS FILE (cli-debug-args.c) + * + * It has been AutoGen-ed January 21, 2012 at 11:30:18 AM by AutoGen 5.12 + * From the definitions cli-debug-args.def + * and the template file options + * + * Generated from AutoOpts 35:0:10 templates. + * + * AutoOpts is a copyrighted work. This source file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the gnutls-cli-debug author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. + * + * This source file is copyrighted and licensed under the following terms: + * + * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved. + * This is free software. It is licensed for use, modification and + * redistribution under the terms of the + * GNU General Public License, version 3 or later + * + * +PFX>gnutls-cli-debug is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gnutls-cli-debug is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#define OPTION_CODE_COMPILE 1 +#include "cli-debug-args.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern FILE * option_usage_fp; + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ +static char const zCopyright[284] = +"gnutls-cli-debug 3.0.12\n\ +Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n\ +This is free software. It is licensed for use, modification and\n\ +redistribution under the terms of the\n\ +GNU General Public License, version 3 or later\n\ + \n"; +static char const zLicenseDescrip[621] = +"gnutls-cli-debug is free software: you can redistribute it and/or modify\n\ +it under the terms of the GNU General Public License as published by\n\ +the Free Software Foundation, either version 3 of the License, or (at\n\ +your option) any later version.\n\n\ +gnutls-cli-debug is distributed in the hope that it will be useful, but\n\ +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n\ +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n\ +for more details.\n\n\ +You should have received a copy of the GNU General Public License along\n\ +with this program. If not, see .\n"; + +extern tUsageProc optionUsage; + +#ifndef NULL +# define NULL 0 +#endif + +/* + * Debug option description: + */ +static char const zDebugText[] = + "Enable debugging"; +static char const zDebug_NAME[] = "DEBUG"; +static char const zDebug_Name[] = "debug"; +#define DEBUG_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + +/* + * Verbose option description: + */ +static char const zVerboseText[] = + "More verbose output"; +static char const zVerbose_NAME[] = "VERBOSE"; +static char const zVerbose_Name[] = "verbose"; +#define VERBOSE_FLAGS (OPTST_DISABLED) + +/* + * Port option description: + */ +static char const zPortText[] = + "The port to connect to"; +static char const zPort_NAME[] = "PORT"; +static char const zPort_Name[] = "port"; +#define PORT_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + +/* + * Help/More_Help/Version option descriptions: + */ +static char const zHelpText[] = "Display extended usage information and exit"; +static char const zHelp_Name[] = "help"; +#ifdef HAVE_WORKING_FORK +#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) +static char const zMore_Help_Name[] = "more-help"; +static char const zMore_HelpText[] = "Extended usage information passed thru pager"; +#else +#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zMore_Help_Name NULL +#define zMore_HelpText NULL +#endif +#ifdef NO_OPTIONAL_OPT_ARGS +# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT +#else +# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ + OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT +#endif + +static char const zVersionText[] = "Output version information and exit"; +static char const zVersion_Name[] = "version"; +/* + * Declare option callback procedures + */ +extern tOptProc + optionBooleanVal, optionNestedVal, optionNumericVal, + optionPagedUsage, optionPrintVersion, optionResetOpt, + optionStackArg, optionTimeDate, optionTimeVal, + optionUnstackArg, optionVersionStderr; +static tOptProc + doOptDebug, doOptPort, doUsageOpt; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Define the Gnutls_Cli_Debug Option Descriptions. + */ +static tOptDesc optDesc[OPTION_CT] = { + { /* entry idx, value */ 0, VALUE_OPT_DEBUG, + /* equiv idx, value */ 0, VALUE_OPT_DEBUG, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ DEBUG_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doOptDebug, + /* desc, NAME, name */ zDebugText, zDebug_NAME, zDebug_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 1, VALUE_OPT_VERBOSE, + /* equiv idx, value */ 1, VALUE_OPT_VERBOSE, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, NOLIMIT, 0, + /* opt state flags */ VERBOSE_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 2, VALUE_OPT_PORT, + /* equiv idx, value */ 2, VALUE_OPT_PORT, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ PORT_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doOptPort, + /* desc, NAME, name */ zPortText, zPort_NAME, zPort_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_VERSION_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionPrintVersion, + /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, + /* disablement strs */ NULL, NULL }, + + + + { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doUsageOpt, + /* desc, NAME, name */ zHelpText, NULL, zHelp_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionPagedUsage, + /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name, + /* disablement strs */ NULL, NULL } +}; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Define the Gnutls_Cli_Debug Option Environment + */ +static char const zPROGNAME[17] = "GNUTLS_CLI_DEBUG"; +static char const zUsageTitle[112] = +"gnutls-cli-debug - GnuTLS debug client - Ver. 3.0.12\n\ +USAGE: %s [ - [] | --[{=| }] ]... \n"; +#define zRcName NULL +#define apzHomeList NULL + +static char const zBugsAddr[19] = "bug-gnutls@gnu.org"; +#define zExplain NULL +static char const zDetail[171] = "\n\ +TLS debug client. It sets up multiple TLS connections to a server and\n\ +queries its capabilities. Can be used to check for servers with special\n\ +needs or bugs.\n"; +static char const zFullVersion[] = GNUTLS_CLI_DEBUG_FULL_VERSION; +/* extracted from optcode.tlib near line 515 */ + +#if defined(ENABLE_NLS) +# define OPTPROC_BASE OPTPROC_TRANSLATE + static tOptionXlateProc translate_option_strings; +#else +# define OPTPROC_BASE OPTPROC_NONE +# define translate_option_strings NULL +#endif /* ENABLE_NLS */ + + +#define gnutls_cli_debug_full_usage NULL +static char const gnutls_cli_debug_short_usage[] = + "Usage: gnutls-cli-debug [options] hostname\n\ +gnutls-cli --help for usage instructions.\n"; + +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +#ifndef WITH_PACKAGER +# define gnutls_cli_debug_packager_info NULL +#else +static char const gnutls_cli_debug_packager_info[] = + "Packaged by " WITH_PACKAGER + +# ifdef WITH_PACKAGER_VERSION + " ("WITH_PACKAGER_VERSION")" +# endif + +# ifdef WITH_PACKAGER_BUG_REPORTS + "\nReport gnutls_cli_debug bugs to " WITH_PACKAGER_BUG_REPORTS +# endif + "\n"; +#endif + +tOptions gnutls_cli_debugOptions = { + OPTIONS_STRUCT_VERSION, + 0, NULL, /* original argc + argv */ + ( OPTPROC_BASE + + OPTPROC_ERRSTOP + + OPTPROC_SHORTOPT + + OPTPROC_LONGOPT + + OPTPROC_NO_REQ_OPT + + OPTPROC_ARGS_REQ + + OPTPROC_REORDER + + OPTPROC_GNUUSAGE + + OPTPROC_MISUSE ), + 0, NULL, /* current option index, current option */ + NULL, NULL, zPROGNAME, + zRcName, zCopyright, zLicenseDescrip, + zFullVersion, apzHomeList, zUsageTitle, + zExplain, zDetail, optDesc, + zBugsAddr, /* address to send bugs to */ + NULL, NULL, /* extensions/saved state */ + optionUsage, /* usage procedure */ + translate_option_strings, /* translation procedure */ + /* + * Indexes to special options + */ + { INDEX_OPT_MORE_HELP, /* more-help option index */ + NO_EQUIVALENT, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ + NO_EQUIVALENT /* index of default opt */ + }, + 6 /* full option count */, 3 /* user option count */, + gnutls_cli_debug_full_usage, gnutls_cli_debug_short_usage, + NULL, NULL, + PKGDATADIR, gnutls_cli_debug_packager_info +}; + +/* + * Create the static procedure(s) declared above. + */ +static void +doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) +{ + (void)pOptions; + USAGE(GNUTLS_CLI_DEBUG_EXIT_SUCCESS); +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * For the debug option. + */ +static void +doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc) +{ + static const struct {long const rmin, rmax;} rng[1] = { + { 0 , 9999 } }; + int ix; + + if (pOptions <= OPTPROC_EMIT_LIMIT) + goto emit_ranges; + optionNumericVal(pOptions, pOptDesc); + + for (ix = 0; ix < 1; ix++) { + if (pOptDesc->optArg.argInt < rng[ix].rmin) + continue; /* ranges need not be ordered. */ + if (pOptDesc->optArg.argInt == rng[ix].rmin) + return; + if (rng[ix].rmax == LONG_MIN) + continue; + if (pOptDesc->optArg.argInt <= rng[ix].rmax) + return; + } + + option_usage_fp = stderr; + +emit_ranges: + + optionShowRange(pOptions, pOptDesc, (void *)rng, 1); +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * For the port option. + */ +static void +doOptPort(tOptions* pOptions, tOptDesc* pOptDesc) +{ + static const struct {long const rmin, rmax;} rng[1] = { + { 0 , 65536 } }; + int ix; + + if (pOptions <= OPTPROC_EMIT_LIMIT) + goto emit_ranges; + optionNumericVal(pOptions, pOptDesc); + + for (ix = 0; ix < 1; ix++) { + if (pOptDesc->optArg.argInt < rng[ix].rmin) + continue; /* ranges need not be ordered. */ + if (pOptDesc->optArg.argInt == rng[ix].rmin) + return; + if (rng[ix].rmax == LONG_MIN) + continue; + if (pOptDesc->optArg.argInt <= rng[ix].rmax) + return; + } + + option_usage_fp = stderr; + +emit_ranges: + + optionShowRange(pOptions, pOptDesc, (void *)rng, 1); +} +/* extracted from optcode.tlib near line 666 */ + +#if ENABLE_NLS +#include +#include +#include +#include +#include + +static char* AO_gettext(char const* pz); +static void coerce_it(void** s); + +static char* +AO_gettext(char const* pz) +{ + char* pzRes; + if (pz == NULL) + return NULL; + pzRes = _(pz); + if (pzRes == pz) + return pzRes; + pzRes = strdup(pzRes); + if (pzRes == NULL) { + fputs(_("No memory for duping translated strings\n"), stderr); + exit(GNUTLS_CLI_DEBUG_EXIT_FAILURE); + } + return pzRes; +} + +static void coerce_it(void** s) { *s = AO_gettext(*s); +} + +/* + * This invokes the translation code (e.g. gettext(3)). + */ +static void +translate_option_strings(void) +{ + tOptions * const pOpt = &gnutls_cli_debugOptions; + + /* + * Guard against re-translation. It won't work. The strings will have + * been changed by the first pass through this code. One shot only. + */ + if (option_usage_text.field_ct != 0) { + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc * pOD = pOpt->pOptDesc; + char ** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; + + do { + ppz++; + *ppz = AO_gettext(*ppz); + } while (--ix > 0); + + coerce_it((void*)&(pOpt->pzCopyright)); + coerce_it((void*)&(pOpt->pzCopyNotice)); + coerce_it((void*)&(pOpt->pzFullVersion)); + coerce_it((void*)&(pOpt->pzUsageTitle)); + coerce_it((void*)&(pOpt->pzExplain)); + coerce_it((void*)&(pOpt->pzDetail)); + coerce_it((void*)&(pOpt->pzPackager)); + coerce_it((void*)&(pOpt->pzShortUsage)); + option_usage_text.field_ct = 0; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); + } + + if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { + tOptDesc * pOD = pOpt->pOptDesc; + int ix; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); + } + /* prevent re-translation */ + gnutls_cli_debugOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; + } +} + +#endif /* ENABLE_NLS */ + +#ifdef __cplusplus +} +#endif +/* cli-debug-args.c ends here */ diff --git a/src/cli-debug-args.h b/src/cli-debug-args.h new file mode 100644 index 0000000000..537d1b22f6 --- /dev/null +++ b/src/cli-debug-args.h @@ -0,0 +1,188 @@ +/* -*- buffer-read-only: t -*- vi: set ro: + * + * DO NOT EDIT THIS FILE (cli-debug-args.h) + * + * It has been AutoGen-ed January 21, 2012 at 11:30:18 AM by AutoGen 5.12 + * From the definitions cli-debug-args.def + * and the template file options + * + * Generated from AutoOpts 35:0:10 templates. + * + * AutoOpts is a copyrighted work. This header file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the gnutls-cli-debug author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. + * + * This source file is copyrighted and licensed under the following terms: + * + * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved. + * This is free software. It is licensed for use, modification and + * redistribution under the terms of the + * GNU General Public License, version 3 or later + * + * +PFX>gnutls-cli-debug is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gnutls-cli-debug is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ +/* + * This file contains the programmatic interface to the Automated + * Options generated for the gnutls-cli-debug program. + * These macros are documented in the AutoGen info file in the + * "AutoOpts" chapter. Please refer to that doc for usage help. + */ +#ifndef AUTOOPTS_CLI_DEBUG_ARGS_H_GUARD +#define AUTOOPTS_CLI_DEBUG_ARGS_H_GUARD 1 +#include "config.h" +#include + +/* + * Ensure that the library used for compiling this generated header is at + * least as new as the version current when the header template was released + * (not counting patch version increments). Also ensure that the oldest + * tolerable version is at least as old as what was current when the header + * template was released. + */ +#define AO_TEMPLATE_VERSION 143360 +#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ + || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) +# error option template version mismatches autoopts/options.h header + Choke Me. +#endif + +/* + * Enumeration of each option: + */ +typedef enum { + INDEX_OPT_DEBUG = 0, + INDEX_OPT_VERBOSE = 1, + INDEX_OPT_PORT = 2, + INDEX_OPT_VERSION = 3, + INDEX_OPT_HELP = 4, + INDEX_OPT_MORE_HELP = 5 +} teOptIndex; + +#define OPTION_CT 6 +#define GNUTLS_CLI_DEBUG_VERSION "3.0.12" +#define GNUTLS_CLI_DEBUG_FULL_VERSION "gnutls-cli-debug 3.0.12" + +/* + * Interface defines for all options. Replace "n" with the UPPER_CASED + * option name (as in the teOptIndex enumeration above). + * e.g. HAVE_OPT(DEBUG) + */ +#define DESC(n) (gnutls_cli_debugOptions.pOptDesc[INDEX_OPT_## n]) +#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) +#define OPT_ARG(n) (DESC(n).optArg.argString) +#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) +#define COUNT_OPT(n) (DESC(n).optOccCt) +#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) +#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) +#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) +#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) +#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) +#define CLEAR_OPT(n) STMTS( \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ + if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ + DESC(n).fOptState |= OPTST_DISABLED; \ + DESC(n).optCookie = NULL ) + +/* * * * * * + * + * Enumeration of gnutls-cli-debug exit codes + */ +typedef enum { + GNUTLS_CLI_DEBUG_EXIT_SUCCESS = 0, + GNUTLS_CLI_DEBUG_EXIT_FAILURE = 1 +} gnutls_cli_debug_exit_code_t; +/* * * * * * + * + * Interface defines for specific options. + */ +#define VALUE_OPT_DEBUG 'd' + +#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) +#define VALUE_OPT_VERBOSE 'V' +#define VALUE_OPT_PORT 'p' + +#define OPT_VALUE_PORT (DESC(PORT).optArg.argInt) +#define VALUE_OPT_HELP '?' +#define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION 'v' +/* + * Interface defines not associated with particular options + */ +#define ERRSKIP_OPTERR STMTS(gnutls_cli_debugOptions.fOptSet &= ~OPTPROC_ERRSTOP) +#define ERRSTOP_OPTERR STMTS(gnutls_cli_debugOptions.fOptSet |= OPTPROC_ERRSTOP) +#define RESTART_OPT(n) STMTS( \ + gnutls_cli_debugOptions.curOptIdx = (n); \ + gnutls_cli_debugOptions.pzCurOpt = NULL) +#define START_OPT RESTART_OPT(1) +#define USAGE(c) (*gnutls_cli_debugOptions.pUsageProc)(&gnutls_cli_debugOptions, c) +/* extracted from opthead.tlib near line 451 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* * * * * * + * + * Globals exported from the GnuTLS debug client option definitions + */ +#include + +/* * * * * * + * + * Declare the gnutls-cli-debug option descriptor. + */ +extern tOptions gnutls_cli_debugOptions; + +#if defined(ENABLE_NLS) +# ifndef _ +# include +static inline char* aoGetsText(char const* pz) { + if (pz == NULL) return NULL; + return (char*)gettext(pz); +} +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(gnutls_cli_debugOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(gnutls_cli_debugOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(gnutls_cli_debugOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(gnutls_cli_debugOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ + +#ifdef __cplusplus +} +#endif +#endif /* AUTOOPTS_CLI_DEBUG_ARGS_H_GUARD */ +/* cli-debug-args.h ends here */ diff --git a/src/psk-args.c b/src/psk-args.c new file mode 100644 index 0000000000..b5941534ca --- /dev/null +++ b/src/psk-args.c @@ -0,0 +1,502 @@ +/* -*- buffer-read-only: t -*- vi: set ro: + * + * DO NOT EDIT THIS FILE (psk-args.c) + * + * It has been AutoGen-ed January 21, 2012 at 11:33:02 AM by AutoGen 5.12 + * From the definitions psk-args.def + * and the template file options + * + * Generated from AutoOpts 35:0:10 templates. + * + * AutoOpts is a copyrighted work. This source file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the psktool author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. + * + * This source file is copyrighted and licensed under the following terms: + * + * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved. + * This is free software. It is licensed for use, modification and + * redistribution under the terms of the + * GNU General Public License, version 3 or later + * + * +PFX>psktool is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * psktool is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#define OPTION_CODE_COMPILE 1 +#include "psk-args.h" + +#ifdef __cplusplus +extern "C" { +#endif +extern FILE * option_usage_fp; + +/* TRANSLATORS: choose the translation for option names wisely because you + cannot ever change your mind. */ +static char const zCopyright[275] = +"psktool 3.0.12\n\ +Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n\ +This is free software. It is licensed for use, modification and\n\ +redistribution under the terms of the\n\ +GNU General Public License, version 3 or later\n\ + \n"; +static char const zLicenseDescrip[603] = +"psktool is free software: you can redistribute it and/or modify it under\n\ +the terms of the GNU General Public License as published by the Free\n\ +Software Foundation, either version 3 of the License, or (at your option)\n\ +any later version.\n\n\ +psktool is distributed in the hope that it will be useful, but WITHOUT\n\ +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\ +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n\ +for more details.\n\n\ +You should have received a copy of the GNU General Public License along\n\ +with this program. If not, see .\n"; + +extern tUsageProc optionUsage; + +#ifndef NULL +# define NULL 0 +#endif + +/* + * Debug option description: + */ +static char const zDebugText[] = + "Enable debugging."; +static char const zDebug_NAME[] = "DEBUG"; +static char const zDebug_Name[] = "debug"; +#define DEBUG_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + +/* + * Keysize option description: + */ +static char const zKeysizeText[] = + "specify the key size in bytes"; +static char const zKeysize_NAME[] = "KEYSIZE"; +static char const zKeysize_Name[] = "keysize"; +#define KEYSIZE_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) + +/* + * Username option description: + */ +static char const zUsernameText[] = + "specify a username"; +static char const zUsername_NAME[] = "USERNAME"; +static char const zUsername_Name[] = "username"; +#define USERNAME_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + +/* + * Passwd option description: + */ +static char const zPasswdText[] = + "specify a password file."; +static char const zPasswd_NAME[] = "PASSWD"; +static char const zPasswd_Name[] = "passwd"; +#define PASSWD_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + +/* + * Help/More_Help/Version option descriptions: + */ +static char const zHelpText[] = "Display extended usage information and exit"; +static char const zHelp_Name[] = "help"; +#ifdef HAVE_WORKING_FORK +#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) +static char const zMore_Help_Name[] = "more-help"; +static char const zMore_HelpText[] = "Extended usage information passed thru pager"; +#else +#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zMore_Help_Name NULL +#define zMore_HelpText NULL +#endif +#ifdef NO_OPTIONAL_OPT_ARGS +# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT +#else +# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ + OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT +#endif + +static char const zVersionText[] = "Output version information and exit"; +static char const zVersion_Name[] = "version"; +/* + * Declare option callback procedures + */ +extern tOptProc + optionBooleanVal, optionNestedVal, optionNumericVal, + optionPagedUsage, optionPrintVersion, optionResetOpt, + optionStackArg, optionTimeDate, optionTimeVal, + optionUnstackArg, optionVersionStderr; +static tOptProc + doOptDebug, doOptKeysize, doUsageOpt; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Define the Psktool Option Descriptions. + */ +static tOptDesc optDesc[OPTION_CT] = { + { /* entry idx, value */ 0, VALUE_OPT_DEBUG, + /* equiv idx, value */ 0, VALUE_OPT_DEBUG, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ DEBUG_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doOptDebug, + /* desc, NAME, name */ zDebugText, zDebug_NAME, zDebug_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 1, VALUE_OPT_KEYSIZE, + /* equiv idx, value */ 1, VALUE_OPT_KEYSIZE, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ KEYSIZE_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doOptKeysize, + /* desc, NAME, name */ zKeysizeText, zKeysize_NAME, zKeysize_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 2, VALUE_OPT_USERNAME, + /* equiv idx, value */ 2, VALUE_OPT_USERNAME, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ USERNAME_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zUsernameText, zUsername_NAME, zUsername_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 3, VALUE_OPT_PASSWD, + /* equiv idx, value */ 3, VALUE_OPT_PASSWD, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ PASSWD_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zPasswdText, zPasswd_NAME, zPasswd_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_VERSION_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionPrintVersion, + /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, + /* disablement strs */ NULL, NULL }, + + + + { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doUsageOpt, + /* desc, NAME, name */ zHelpText, NULL, zHelp_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionPagedUsage, + /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name, + /* disablement strs */ NULL, NULL } +}; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Define the Psktool Option Environment + */ +static char const zPROGNAME[8] = "PSKTOOL"; +static char const zUsageTitle[99] = +"psktool - GnuTLS PSK tool - Ver. 3.0.12\n\ +USAGE: %s [ - [] | --[{=| }] ]... \n"; +#define zRcName NULL +#define apzHomeList NULL + +static char const zBugsAddr[19] = "bug-gnutls@gnu.org"; +#define zExplain NULL +static char const zDetail[126] = "\n\ +Program that generates random keys for use with TLS-PSK. The keys are\n\ +stored in hexadecimal format in a key file.\n"; +static char const zFullVersion[] = PSKTOOL_FULL_VERSION; +/* extracted from optcode.tlib near line 515 */ + +#if defined(ENABLE_NLS) +# define OPTPROC_BASE OPTPROC_TRANSLATE + static tOptionXlateProc translate_option_strings; +#else +# define OPTPROC_BASE OPTPROC_NONE +# define translate_option_strings NULL +#endif /* ENABLE_NLS */ + + +#define psktool_full_usage NULL +static char const psktool_short_usage[] = + "psktool [options]\n\ +psktool --help for usage instructions.\n"; + +#ifndef PKGDATADIR +# define PKGDATADIR "" +#endif + +#ifndef WITH_PACKAGER +# define psktool_packager_info NULL +#else +static char const psktool_packager_info[] = + "Packaged by " WITH_PACKAGER + +# ifdef WITH_PACKAGER_VERSION + " ("WITH_PACKAGER_VERSION")" +# endif + +# ifdef WITH_PACKAGER_BUG_REPORTS + "\nReport psktool bugs to " WITH_PACKAGER_BUG_REPORTS +# endif + "\n"; +#endif + +tOptions psktoolOptions = { + OPTIONS_STRUCT_VERSION, + 0, NULL, /* original argc + argv */ + ( OPTPROC_BASE + + OPTPROC_ERRSTOP + + OPTPROC_SHORTOPT + + OPTPROC_LONGOPT + + OPTPROC_NO_REQ_OPT + + OPTPROC_ARGS_REQ + + OPTPROC_REORDER + + OPTPROC_GNUUSAGE + + OPTPROC_MISUSE ), + 0, NULL, /* current option index, current option */ + NULL, NULL, zPROGNAME, + zRcName, zCopyright, zLicenseDescrip, + zFullVersion, apzHomeList, zUsageTitle, + zExplain, zDetail, optDesc, + zBugsAddr, /* address to send bugs to */ + NULL, NULL, /* extensions/saved state */ + optionUsage, /* usage procedure */ + translate_option_strings, /* translation procedure */ + /* + * Indexes to special options + */ + { INDEX_OPT_MORE_HELP, /* more-help option index */ + NO_EQUIVALENT, /* save option index */ + NO_EQUIVALENT, /* '-#' option index */ + NO_EQUIVALENT /* index of default opt */ + }, + 7 /* full option count */, 4 /* user option count */, + psktool_full_usage, psktool_short_usage, + NULL, NULL, + PKGDATADIR, psktool_packager_info +}; + +/* + * Create the static procedure(s) declared above. + */ +static void +doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) +{ + (void)pOptions; + USAGE(PSKTOOL_EXIT_SUCCESS); +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * For the debug option. + */ +static void +doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc) +{ + static const struct {long const rmin, rmax;} rng[1] = { + { 0 , 9999 } }; + int ix; + + if (pOptions <= OPTPROC_EMIT_LIMIT) + goto emit_ranges; + optionNumericVal(pOptions, pOptDesc); + + for (ix = 0; ix < 1; ix++) { + if (pOptDesc->optArg.argInt < rng[ix].rmin) + continue; /* ranges need not be ordered. */ + if (pOptDesc->optArg.argInt == rng[ix].rmin) + return; + if (rng[ix].rmax == LONG_MIN) + continue; + if (pOptDesc->optArg.argInt <= rng[ix].rmax) + return; + } + + option_usage_fp = stderr; + +emit_ranges: + + optionShowRange(pOptions, pOptDesc, (void *)rng, 1); +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * For the keysize option. + */ +static void +doOptKeysize(tOptions* pOptions, tOptDesc* pOptDesc) +{ + static const struct {long const rmin, rmax;} rng[1] = { + { 0 , 512 } }; + int ix; + + if (pOptions <= OPTPROC_EMIT_LIMIT) + goto emit_ranges; + optionNumericVal(pOptions, pOptDesc); + + for (ix = 0; ix < 1; ix++) { + if (pOptDesc->optArg.argInt < rng[ix].rmin) + continue; /* ranges need not be ordered. */ + if (pOptDesc->optArg.argInt == rng[ix].rmin) + return; + if (rng[ix].rmax == LONG_MIN) + continue; + if (pOptDesc->optArg.argInt <= rng[ix].rmax) + return; + } + + option_usage_fp = stderr; + +emit_ranges: + + optionShowRange(pOptions, pOptDesc, (void *)rng, 1); +} +/* extracted from optcode.tlib near line 666 */ + +#if ENABLE_NLS +#include +#include +#include +#include +#include + +static char* AO_gettext(char const* pz); +static void coerce_it(void** s); + +static char* +AO_gettext(char const* pz) +{ + char* pzRes; + if (pz == NULL) + return NULL; + pzRes = _(pz); + if (pzRes == pz) + return pzRes; + pzRes = strdup(pzRes); + if (pzRes == NULL) { + fputs(_("No memory for duping translated strings\n"), stderr); + exit(PSKTOOL_EXIT_FAILURE); + } + return pzRes; +} + +static void coerce_it(void** s) { *s = AO_gettext(*s); +} + +/* + * This invokes the translation code (e.g. gettext(3)). + */ +static void +translate_option_strings(void) +{ + tOptions * const pOpt = &psktoolOptions; + + /* + * Guard against re-translation. It won't work. The strings will have + * been changed by the first pass through this code. One shot only. + */ + if (option_usage_text.field_ct != 0) { + /* + * Do the translations. The first pointer follows the field count + * field. The field count field is the size of a pointer. + */ + tOptDesc * pOD = pOpt->pOptDesc; + char ** ppz = (char**)(void*)&(option_usage_text); + int ix = option_usage_text.field_ct; + + do { + ppz++; + *ppz = AO_gettext(*ppz); + } while (--ix > 0); + + coerce_it((void*)&(pOpt->pzCopyright)); + coerce_it((void*)&(pOpt->pzCopyNotice)); + coerce_it((void*)&(pOpt->pzFullVersion)); + coerce_it((void*)&(pOpt->pzUsageTitle)); + coerce_it((void*)&(pOpt->pzExplain)); + coerce_it((void*)&(pOpt->pzDetail)); + coerce_it((void*)&(pOpt->pzPackager)); + coerce_it((void*)&(pOpt->pzShortUsage)); + option_usage_text.field_ct = 0; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) + coerce_it((void*)&(pOD->pzText)); + } + + if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { + tOptDesc * pOD = pOpt->pOptDesc; + int ix; + + for (ix = pOpt->optCt; ix > 0; ix--, pOD++) { + coerce_it((void*)&(pOD->pz_Name)); + coerce_it((void*)&(pOD->pz_DisableName)); + coerce_it((void*)&(pOD->pz_DisablePfx)); + } + /* prevent re-translation */ + psktoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; + } +} + +#endif /* ENABLE_NLS */ + +#ifdef __cplusplus +} +#endif +/* psk-args.c ends here */ diff --git a/src/psk-args.h b/src/psk-args.h new file mode 100644 index 0000000000..c9d4d90eaa --- /dev/null +++ b/src/psk-args.h @@ -0,0 +1,190 @@ +/* -*- buffer-read-only: t -*- vi: set ro: + * + * DO NOT EDIT THIS FILE (psk-args.h) + * + * It has been AutoGen-ed January 21, 2012 at 11:33:02 AM by AutoGen 5.12 + * From the definitions psk-args.def + * and the template file options + * + * Generated from AutoOpts 35:0:10 templates. + * + * AutoOpts is a copyrighted work. This header file is not encumbered + * by AutoOpts licensing, but is provided under the licensing terms chosen + * by the psktool author or copyright holder. AutoOpts is + * licensed under the terms of the LGPL. The redistributable library + * (``libopts'') is licensed under the terms of either the LGPL or, at the + * users discretion, the BSD license. See the AutoOpts and/or libopts sources + * for details. + * + * This source file is copyrighted and licensed under the following terms: + * + * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved. + * This is free software. It is licensed for use, modification and + * redistribution under the terms of the + * GNU General Public License, version 3 or later + * + * +PFX>psktool is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * psktool is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ +/* + * This file contains the programmatic interface to the Automated + * Options generated for the psktool program. + * These macros are documented in the AutoGen info file in the + * "AutoOpts" chapter. Please refer to that doc for usage help. + */ +#ifndef AUTOOPTS_PSK_ARGS_H_GUARD +#define AUTOOPTS_PSK_ARGS_H_GUARD 1 +#include "config.h" +#include + +/* + * Ensure that the library used for compiling this generated header is at + * least as new as the version current when the header template was released + * (not counting patch version increments). Also ensure that the oldest + * tolerable version is at least as old as what was current when the header + * template was released. + */ +#define AO_TEMPLATE_VERSION 143360 +#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ + || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) +# error option template version mismatches autoopts/options.h header + Choke Me. +#endif + +/* + * Enumeration of each option: + */ +typedef enum { + INDEX_OPT_DEBUG = 0, + INDEX_OPT_KEYSIZE = 1, + INDEX_OPT_USERNAME = 2, + INDEX_OPT_PASSWD = 3, + INDEX_OPT_VERSION = 4, + INDEX_OPT_HELP = 5, + INDEX_OPT_MORE_HELP = 6 +} teOptIndex; + +#define OPTION_CT 7 +#define PSKTOOL_VERSION "3.0.12" +#define PSKTOOL_FULL_VERSION "psktool 3.0.12" + +/* + * Interface defines for all options. Replace "n" with the UPPER_CASED + * option name (as in the teOptIndex enumeration above). + * e.g. HAVE_OPT(DEBUG) + */ +#define DESC(n) (psktoolOptions.pOptDesc[INDEX_OPT_## n]) +#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) +#define OPT_ARG(n) (DESC(n).optArg.argString) +#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) +#define COUNT_OPT(n) (DESC(n).optOccCt) +#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) +#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) +#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) +#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) +#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) +#define CLEAR_OPT(n) STMTS( \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ + if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ + DESC(n).fOptState |= OPTST_DISABLED; \ + DESC(n).optCookie = NULL ) + +/* * * * * * + * + * Enumeration of psktool exit codes + */ +typedef enum { + PSKTOOL_EXIT_SUCCESS = 0, + PSKTOOL_EXIT_FAILURE = 1 +} psktool_exit_code_t; +/* * * * * * + * + * Interface defines for specific options. + */ +#define VALUE_OPT_DEBUG 'd' + +#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) +#define VALUE_OPT_KEYSIZE 's' + +#define OPT_VALUE_KEYSIZE (DESC(KEYSIZE).optArg.argInt) +#define VALUE_OPT_USERNAME 'u' +#define VALUE_OPT_PASSWD 'p' +#define VALUE_OPT_HELP '?' +#define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_VERSION 'v' +/* + * Interface defines not associated with particular options + */ +#define ERRSKIP_OPTERR STMTS(psktoolOptions.fOptSet &= ~OPTPROC_ERRSTOP) +#define ERRSTOP_OPTERR STMTS(psktoolOptions.fOptSet |= OPTPROC_ERRSTOP) +#define RESTART_OPT(n) STMTS( \ + psktoolOptions.curOptIdx = (n); \ + psktoolOptions.pzCurOpt = NULL) +#define START_OPT RESTART_OPT(1) +#define USAGE(c) (*psktoolOptions.pUsageProc)(&psktoolOptions, c) +/* extracted from opthead.tlib near line 451 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* * * * * * + * + * Globals exported from the GnuTLS PSK tool option definitions + */ +#include + +/* * * * * * + * + * Declare the psktool option descriptor. + */ +extern tOptions psktoolOptions; + +#if defined(ENABLE_NLS) +# ifndef _ +# include +static inline char* aoGetsText(char const* pz) { + if (pz == NULL) return NULL; + return (char*)gettext(pz); +} +# define _(s) aoGetsText(s) +# endif /* _() */ + +# define OPT_NO_XLAT_CFG_NAMES STMTS(psktoolOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT_CFG;) +# define OPT_NO_XLAT_OPT_NAMES STMTS(psktoolOptions.fOptSet |= \ + OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) + +# define OPT_XLAT_CFG_NAMES STMTS(psktoolOptions.fOptSet &= \ + ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) +# define OPT_XLAT_OPT_NAMES STMTS(psktoolOptions.fOptSet &= \ + ~OPTPROC_NXLAT_OPT;) + +#else /* ENABLE_NLS */ +# define OPT_NO_XLAT_CFG_NAMES +# define OPT_NO_XLAT_OPT_NAMES + +# define OPT_XLAT_CFG_NAMES +# define OPT_XLAT_OPT_NAMES + +# ifndef _ +# define _(_s) _s +# endif +#endif /* ENABLE_NLS */ + +#ifdef __cplusplus +} +#endif +#endif /* AUTOOPTS_PSK_ARGS_H_GUARD */ +/* psk-args.h ends here */ diff --git a/src/serv-args.c b/src/serv-args.c index 8311611c91..2fc66a781f 100644 --- a/src/serv-args.c +++ b/src/serv-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (serv-args.c) * - * It has been AutoGen-ed January 21, 2012 at 02:14:19 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 11:30:09 AM by AutoGen 5.12 * From the definitions serv-args.def * and the template file options * diff --git a/src/serv-args.h b/src/serv-args.h index b34ea76b0a..a8c1a23156 100644 --- a/src/serv-args.h +++ b/src/serv-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (serv-args.h) * - * It has been AutoGen-ed January 21, 2012 at 02:14:19 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 11:30:09 AM by AutoGen 5.12 * From the definitions serv-args.def * and the template file options * diff --git a/src/srptool-args.c b/src/srptool-args.c index 2fc0990ab8..86780d4bde 100644 --- a/src/srptool-args.c +++ b/src/srptool-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (srptool-args.c) * - * It has been AutoGen-ed January 21, 2012 at 02:15:51 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 11:30:11 AM by AutoGen 5.12 * From the definitions srptool-args.def * and the template file options * diff --git a/src/srptool-args.h b/src/srptool-args.h index 7eb07cdfe2..b1309bb4f9 100644 --- a/src/srptool-args.h +++ b/src/srptool-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (srptool-args.h) * - * It has been AutoGen-ed January 21, 2012 at 02:15:51 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 11:30:11 AM by AutoGen 5.12 * From the definitions srptool-args.def * and the template file options *