2 * Unix SMB/CIFS implementation.
3 * Copyright (C) Jelmer Vernooij 2009
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "../lib/util/dlinklist.h"
21 #include "../lib/util/parmlist.h"
23 struct parmlist_entry *parmlist_get(struct parmlist *ctx, const char *name)
25 struct parmlist_entry *e;
26 for (e = ctx->entries; e; e = e->next) {
27 if (strcasecmp(e->key, name) == 0)
34 int parmlist_get_int(struct parmlist *ctx, const char *name, int default_v)
36 struct parmlist_entry *p = parmlist_get(ctx, name);
39 return strtol(p->value, NULL, 0);
44 const char *parmlist_get_string(struct parmlist *ctx, const char *name, const char *default_v)
46 struct parmlist_entry *p = parmlist_get(ctx, name);
54 const char **parmlist_get_string_list(struct parmlist *ctx, const char *name, const char *separator)
56 struct parmlist_entry *p = parmlist_get(ctx, name);
61 return (const char **)str_list_make(ctx, p->value, separator);