+/** @brief Construct a KVP from arguments
+ * @param name First name
+ * @return Newly created KVP
+ *
+ * Arguments must come in name/value pairs and must be followed by a (char *)0.
+ *
+ * The order of the new KVP is not formally defined though the test
+ * programs rely on it nonetheless so update them if you change it.
+ */
+struct kvp *kvp_make(const char *name, ...) {
+ const char *value;
+ struct kvp *kvp = 0, *k;
+ va_list ap;
+
+ va_start(ap, name);
+ while(name) {
+ value = va_arg(ap, const char *);
+ k = xmalloc(sizeof *k);
+ k->name = name;
+ k->value = value ? xstrdup(value) : "";
+ k->next = kvp;
+ kvp = k;
+ name = va_arg(ap, const char *);
+ }
+ va_end(ap);
+ return kvp;
+}
+