2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

add cfg_obj_asboolean()

This commit is contained in:
Brian Wellington
2001-02-22 01:40:53 +00:00
parent 035cd7b5bd
commit f0751a815e
2 changed files with 20 additions and 2 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cfg.h,v 1.7 2001/02/22 00:36:26 gson Exp $ */
/* $Id: cfg.h,v 1.8 2001/02/22 01:40:53 bwelling Exp $ */
#ifndef DNS_CFG_H
#define DNS_CFG_H 1
@@ -192,6 +192,18 @@ cfg_obj_asstring(cfg_obj_t *obj);
* A pointer to a null terminated string.
*/
isc_boolean_t
cfg_obj_asboolean(cfg_obj_t *obj);
/*
* Returns the value of a configuration object of a boolean type.
*
* Requires:
* 'obj' points to a valid configuration object of a boolean type.
*
* Returns:
* A boolean value.
*/
cfg_listelt_t *
cfg_list_first(cfg_obj_t *obj);
/*

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.12 2001/02/22 00:36:24 gson Exp $ */
/* $Id: parser.c,v 1.13 2001/02/22 01:40:51 bwelling Exp $ */
#include <config.h>
@@ -1568,6 +1568,12 @@ cfg_obj_asstring(cfg_obj_t *obj) {
return (obj->value.string.base);
}
isc_boolean_t
cfg_obj_asboolean(cfg_obj_t *obj) {
REQUIRE(obj != NULL && obj->type->rep == &cfg_rep_boolean);
return (obj->value.boolean);
}
/* Quoted string only */
static cfg_type_t cfg_type_qstring = {
"qstring", parse_qstring, print_qstring, &cfg_rep_string, NULL };