1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

util/parmlist: Add some more comments.

This commit is contained in:
Jelmer Vernooij 2009-09-27 14:13:38 +02:00
parent 2dd7c9bc34
commit c145888cec
2 changed files with 36 additions and 4 deletions

View File

@ -41,7 +41,24 @@ int parmlist_get_int(struct parmlist *ctx, const char *name, int default_v)
return default_v;
}
const char *parmlist_get_string(struct parmlist *ctx, const char *name, const char *default_v)
bool parmlist_get_bool(struct parmlist *ctx, const char *name, bool default_v)
{
struct parmlist_entry *p = parmlist_get(ctx, name);
bool ret;
if (p == NULL)
return default_v;
if (!set_boolean(p->value, &ret)) {
DEBUG(0,("lp_bool(%s): value is not boolean!\n", p->value));
return default_v;
}
return ret;
}
const char *parmlist_get_string(struct parmlist *ctx, const char *name,
const char *default_v)
{
struct parmlist_entry *p = parmlist_get(ctx, name);
@ -51,7 +68,8 @@ const char *parmlist_get_string(struct parmlist *ctx, const char *name, const ch
return p->value;
}
const char **parmlist_get_string_list(struct parmlist *ctx, const char *name, const char *separator)
const char **parmlist_get_string_list(struct parmlist *ctx, const char *name,
const char *separator)
{
struct parmlist_entry *p = parmlist_get(ctx, name);

View File

@ -31,9 +31,23 @@ struct parmlist {
struct parmlist_entry *entries;
};
/** Retrieve an integer from a parameter list. If not found, return default_v. */
int parmlist_get_int(struct parmlist *ctx, const char *name, int default_v);
const char *parmlist_get_string(struct parmlist *ctx, const char *name, const char *default_v);
/** Retrieve a string from a parameter list. If not found, return default_v. */
const char *parmlist_get_string(struct parmlist *ctx, const char *name,
const char *default_v);
/** Retrieve the struct for an entry in a parmlist. */
struct parmlist_entry *parmlist_get(struct parmlist *ctx, const char *name);
const char **parmlist_get_string_list(struct parmlist *ctx, const char *name, const char *separator);
/** Retrieve a string list from a parameter list.
* separator can contain characters to consider separators or can be
* NULL for the default set. */
const char **parmlist_get_string_list(struct parmlist *ctx, const char *name,
const char *separator);
/** Retrieve boolean from a parameter list. If not set, return default_v. */
bool parmlist_get_bool(struct parmlist *ctx, const char *name, bool default_v);
#endif /* _PARMLIST_H */