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

libgpo: add gp_inifile_getbool().

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Günther Deschner 2013-12-11 00:44:49 +01:00 committed by Andreas Schneider
parent c329a6abcc
commit 12c7b9498c
2 changed files with 25 additions and 0 deletions

View File

@ -165,6 +165,30 @@ NTSTATUS gp_inifile_getint(struct gp_inifile_context *ctx, const char *key, int
/****************************************************************
****************************************************************/
NTSTATUS gp_inifile_getbool(struct gp_inifile_context *ctx, const char *key, bool *ret)
{
char *value;
NTSTATUS result;
result = gp_inifile_getstring(ctx,key, &value);
if (!NT_STATUS_IS_OK(result)) {
return result;
}
if (strequal(value, "Yes")) {
*ret = true;
return NT_STATUS_OK;
} else if (strequal(value, "No")) {
*ret = false;
return NT_STATUS_OK;
}
return NT_STATUS_NOT_FOUND;
}
/****************************************************************
****************************************************************/
NTSTATUS gp_inifile_init_context(TALLOC_CTX *mem_ctx,
uint32_t flags,
const char *unix_path,

View File

@ -42,4 +42,5 @@ NTSTATUS parse_gpt_ini(TALLOC_CTX *ctx,
char **display_name);
NTSTATUS gp_inifile_getstring(struct gp_inifile_context *ctx, const char *key, char **ret);
NTSTATUS gp_inifile_getint(struct gp_inifile_context *ctx, const char *key, int *ret);
NTSTATUS gp_inifile_getbool(struct gp_inifile_context *ctx, const char *key, bool *ret);