* keyserver.c (strip_leading_space, get_arg): New.
authorDavid Shaw <dshaw@jabberwocky.com>
Sun, 28 Dec 2003 04:38:00 +0000 (04:38 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Sun, 28 Dec 2003 04:38:00 +0000 (04:38 +0000)
(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.

g10/ChangeLog
g10/keyserver.c

index a506df8..f2a5d23 100644 (file)
@@ -1,5 +1,10 @@
 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
        disable the messages about which option didn't match or matched
        ambiguously.  Change all callers (g10.c, keyserver.c).
index 279a4e3..3a04cec 100644 (file)
@@ -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);
+             }
        }
     }
 }