diff options
author | David Shaw <[email protected]> | 2003-05-31 21:52:16 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-05-31 21:52:16 +0000 |
commit | ff43d07819d50c1b96f9034f5fbb5f5ce581f4bd (patch) | |
tree | 13e3845bc9b9392d862f4d9d335bc376016c5be6 /g10/import.c | |
parent | * keylist.c (list_one): Don't show the keyring filename when in (diff) | |
download | gnupg-ff43d07819d50c1b96f9034f5fbb5f5ce581f4bd.tar.gz gnupg-ff43d07819d50c1b96f9034f5fbb5f5ce581f4bd.zip |
* main.h, misc.c (parse_options): New general option line parser. Fix the
bug in the old version that did not handle report syntax errors after a
valid entry.
* import.c (parse_import_options), export.c (parse_export_options): Call
it here instead of duplicating the code.
Diffstat (limited to 'g10/import.c')
-rw-r--r-- | g10/import.c | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/g10/import.c b/g10/import.c index cec24b8ad..1b955c412 100644 --- a/g10/import.c +++ b/g10/import.c @@ -85,13 +85,7 @@ static int merge_keysigs( KBNODE dst, KBNODE src, int *n_sigs, int parse_import_options(char *str,unsigned int *options) { - char *tok; - int hit=0; - struct - { - char *name; - unsigned int bit; - } import_opts[]= + struct parse_options import_opts[]= { {"allow-local-sigs",IMPORT_ALLOW_LOCAL_SIGS}, {"repair-hkp-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG}, @@ -101,34 +95,7 @@ parse_import_options(char *str,unsigned int *options) {NULL,0} }; - while((tok=strsep(&str," ,"))) - { - int i,rev=0; - - if(ascii_strncasecmp("no-",tok,3)==0) - { - rev=1; - tok+=3; - } - - for(i=0;import_opts[i].name;i++) - { - if(ascii_strcasecmp(import_opts[i].name,tok)==0) - { - if(rev) - *options&=~import_opts[i].bit; - else - *options|=import_opts[i].bit; - hit=1; - break; - } - } - - if(!hit && !import_opts[i].name) - return 0; - } - - return hit; + return parse_options(str,options,import_opts); } void * |