mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Print warning for arguments not considered an option.
GnuPG requires that options are given before other arguments. This can sometimes be confusing. We now print a warning if we found an argument looking alike a long option without being preceded by the stop option. This is bug#1343. * common/argparse.h (ARGPARSE_FLAG_STOP_SEEN): New. * common/argparse.c (arg_parse): Set new flag. * g10/gpg.c (main): Print the warning. * agent/gpg-agent.c (main): Ditto. * dirmngr/dirmngr.c (main): Ditto. * g13/g13.c (main): Ditto. * scd/scdaemon.c (main): Ditto. * sm/gpgsm.c (main): Ditto. * tools/gpg-connect-agent.c (main): Ditto. * tools/gpgconf.c (main): Ditto.
This commit is contained in:
parent
26ec6c7902
commit
de01c51ecb
11 changed files with 98 additions and 3 deletions
|
@ -229,7 +229,7 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
|
|||
arg->err = 0;
|
||||
arg->flags |= 1<<15; /* Mark as initialized. */
|
||||
if ( *arg->argc < 0 )
|
||||
jnlib_log_bug ("invalid argument for arg_parsee\n");
|
||||
jnlib_log_bug ("invalid argument for arg_parse\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -671,6 +671,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
|
|||
{
|
||||
/* Stop option processing. */
|
||||
arg->internal.stopped = 1;
|
||||
arg->flags |= ARGPARSE_FLAG_STOP_SEEN;
|
||||
argc--; argv++; idx++;
|
||||
goto next_one;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ typedef struct
|
|||
#define ARGPARSE_FLAG_ONEDASH 32 /* Allow long options with one dash. */
|
||||
#define ARGPARSE_FLAG_NOVERSION 64 /* No output for "--version". */
|
||||
|
||||
#define ARGPARSE_FLAG_STOP_SEEN 256 /* Set to true if a "--" has been seen. */
|
||||
|
||||
/* Flags for each option (ARGPARSE_OPTS). The type code may be
|
||||
ORed with the OPT flags. */
|
||||
#define ARGPARSE_TYPE_NONE 0 /* Does not take an argument. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue