diff options
author | David Shaw <[email protected]> | 2003-12-28 04:38:00 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-12-28 04:38:00 +0000 |
commit | 0f346cf8c14565b8c283966a6c805a07bae13915 (patch) | |
tree | 7e91aeb29800f201120dc86aa944c3ae6a6719a7 | |
parent | * main.h, misc.c (parse_options): Add a "noisy" flag to enable and disable (diff) | |
download | gnupg-0f346cf8c14565b8c283966a6c805a07bae13915.tar.gz gnupg-0f346cf8c14565b8c283966a6c805a07bae13915.zip |
* keyserver.c (strip_leading_space, get_arg): New.
(parse_keyserver_options): Use them here to allow arguments to
keyserver-options. Since none of our options need arguments yet, just
pass them through whole to the keyserver helper.
Diffstat (limited to '')
-rw-r--r-- | g10/ChangeLog | 5 | ||||
-rw-r--r-- | g10/keyserver.c | 46 |
2 files changed, 50 insertions, 1 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index a506df8f7..f2a5d23e4 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,10 @@ 2003-12-27 David Shaw <[email protected]> + * keyserver.c (strip_leading_space, get_arg): New. + (parse_keyserver_options): Use them here to allow arguments to + keyserver-options. Since none of our options need arguments yet, + just pass them through whole to the keyserver helper. + * main.h, misc.c (parse_options): Add a "noisy" flag to enable and disable the messages about which option didn't match or matched ambiguously. Change all callers (g10.c, keyserver.c). diff --git a/g10/keyserver.c b/g10/keyserver.c index 279a4e37e..3a04cec5b 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -74,6 +74,33 @@ struct kopts static int keyserver_work(int action,STRLIST list, KEYDB_SEARCH_DESC *desc,int count); +static void +strip_leading_space(char **stringp) +{ + while(**stringp) + { + if(ascii_isspace(**stringp)) + (*stringp)++; + else + return; + } +} + +static char * +get_arg(char **stringp) +{ + strip_leading_space(stringp); + + if(**stringp=='=') + { + (*stringp)++; + strip_leading_space(stringp); + return strsep(stringp," ,"); + } + + return NULL; +} + void parse_keyserver_options(char *options) { @@ -127,7 +154,24 @@ parse_keyserver_options(char *options) && !parse_export_options(tok, &opt.keyserver_options.export_options,0)) - add_to_strlist(&opt.keyserver_options.other,tok); + { + char *arg; + if(options && (arg=get_arg(&options))) + { + char *joined; + + joined=m_alloc(strlen(tok)+1+strlen(arg)+1); + /* Make a canonical name=value form with no + spaces */ + strcpy(joined,tok); + strcat(joined,"="); + strcat(joined,arg); + add_to_strlist(&opt.keyserver_options.other,joined); + m_free(joined); + } + else + add_to_strlist(&opt.keyserver_options.other,tok); + } } } } |