mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
wks: Allow command style args for gpg-wks-client.
* tools/gpg-wks-client.c (wrong_args): Take two args. Change all callers. (main): Pass ARGPARSE_FLAG_COMMAND for recent gpgrt version. -- This requires gpgrt 1.48. Of course "gpg-wks-client --create ..." continues to work.
This commit is contained in:
parent
95bc592ab5
commit
a09157ccb2
@ -136,6 +136,8 @@ The command @option{--print-wkd-url} prints the URLs used to fetch the
|
||||
key for the given user-ids from WKD. The meanwhile preferred format
|
||||
with sub-domains is used here.
|
||||
|
||||
All commands may also be given without the two leading dashes.
|
||||
|
||||
@mansect options
|
||||
@noindent
|
||||
@command{gpg-wks-client} understands these options:
|
||||
|
@ -154,7 +154,7 @@ static char **blacklist_array;
|
||||
static size_t blacklist_array_len;
|
||||
|
||||
|
||||
static void wrong_args (const char *text) GPGRT_ATTR_NORETURN;
|
||||
static void wrong_args (const char *t1, const char *t2) GPGRT_ATTR_NORETURN;
|
||||
static void add_blacklist (const char *fname);
|
||||
static gpg_error_t proc_userid_from_stdin (gpg_error_t (*func)(const char *),
|
||||
const char *text);
|
||||
@ -204,10 +204,15 @@ my_strusage( int level )
|
||||
|
||||
|
||||
static void
|
||||
wrong_args (const char *text)
|
||||
wrong_args (const char *text, const char *text2)
|
||||
{
|
||||
es_fprintf (es_stderr, _("usage: %s [options] %s\n"),
|
||||
gpgrt_strusage (11), text);
|
||||
#if GPGRT_VERSION_NUMBER >= 0x013000 /* >= 1.48 */
|
||||
/* Skip the leading dashes if build with command support. */
|
||||
if (text[0] == '-' && text[1] == '-' && text[2])
|
||||
text += 2;
|
||||
#endif
|
||||
es_fprintf (es_stderr, _("usage: %s %s [options] %s\n"),
|
||||
gpgrt_strusage (11), text, text2);
|
||||
exit (2);
|
||||
}
|
||||
|
||||
@ -315,6 +320,9 @@ main (int argc, char **argv)
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags = ARGPARSE_FLAG_KEEP;
|
||||
#if GPGRT_VERSION_NUMBER >= 0x013000 /* >= 1.48 */
|
||||
pargs.flags |= ARGPARSE_FLAG_COMMAND;
|
||||
#endif
|
||||
cmd = parse_arguments (&pargs, opts);
|
||||
gpgrt_argparse (NULL, &pargs, NULL);
|
||||
|
||||
@ -394,7 +402,7 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
if (argc != 1)
|
||||
wrong_args ("--supported DOMAIN");
|
||||
wrong_args ("--supported", "DOMAIN");
|
||||
err = command_supported (argv[0]);
|
||||
if (err && gpg_err_code (err) != GPG_ERR_FALSE)
|
||||
log_error ("checking support failed: %s\n", gpg_strerror (err));
|
||||
@ -403,7 +411,7 @@ main (int argc, char **argv)
|
||||
|
||||
case aCreate:
|
||||
if (argc != 2)
|
||||
wrong_args ("--create FINGERPRINT USER-ID");
|
||||
wrong_args ("--create", "FINGERPRINT USER-ID");
|
||||
err = command_create (argv[0], argv[1]);
|
||||
if (err)
|
||||
log_error ("creating request failed: %s\n", gpg_strerror (err));
|
||||
@ -411,7 +419,7 @@ main (int argc, char **argv)
|
||||
|
||||
case aReceive:
|
||||
if (argc)
|
||||
wrong_args ("--receive < MIME-DATA");
|
||||
wrong_args ("--receive", "< MIME-DATA");
|
||||
err = wks_receive (es_stdin, command_receive_cb, NULL);
|
||||
if (err)
|
||||
log_error ("processing mail failed: %s\n", gpg_strerror (err));
|
||||
@ -419,7 +427,7 @@ main (int argc, char **argv)
|
||||
|
||||
case aRead:
|
||||
if (argc)
|
||||
wrong_args ("--read < WKS-DATA");
|
||||
wrong_args ("--read", "< WKS-DATA");
|
||||
err = read_confirmation_request (es_stdin);
|
||||
if (err)
|
||||
log_error ("processing mail failed: %s\n", gpg_strerror (err));
|
||||
@ -427,7 +435,7 @@ main (int argc, char **argv)
|
||||
|
||||
case aCheck:
|
||||
if (argc != 1)
|
||||
wrong_args ("--check USER-ID");
|
||||
wrong_args ("--check", "USER-ID");
|
||||
err = command_check (argv[0]);
|
||||
break;
|
||||
|
||||
@ -444,12 +452,12 @@ main (int argc, char **argv)
|
||||
else if (argc == 2)
|
||||
err = wks_cmd_install_key (*argv, argv[1]);
|
||||
else
|
||||
wrong_args ("--install-key [FILE|FINGERPRINT USER-ID]");
|
||||
wrong_args ("--install-key", "[FILE|FINGERPRINT USER-ID]");
|
||||
break;
|
||||
|
||||
case aRemoveKey:
|
||||
if (argc != 1)
|
||||
wrong_args ("--remove-key USER-ID");
|
||||
wrong_args ("--remove-key", "USER-ID");
|
||||
err = wks_cmd_remove_key (*argv);
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user