From 918ef3a73ec7bfb167651781ba373cf8e305ebe0 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Thu, 28 Jan 1999 18:15:57 +0000 Subject: [PATCH] save options before doing DNS multiline mode --- lib/isc/include/isc/lex.h | 5 +++-- lib/isc/lex.c | 14 ++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h index a7ed802fa1..269891223e 100644 --- a/lib/isc/include/isc/lex.h +++ b/lib/isc/include/isc/lex.h @@ -75,8 +75,9 @@ /* * The ISC_LEXOPT_DNSMULTILINE option handles the processing of '(' and ')' in * the DNS master file format. If this option is set, then the - * ISC_LEXOPT_INITIALWS and ISC_LEXOPT_EOL options will be ignored. - * To use this option, '(' and ')' must be special characters. + * ISC_LEXOPT_INITIALWS and ISC_LEXOPT_EOL options will be ignored when + * the paren count is > 0. To use this option, '(' and ')' must be special + * characters. */ #define ISC_LEXOPT_DNSMULTILINE 0x20 /* Handle '(' and ')'. */ #define ISC_LEXOPT_NOMORE 0x40 /* Want "no more" token. */ diff --git a/lib/isc/lex.c b/lib/isc/lex.c index 48a16e8a35..f03777eb4b 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -300,7 +300,7 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { char *curr, *prev; size_t remaining; u_long u_long; - unsigned int i; + unsigned int i, saved_options; /* * Get the next token. @@ -338,12 +338,9 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { return (ISC_R_EOF); } - if ((options & ISC_LEXOPT_DNSMULTILINE) != 0) { - if (lex->paren_count > 0) - options &= ~IWSEOL; - else - options |= IWSEOL; - } + saved_options = options; + if ((options & ISC_LEXOPT_DNSMULTILINE) != 0 && lex->paren_count > 0) + options &= ~IWSEOL; curr = lex->data; prev = NULL; @@ -450,7 +447,8 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { return (ISC_R_UNBALANCED); lex->paren_count--; if (lex->paren_count == 0) - options |= IWSEOL; + options = + saved_options; } continue; }