mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
common: Avoid unnecessary ambiguity in argparse.
* common/argparse.c (find_long_option): Avoid unnecessary ambiguity. -- If two struct ARGPARSE_OPTS share a prefix in their long_opt name, but have the exact same short_opt and flags, they are aliases and not distinct options. Avoid reporting this as an ambiguity, so that (for example) both --clearsign and --clear-sign can be invoked as --clear. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Debian-Bug-Id: 850475
This commit is contained in:
parent
a20a450ac4
commit
7249ab0f95
@ -898,7 +898,9 @@ find_long_option( ARGPARSE_ARGS *arg,
|
||||
int j;
|
||||
for(j=i+1; opts[j].short_opt; j++ ) {
|
||||
if( opts[j].long_opt
|
||||
&& !strncmp( opts[j].long_opt, keyword, n ) )
|
||||
&& !strncmp( opts[j].long_opt, keyword, n )
|
||||
&& !(opts[j].short_opt == opts[i].short_opt
|
||||
&& opts[j].flags == opts[i].flags ) )
|
||||
return -2; /* abbreviation is ambiguous */
|
||||
}
|
||||
return i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user