diff options
author | David Shaw <[email protected]> | 2003-10-10 03:05:05 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-10-10 03:05:05 +0000 |
commit | 40db05fb99fedf15f7a2ef6dfa18e357f37a488a (patch) | |
tree | 6f2533cb60521b9d9f8fcbf9f7f3b1fd953cff9a /g10/misc.c | |
parent | * ccid-driver.c (ccid_transceive): Add T=1 chaining for sending. (diff) | |
download | gnupg-40db05fb99fedf15f7a2ef6dfa18e357f37a488a.tar.gz gnupg-40db05fb99fedf15f7a2ef6dfa18e357f37a488a.zip |
* g10.c (main): Give a deprecated option warning for --show-keyring,
--show-photos, --show-policy-url, --show-notation, and their respective
no- forms.
* options.skel: Remove show-photos and replace with list/verify-options
show-photos. Remove no-mangle-dos-filenames.
* misc.c (parse_options): Allow for incomplete (but unambiguous) options.
Diffstat (limited to '')
-rw-r--r-- | g10/misc.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/g10/misc.c b/g10/misc.c index c98c9752e..01a38a4f3 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -672,6 +672,7 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts) while((tok=strsep(&str," ,"))) { int i,rev=0; + char *otok=tok; if(tok[0]=='\0') continue; @@ -684,8 +685,25 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts) for(i=0;opts[i].name;i++) { - if(ascii_strcasecmp(opts[i].name,tok)==0) + size_t toklen=strlen(tok); + + if(ascii_strncasecmp(opts[i].name,tok,toklen)==0) { + /* We have a match, but it might be incomplete */ + if(toklen!=strlen(opts[i].name)) + { + int j; + + for(j=i+1;opts[j].name;j++) + { + if(ascii_strncasecmp(opts[j].name,tok,toklen)==0) + { + log_info(_("ambiguous option `%s'\n"),otok); + return 0; + } + } + } + if(rev) *options&=~opts[i].bit; else @@ -695,7 +713,10 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts) } if(!opts[i].name) - return 0; + { + log_info(_("unknown option `%s'\n"),otok); + return 0; + } } return 1; |