Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
b8d0eef0
Commit
b8d0eef0
authored
Feb 17, 2001
by
Andreas Gustafsson
Browse files
new function cfg_parse_buffer()
parent
40c11775
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/isccfg/include/isccfg/cfg.h
View file @
b8d0eef0
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cfg.h,v 1.
4
2001/02/1
5 23:22:27 bwelling
Exp $ */
/* $Id: cfg.h,v 1.
5
2001/02/1
7 00:15:22 gson
Exp $ */
#ifndef DNS_CFG_H
#define DNS_CFG_H 1
...
...
@@ -84,9 +84,17 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret);
isc_result_t
cfg_parse_file
(
cfg_parser_t
*
pctx
,
const
char
*
filename
,
cfg_type_t
*
type
,
cfg_obj_t
**
ret
);
isc_result_t
cfg_parse_buffer
(
cfg_parser_t
*
pctx
,
isc_buffer_t
*
buffer
,
cfg_type_t
*
type
,
cfg_obj_t
**
ret
);
/*
* Read
in
a configuration
file
containing data of type 'type'
* Read a configuration containing data of type 'type'
* and make '*ret' point to its parse tree.
*
* The configuration is read from the file 'filename'
* (isc_parse_file()) or the buffer 'buffer'
* (isc_parse_buffer()).
*
* Returns an error if the file does not parse correctly.
*
* Requires:
...
...
lib/isccfg/parser.c
View file @
b8d0eef0
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.
7
2001/02/1
6
0
2:57:40
gson Exp $ */
/* $Id: parser.c,v 1.
8
2001/02/1
7
0
0:15:19
gson Exp $ */
#include
<config.h>
...
...
@@ -1227,7 +1227,7 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret)
}
static
isc_result_t
cfg_
parser_openfile
(
cfg_parser_t
*
pctx
,
const
char
*
filename
)
{
parser_openfile
(
cfg_parser_t
*
pctx
,
const
char
*
filename
)
{
isc_result_t
result
;
cfg_listelt_t
*
elt
=
NULL
;
cfg_obj_t
*
stringobj
=
NULL
;
...
...
@@ -1250,17 +1250,15 @@ cfg_parser_openfile(cfg_parser_t *pctx, const char *filename) {
return
(
result
);
}
isc_result_t
cfg_parse_file
(
cfg_parser_t
*
pctx
,
const
char
*
filename
,
cfg_type_t
*
type
,
cfg_obj_t
**
ret
)
{
/*
* Parse a configuration using a pctx where a lexer has already
* been set up with a source.
*/
static
isc_result_t
parse2
(
cfg_parser_t
*
pctx
,
cfg_type_t
*
type
,
cfg_obj_t
**
ret
)
{
isc_result_t
result
;
cfg_obj_t
*
obj
=
NULL
;
REQUIRE
(
filename
!=
NULL
);
CHECK
(
cfg_parser_openfile
(
pctx
,
filename
));
result
=
parse
(
pctx
,
type
,
&
obj
);
if
(
pctx
->
errors
!=
0
)
{
...
...
@@ -1286,6 +1284,33 @@ cfg_parse_file(cfg_parser_t *pctx, const char *filename,
return
(
result
);
}
isc_result_t
cfg_parse_file
(
cfg_parser_t
*
pctx
,
const
char
*
filename
,
cfg_type_t
*
type
,
cfg_obj_t
**
ret
)
{
isc_result_t
result
;
REQUIRE
(
filename
!=
NULL
);
CHECK
(
parser_openfile
(
pctx
,
filename
));
CHECK
(
parse2
(
pctx
,
type
,
ret
));
cleanup:
return
(
result
);
}
isc_result_t
cfg_parse_buffer
(
cfg_parser_t
*
pctx
,
isc_buffer_t
*
buffer
,
cfg_type_t
*
type
,
cfg_obj_t
**
ret
)
{
isc_result_t
result
;
REQUIRE
(
buffer
!=
NULL
);
CHECK
(
isc_lex_openbuffer
(
pctx
->
lexer
,
buffer
));
CHECK
(
parse2
(
pctx
,
type
,
ret
));
cleanup:
return
(
result
);
}
void
cfg_parser_destroy
(
cfg_parser_t
**
pctxp
)
{
cfg_parser_t
*
pctx
=
*
pctxp
;
...
...
@@ -2695,8 +2720,8 @@ parse_mapbody(cfg_parser_t *pctx, cfg_type_t *type, cfg_obj_t **ret)
*/
CHECK
(
parse
(
pctx
,
&
cfg_type_qstring
,
&
includename
));
CHECK
(
parse_semicolon
(
pctx
));
CHECK
(
cfg_
parser_openfile
(
pctx
,
includename
->
value
.
string
.
base
));
CHECK
(
parser_openfile
(
pctx
,
includename
->
value
.
string
.
base
));
cfg_obj_destroy
(
pctx
,
&
includename
);
goto
redo
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment