diff options
-rw-r--r-- | keyserver/ChangeLog | 7 | ||||
-rw-r--r-- | keyserver/gpgkeys_finger.c | 24 | ||||
-rw-r--r-- | keyserver/gpgkeys_hkp.c | 24 | ||||
-rw-r--r-- | keyserver/gpgkeys_http.c | 24 | ||||
-rw-r--r-- | keyserver/gpgkeys_ldap.c | 25 | ||||
-rwxr-xr-x | keyserver/gpgkeys_mailto.in | 25 | ||||
-rwxr-xr-x | keyserver/gpgkeys_test.in | 22 |
7 files changed, 137 insertions, 14 deletions
diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 5c0cc6a1c..82f7a2bc4 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,5 +1,12 @@ 2004-10-15 Werner Koch <wk@g10code.com> + * gpgkeys_ldap.c (main, show_help): Kludge to implement standard + GNU options. Factored help printing out. + * gpgkeys_finger.c (main, show_help): Ditto. + * gpgkeys_hkp.c (main, show_help): Ditto. + * gpgkeys_http.c (main, show_help): Ditto. + * gpgkeys_test.in, gpgkeys_mailto.in: Implement --version and --help. + * Makefile.am: Add ksutil.h. 2004-10-14 David Shaw <dshaw@jabberwocky.com> diff --git a/keyserver/gpgkeys_finger.c b/keyserver/gpgkeys_finger.c index 86ec8ae88..b1b7fe4d8 100644 --- a/keyserver/gpgkeys_finger.c +++ b/keyserver/gpgkeys_finger.c @@ -357,6 +357,14 @@ get_key (char *getkey) } +static void +show_help (FILE *fp) +{ + fprintf (fp,"-h\thelp\n"); + fprintf (fp,"-V\tversion\n"); + fprintf (fp,"-o\toutput to this file\n"); +} + int main(int argc,char *argv[]) { @@ -367,14 +375,24 @@ main(int argc,char *argv[]) console=stderr; + /* Kludge to implement standard GNU options. */ + if (argc > 1 && !strcmp (argv[1], "--version")) + { + fputs ("gpgkeys_ldap (GnuPG) " VERSION"\n", stdout); + return 0; + } + else if (argc > 1 && !strcmp (argv[1], "--help")) + { + show_help (stdout); + return 0; + } + while((arg=getopt(argc,argv,"hVo:"))!=-1) switch(arg) { default: case 'h': - fprintf(console,"-h\thelp\n"); - fprintf(console,"-V\tversion\n"); - fprintf(console,"-o\toutput to this file\n"); + show_help (console); return KEYSERVER_OK; case 'V': diff --git a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c index 77bad489d..8d180a4f8 100644 --- a/keyserver/gpgkeys_hkp.c +++ b/keyserver/gpgkeys_hkp.c @@ -755,6 +755,14 @@ fail_all(struct keylist *keylist,int action,int err) } } +static void +show_help (FILE *fp) +{ + fprintf (fp,"-h\thelp\n"); + fprintf (fp,"-V\tversion\n"); + fprintf (fp,"-o\toutput to this file\n"); +} + int main(int argc,char *argv[]) { @@ -766,14 +774,24 @@ main(int argc,char *argv[]) console=stderr; + /* Kludge to implement standard GNU options. */ + if (argc > 1 && !strcmp (argv[1], "--version")) + { + fputs ("gpgkeys_ldap (GnuPG) " VERSION"\n", stdout); + return 0; + } + else if (argc > 1 && !strcmp (argv[1], "--help")) + { + show_help (stdout); + return 0; + } + while((arg=getopt(argc,argv,"hVo:"))!=-1) switch(arg) { default: case 'h': - fprintf(console,"-h\thelp\n"); - fprintf(console,"-V\tversion\n"); - fprintf(console,"-o\toutput to this file\n"); + show_help (console); return KEYSERVER_OK; case 'V': diff --git a/keyserver/gpgkeys_http.c b/keyserver/gpgkeys_http.c index 32700fbc9..6c9768e42 100644 --- a/keyserver/gpgkeys_http.c +++ b/keyserver/gpgkeys_http.c @@ -123,6 +123,14 @@ get_key(char *getkey) return KEYSERVER_OK; } +static void +show_help (FILE *fp) +{ + fprintf (fp,"-h\thelp\n"); + fprintf (fp,"-V\tversion\n"); + fprintf (fp,"-o\toutput to this file\n"); +} + int main(int argc,char *argv[]) { @@ -133,14 +141,24 @@ main(int argc,char *argv[]) console=stderr; + /* Kludge to implement standard GNU options. */ + if (argc > 1 && !strcmp (argv[1], "--version")) + { + fputs ("gpgkeys_http (GnuPG) " VERSION"\n", stdout); + return 0; + } + else if (argc > 1 && !strcmp (argv[1], "--help")) + { + show_help (stdout); + return 0; + } + while((arg=getopt(argc,argv,"hVo:"))!=-1) switch(arg) { default: case 'h': - fprintf(console,"-h\thelp\n"); - fprintf(console,"-V\tversion\n"); - fprintf(console,"-o\toutput to this file\n"); + show_help (console); return KEYSERVER_OK; case 'V': diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c index 37903a801..97f3911f7 100644 --- a/keyserver/gpgkeys_ldap.c +++ b/keyserver/gpgkeys_ldap.c @@ -1532,6 +1532,14 @@ find_basekeyspacedn(void) return LDAP_SUCCESS; } +static void +show_help (FILE *fp) +{ + fprintf (fp,"-h\thelp\n"); + fprintf (fp,"-V\tversion\n"); + fprintf (fp,"-o\toutput to this file\n"); +} + int main(int argc,char *argv[]) { @@ -1543,14 +1551,24 @@ main(int argc,char *argv[]) console=stderr; + /* Kludge to implement standard GNU options. */ + if (argc > 1 && !strcmp (argv[1], "--version")) + { + fputs ("gpgkeys_ldap (GnuPG) " VERSION"\n", stdout); + return 0; + } + else if (argc > 1 && !strcmp (argv[1], "--help")) + { + show_help (stdout); + return 0; + } + while((arg=getopt(argc,argv,"hVo:"))!=-1) switch(arg) { default: case 'h': - fprintf(console,"-h\thelp\n"); - fprintf(console,"-V\tversion\n"); - fprintf(console,"-o\toutput to this file\n"); + show_help (console); return KEYSERVER_OK; case 'V': @@ -1569,6 +1587,7 @@ main(int argc,char *argv[]) break; } + if(argc>optind) { input=fopen(argv[optind],"r"); diff --git a/keyserver/gpgkeys_mailto.in b/keyserver/gpgkeys_mailto.in index 0691e4c46..7167c3afd 100755 --- a/keyserver/gpgkeys_mailto.in +++ b/keyserver/gpgkeys_mailto.in @@ -1,6 +1,6 @@ #!@PERL@ -w -# gpgkeys_mailto - talk to a email keyserver +# gpgkeys_mailto - talk to a email keyserver # Copyright (C) 2001, 2002 Free Software Foundation, Inc. # # This file is part of GnuPG. @@ -20,10 +20,28 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA use Getopt::Std; +$Getopt::Std::STANDARD_HELP_VERSION=1; $sendmail="@SENDMAIL@ -t"; ### +sub VERSION_MESSAGE () +{ + print STDOUT "gpgkeys_mailto (GnuPG) 1.3.91-cvs\n"; +} + +sub HELP_MESSAGE () +{ + print STDOUT <<EOT + +--help Print this help +--version Print the version +-o FILE Write output to FILE +EOT +} + + + getopts('o:'); if(defined($opt_o)) @@ -200,3 +218,8 @@ if($command=~/send/i) } } } + + +# Local Variables: +# mode:perl +# End: diff --git a/keyserver/gpgkeys_test.in b/keyserver/gpgkeys_test.in index 09c14bfd4..909552457 100755 --- a/keyserver/gpgkeys_test.in +++ b/keyserver/gpgkeys_test.in @@ -20,13 +20,29 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA use Getopt::Std; +$Getopt::Std::STANDARD_HELP_VERSION=1; $|=1; -print STDERR "gpgkeys_test starting\n"; +sub VERSION_MESSAGE () +{ + print STDOUT "gpgkeys_test (GnuPG) 1.3.91-cvs\n"; +} + +sub HELP_MESSAGE () +{ + print STDOUT <<EOT + +--help Print this help +--version Print the version +EOT +} + getopts('o:'); +print STDERR "gpgkeys_test starting\n"; + if(defined($opt_o)) { print STDERR "Using output file $opt_o\n"; @@ -77,3 +93,7 @@ if($command eq "SEND") } printf STDERR "gpgkeys_test finished\n"; + +# Local Variables: +# mode:perl +# End: |