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
14
g10/gpg.c
14
g10/gpg.c
|
@ -2018,7 +2018,7 @@ main (int argc, char **argv)
|
|||
orig_argv = argv;
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags= 1|(1<<6); /* do not remove the args, ignore version */
|
||||
pargs.flags= (ARGPARSE_FLAG_KEEP | ARGPARSE_FLAG_NOVERSION);
|
||||
while( arg_parse( &pargs, opts) ) {
|
||||
if( pargs.r_opt == oDebug || pargs.r_opt == oDebugAll )
|
||||
parse_debug++;
|
||||
|
@ -2094,7 +2094,7 @@ main (int argc, char **argv)
|
|||
argv = orig_argv;
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
pargs.flags= 1; /* do not remove the args */
|
||||
pargs.flags= ARGPARSE_FLAG_KEEP;
|
||||
|
||||
/* By this point we have a homedir, and cannot change it. */
|
||||
check_permissions(opt.homedir,0);
|
||||
|
@ -3093,6 +3093,16 @@ main (int argc, char **argv)
|
|||
log_printf ("\n");
|
||||
}
|
||||
|
||||
/* Print a warning if an argument looks like an option. */
|
||||
if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i < argc; i++)
|
||||
if (argv[i][0] == '-' && argv[i][1] == '-')
|
||||
log_info (_("NOTE: `%s' is not considered an option\n"), argv[i]);
|
||||
}
|
||||
|
||||
|
||||
gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue