1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-03 12:11:33 +01:00

* 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.
This commit is contained in:
David Shaw 2003-12-28 04:38:00 +00:00
parent 392e6da660
commit 0f346cf8c1
2 changed files with 50 additions and 1 deletions

View File

@ -1,5 +1,10 @@
2003-12-27 David Shaw <dshaw@jabberwocky.com> 2003-12-27 David Shaw <dshaw@jabberwocky.com>
* 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 * main.h, misc.c (parse_options): Add a "noisy" flag to enable and
disable the messages about which option didn't match or matched disable the messages about which option didn't match or matched
ambiguously. Change all callers (g10.c, keyserver.c). ambiguously. Change all callers (g10.c, keyserver.c).

View File

@ -74,6 +74,33 @@ struct kopts
static int keyserver_work(int action,STRLIST list, static int keyserver_work(int action,STRLIST list,
KEYDB_SEARCH_DESC *desc,int count); 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 void
parse_keyserver_options(char *options) parse_keyserver_options(char *options)
{ {
@ -127,7 +154,24 @@ parse_keyserver_options(char *options)
&& &&
!parse_export_options(tok, !parse_export_options(tok,
&opt.keyserver_options.export_options,0)) &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);
}
} }
} }
} }