summaryrefslogtreecommitdiff
path: root/lib/util/parmlist.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-09-27 17:37:53 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-09-27 17:37:53 +0200
commitd9ada600cc81603300a0cfce75179c6aa1ac94cc (patch)
tree3d7dc80587be662a886aed0a643762c4574aac92 /lib/util/parmlist.c
parent43267812e17cc7749bb9275574af5eccc74129e5 (diff)
downloadsamba-d9ada600cc81603300a0cfce75179c6aa1ac94cc.tar.gz
samba-d9ada600cc81603300a0cfce75179c6aa1ac94cc.tar.bz2
samba-d9ada600cc81603300a0cfce75179c6aa1ac94cc.zip
parmlist: Add more tests.
Diffstat (limited to 'lib/util/parmlist.c')
-rw-r--r--lib/util/parmlist.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/util/parmlist.c b/lib/util/parmlist.c
index ffcd19a4ab..6658fa7e33 100644
--- a/lib/util/parmlist.c
+++ b/lib/util/parmlist.c
@@ -78,3 +78,29 @@ const char **parmlist_get_string_list(struct parmlist *ctx, const char *name,
return (const char **)str_list_make(ctx, p->value, separator);
}
+
+static struct parmlist_entry *parmlist_get_add(struct parmlist *ctx, const char *name)
+{
+ struct parmlist_entry *e = parmlist_get(ctx, name);
+
+ if (e != NULL)
+ return e;
+
+ e = talloc(ctx, struct parmlist_entry);
+ if (e == NULL)
+ return NULL;
+ e->key = talloc_strdup(e, name);
+ DLIST_ADD(ctx->entries, e);
+ return e;
+}
+
+int parmlist_set_string(struct parmlist *ctx, const char *name,
+ const char *value)
+{
+ struct parmlist_entry *e = parmlist_get_add(ctx, name);
+ if (e == NULL)
+ return -1;
+
+ e->value = talloc_strdup(e, value);
+ return 0;
+}