]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorAndreas Gustafsson <source@isc.org>
Wed, 23 Jan 2002 01:53:28 +0000 (01:53 +0000)
committerAndreas Gustafsson <source@isc.org>
Wed, 23 Jan 2002 01:53:28 +0000 (01:53 +0000)
initalise warning
initalise token
only print known token types.

lib/isccfg/parser.c

index 07cde4a5c4b8fc407d24d43bda3c601e8ef60d14..076be332d2a59c1d6a0887ffadfb4b88aed92aa5 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: parser.c,v 1.70.2.11 2002/01/22 23:14:45 gson Exp $ */
+/* $Id: parser.c,v 1.70.2.12 2002/01/23 01:53:28 gson Exp $ */
 
 #include <config.h>
 
@@ -1359,11 +1359,13 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret)
        pctx->seen_eof = ISC_FALSE;
        pctx->ungotten = ISC_FALSE;
        pctx->errors = 0;
+       pctx->warnings = 0;
        pctx->open_files = NULL;
        pctx->closed_files = NULL;
        pctx->line = 0;
        pctx->callback = NULL;
        pctx->callbackarg = NULL;
+       pctx->token.type = isc_tokentype_unknown;
 
        memset(specials, 0, sizeof(specials));
        specials['{'] = 1;
@@ -3507,6 +3509,7 @@ cfg_gettoken(cfg_parser_t *pctx, int options) {
        options |= (ISC_LEXOPT_EOF | ISC_LEXOPT_NOMORE);
 
  redo:
+       pctx->token.type = isc_tokentype_unknown;
        result = isc_lex_gettoken(pctx->lexer, options, &pctx->token);
        pctx->ungotten = ISC_FALSE;
        pctx->line = isc_lex_getsourceline(pctx->lexer);
@@ -3651,6 +3654,9 @@ parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning,
 
                if (pctx->token.type == isc_tokentype_eof) {
                        snprintf(tokenbuf, sizeof(tokenbuf), "end of file");
+               } else if (pctx->token.type == isc_tokentype_unknown) {
+                       flags = 0;
+                       tokenbuf[0] = '\0';
                } else {
                        isc_lex_getlasttokentext(pctx->lexer,
                                                 &pctx->token, &r);