diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-02-19 23:20:30 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-02-19 23:22:55 +0100 |
commit | 30a482e8c302312459337cd04e730497980c3a1c (patch) | |
tree | 84954e2402a89cc858d2ffa227d7eed7619a88db | |
parent | 9a848ba75f6548d46d3d7ce48022fb5a05a6b65d (diff) | |
download | gnutls-30a482e8c302312459337cd04e730497980c3a1c.tar.gz |
Optimizations in command line argument handling. Patch by Bruce Korb.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | src/Makefile.am | 16 | ||||
-rw-r--r-- | src/args-std.def | 58 | ||||
-rw-r--r-- | src/certtool-args.def | 46 | ||||
-rw-r--r-- | src/cli-args.def | 36 | ||||
-rw-r--r-- | src/cli-debug-args.def | 39 | ||||
-rw-r--r-- | src/ocsptool-args.def | 54 | ||||
-rw-r--r-- | src/p11tool-args.def | 35 | ||||
-rw-r--r-- | src/psk-args.def | 27 | ||||
-rw-r--r-- | src/serv-args.def | 27 | ||||
-rw-r--r-- | src/srptool-args.def | 27 |
11 files changed, 86 insertions, 281 deletions
diff --git a/Makefile.am b/Makefile.am index dd4bf17fad..3db69b88f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,7 +37,7 @@ dist-hook: rm -f ChangeLog make ChangeLog cp -f ChangeLog $(distdir)/ - sed 's/\@VERSION\@/$(VERSION)/g' -i $(distdir)/src/*.def + sed 's/\@VERSION\@/$(VERSION)/g' -i $(distdir)/src/args-std.def cd $(distdir)/src/ && for i in *.def;do \ autogen $$i; \ cp $$i $$i.tmp; \ diff --git a/src/Makefile.am b/src/Makefile.am index 33f3ff3588..e48de99782 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -142,19 +142,19 @@ libcmd_p11tool_la_LIBADD += ../gl/libgnu.la $(INET_PTON_LIB) endif # ENABLE_PKCS11 -ocsptool-args.c: $(srcdir)/ocsptool-args.def +ocsptool-args.c: $(srcdir)/args-std.def $(srcdir)/ocsptool-args.def -autogen ocsptool-args.def -p11tool-args.c: $(srcdir)/p11tool-args.def +p11tool-args.c: $(srcdir)/args-std.def $(srcdir)/p11tool-args.def -autogen p11tool-args.def -psk-args.c: $(srcdir)/psk-args.def +psk-args.c: $(srcdir)/args-std.def $(srcdir)/psk-args.def -autogen psk-args.def -cli-debug-args.c: $(srcdir)/cli-debug-args.def +cli-debug-args.c: $(srcdir)/args-std.def $(srcdir)/cli-debug-args.def -autogen cli-debug-args.def -cli-args.c: $(srcdir)/cli-args.def +cli-args.c: $(srcdir)/args-std.def $(srcdir)/cli-args.def -autogen cli-args.def -serv-args.c: $(srcdir)/serv-args.def +serv-args.c: $(srcdir)/args-std.def $(srcdir)/serv-args.def -autogen serv-args.def -srptool-args.c: $(srcdir)/srptool-args.def +srptool-args.c: $(srcdir)/args-std.def $(srcdir)/srptool-args.def -autogen srptool-args.def -certtool-args.c: $(srcdir)/certtool-args.def +certtool-args.c: $(srcdir)/args-std.def $(srcdir)/certtool-args.def -autogen certtool-args.def diff --git a/src/args-std.def b/src/args-std.def new file mode 100644 index 0000000000..10ceddabb7 --- /dev/null +++ b/src/args-std.def @@ -0,0 +1,58 @@ + +prog-group = GnuTLS; +config-header = config.h; +gnu-usage; +disable-save; +long-opts; +no-xlate = opt; +version = "@VERSION@"; +no-misuse-usage; +export = '#include <gettext.h>'; + +copyright = { + date = "2000-2012"; + owner = "Free Software Foundation"; + author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; " + "see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; + eaddr = "bug-gnutls@gnu.org"; + type = gpl; +}; + +help-value = h; +flag = { + name = debug; + value = d; + arg-type = number; + arg-range = "0 -> 9999"; + descrip = "Enable debugging."; + doc = "Specifies the debug level."; +}; + +#ifdef VERBOSE_OPT +flag = { + name = verbose; + value = V; + max = NOLIMIT; + descrip = "More verbose output"; + doc = ""; +}; +#endif + +#ifdef INFILE_OPT +flag = { + name = infile; + arg-type = file; + file-exists = yes; + descrip = "Input file"; + doc = ""; +}; +#endif + +#ifdef OUTFILE_OPT +flag = { + name = outfile; + arg-type = string; + descrip = "Output file"; + doc = ""; +}; +#endif diff --git a/src/certtool-args.def b/src/certtool-args.def index 3db04554ea..ca9d9440a6 100644 --- a/src/certtool-args.def +++ b/src/certtool-args.def @@ -5,35 +5,12 @@ prog-desc = "Manipulate certificates and private keys."; detail = "Tool to parse and generate X.509 certificates, requests and private keys. It can be used interactively or non interactively by specifying the template command line option."; -help-value = "h"; short-usage = "certtool [options] [url]\ncerttool --help for usage instructions.\n"; -prog-group = "GnuTLS"; explain = ""; -gnu-usage; -no-xlate = opt; -no-misuse-usage; -disable-save; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; - -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; - -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging."; - doc = "Specifies the debug level."; -}; + +#define INFILE_OPT 1 +#define OUTFILE_OPT 1 +#include args-std.def flag = { name = generate-self-signed; @@ -352,21 +329,6 @@ flag = { }; flag = { - name = outfile; - arg-type = string; - descrip = "Output file"; - doc = ""; -}; - -flag = { - name = infile; - arg-type = file; - file-exists = yes; - descrip = "Input file"; - doc = ""; -}; - -flag = { name = template; arg-type = file; file-exists = yes; diff --git a/src/cli-args.def b/src/cli-args.def index f12c24505b..33e968570b 100644 --- a/src/cli-args.def +++ b/src/cli-args.def @@ -2,39 +2,15 @@ AutoGen Definitions options; prog-name = gnutls-cli; prog-title = "GnuTLS client"; prog-desc = "Simple client program to set up a TLS connection."; -help-value = "h"; short-usage = "Usage: gnutls-cli [options] hostname\ngnutls-cli --help for usage instructions.\n"; -prog-group = "GnuTLS"; explain = ""; detail = "Simple client program to set up a TLS connection to some other computer. It sets up a TLS connection and forwards data from the standard input to the secured socket and vice versa."; -gnu-usage; -no-misuse-usage; -disable-save; reorder-args; -no-xlate = opt; argument = "[hostname]"; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; - -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging"; - doc = ""; -}; +#define VERBOSE_OPT 1 +#include args-std.def flag = { name = tofu; @@ -134,14 +110,6 @@ flag = { }; flag = { - name = verbose; - value = V; - max = NOLIMIT; - descrip = "More verbose output"; - doc = ""; -}; - -flag = { name = priority; arg-type = string; descrip = "Priorities string"; diff --git a/src/cli-debug-args.def b/src/cli-debug-args.def index e07fd48d5c..aae3c7e0f3 100644 --- a/src/cli-debug-args.def +++ b/src/cli-debug-args.def @@ -2,9 +2,8 @@ AutoGen Definitions options; prog-name = gnutls-cli-debug; prog-title = "GnuTLS debug client"; prog-desc = "Simple client program to check TLS server capabilities."; -help-value = "h"; -short-usage = "Usage: gnutls-cli-debug [options] hostname\ngnutls-cli --help for usage instructions.\n"; -prog-group = "GnuTLS"; +short-usage = "Usage: gnutls-cli-debug [options] hostname\n" + "gnutls-cli --help for usage instructions.\n"; explain = ""; detail = "TLS debug client. It sets up multiple TLS connections to a server and queries its capabilities. It was created to assist in debugging @@ -12,41 +11,11 @@ GnuTLS, but it might be useful to extract a TLS server's capabilities. It connects to a TLS server, performs tests and print the server's capabilities. If called with the `-v' parameter more checks will be performed. Can be used to check for servers with special needs or bugs."; -gnu-usage; -no-xlate = opt; -no-misuse-usage; -disable-save; reorder-args; argument; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; - -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging"; - doc = ""; -}; - -flag = { - name = verbose; - value = V; - max = NOLIMIT; - descrip = "More verbose output"; - doc = ""; -}; +#define VERBOSE_OPT 1 +#include args-std.def flag = { name = port; diff --git a/src/ocsptool-args.def b/src/ocsptool-args.def index 9fe9320d4a..b6efe43bb3 100644 --- a/src/ocsptool-args.def +++ b/src/ocsptool-args.def @@ -2,39 +2,16 @@ AutoGen Definitions options; prog-name = ocsptool; prog-title = "GnuTLS OCSP tool"; prog-desc = "Program to handle OCSP request/responses."; -help-value = "h"; detail = "Ocsptool is a program that can parse and print information about OCSP requests/responses, generate requests and verify responses. "; short-usage = "ocsptool [options]\nocsptool --help for usage instructions.\n"; -prog-group = "GnuTLS"; explain = ""; -gnu-usage; -no-xlate = opt; -no-misuse-usage; -disable-save; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; - -copyright = { - date = "2012"; - owner = "Free Software Foundation"; - author = "Simon Josefsson, Nikos Mavrogiannopoulos and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; -flag = { - name = debug; - value = d; - arg-type = number; - arg-default = 0; - arg-range = "0 -> 9999"; - descrip = "Enable debugging."; - doc = "Specifies the debug level."; -}; +#define INFILE_OPT 1 +#define OUTFILE_OPT 1 +#define VERBOSE_OPT 1 +#include args-std.def flag = { name = ask; @@ -143,29 +120,6 @@ flag = { doc = ""; }; -flag = { - name = outfile; - arg-type = string; - descrip = "Output file"; - doc = ""; -}; - -flag = { - name = infile; - arg-type = file; - file-exists = yes; - descrip = "Input file"; - doc = ""; -}; - -flag = { - name = verbose; - value = V; - max = NOLIMIT; - descrip = "More verbose output"; - doc = ""; -}; - doc-section = { ds-type = 'SEE ALSO'; ds-format = 'texi'; diff --git a/src/p11tool-args.def b/src/p11tool-args.def index 89b044f008..5a058e4431 100644 --- a/src/p11tool-args.def +++ b/src/p11tool-args.def @@ -2,7 +2,6 @@ AutoGen Definitions options; prog-name = p11tool; prog-title = "GnuTLS PKCS #11 tool"; prog-desc = "Program to handle PKCS #11 smart cards and security modules.\n"; -help-value = "h"; detail = "Program that allows handling data from PKCS #11 smart cards and security modules. @@ -11,35 +10,12 @@ To use PKCS #11 tokens with gnutls the configuration file "; short-usage = "p11tool [options] [url]\np11tool --help for usage instructions.\n"; -prog-group = "GnuTLS"; explain = ""; -gnu-usage; reorder-args; -no-xlate = opt; argument = "[url]"; -no-misuse-usage; -disable-save; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; - -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging."; - doc = "Specifies the debug level."; -}; +#define OUTFILE_OPT 1 +#include args-std.def flag = { name = list-tokens; @@ -238,13 +214,6 @@ flag = { doc = "This will override the default options in /etc/gnutls/pkcs11.conf"; }; -flag = { - name = outfile; - arg-type = string; - descrip = "Output file"; - doc = ""; -}; - doc-section = { ds-type = 'SEE ALSO'; diff --git a/src/psk-args.def b/src/psk-args.def index b15915b012..d19ae2655f 100644 --- a/src/psk-args.def +++ b/src/psk-args.def @@ -4,35 +4,10 @@ prog-title = "GnuTLS PSK tool"; prog-desc = "Program to create PSK parameters.\n"; detail = "Program that generates random keys for use with TLS-PSK. The keys are stored in hexadecimal format in a key file."; -help-value = "h"; short-usage = "psktool [options]\npsktool --help for usage instructions.\n"; -prog-group = "GnuTLS"; explain = ""; -gnu-usage; -no-xlate = opt; -no-misuse-usage; -disable-save; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; - -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging."; - doc = "Specifies the debug level."; -}; +#include args-std.def flag = { name = keysize; diff --git a/src/serv-args.def b/src/serv-args.def index d39d875577..9264d137cf 100644 --- a/src/serv-args.def +++ b/src/serv-args.def @@ -3,35 +3,10 @@ prog-name = gnutls-serv; prog-title = "GnuTLS server"; prog-desc = "Simple server program to act as an HTTPS or TLS echo service."; short-usage = "Usage: gnutls-serv [options]\ngnutls-serv --help for usage instructions.\n"; -help-value = "h"; -prog-group = "GnuTLS"; explain = ""; detail = "Server program that listens to incoming TLS connections."; -gnu-usage; -no-xlate = opt; -no-misuse-usage; -disable-save; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; - -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging"; - doc = ""; -}; +#include args-std.def flag = { name = noticket; diff --git a/src/srptool-args.def b/src/srptool-args.def index cc7957dff9..5794ff432a 100644 --- a/src/srptool-args.def +++ b/src/srptool-args.def @@ -2,7 +2,6 @@ AutoGen Definitions options; prog-name = srptool; prog-title = "GnuTLS SRP tool"; prog-desc = "Simple program to create SRP parameters.\n"; -help-value = "h"; explain = ""; detail = "Simple program that emulates the programs in the Stanford SRP (Secure Remote Password) libraries using GnuTLS. It is intended for use in places @@ -13,32 +12,8 @@ file that holds the users and the verifiers associated with them and the configuration file to hold the group parameters (called tpasswd.conf)."; short-usage = "srptool [options]\nsrptool --help for usage instructions.\n"; -prog-group = "GnuTLS"; -no-xlate = opt; -gnu-usage; -no-misuse-usage; -disable-save; -long-opts; -config-header = 'config.h'; -export = '#include <gettext.h>'; - -copyright = { - date = "2000-2012"; - owner = "Free Software Foundation"; - author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list."; - eaddr = "bug-gnutls@gnu.org"; - type = gpl; -}; -version = "@VERSION@"; -flag = { - name = debug; - value = d; - arg-type = number; - arg-range = "0 -> 9999"; - descrip = "Enable debugging."; - doc = "Specifies the debug level."; -}; +#include args-std.def flag = { name = index; |