From 4ca8537286abaafff44ee9ec8489e8b2656093ec Mon Sep 17 00:00:00 2001 From: James Brister Date: Tue, 18 Jul 2000 13:19:27 +0000 Subject: [PATCH] Removed some debugging cruft. Fixed handling of octal/hexadecimal numbers on input. --- lib/dns/config/confndc.c | 40 ++----------------------------- lib/dns/config/confparser.y | 48 ++----------------------------------- 2 files changed, 4 insertions(+), 84 deletions(-) diff --git a/lib/dns/config/confndc.c b/lib/dns/config/confndc.c index a73c720391..2be79c991d 100644 --- a/lib/dns/config/confndc.c +++ b/lib/dns/config/confndc.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: confndc.c,v 1.21 2000/07/11 20:13:09 brister Exp $ */ +/* $Id: confndc.c,v 1.22 2000/07/18 13:19:26 brister Exp $ */ /* ** options { @@ -1381,7 +1381,7 @@ parser_setup(ndcpcontext *pctx, isc_mem_t *mem, const char *filename) { pctx->thecontext = NULL; pctx->errors = 0; pctx->warnings = 0; - pctx->debug_lexer = ISC_TF(getenv("DEBUG_LEXER") != NULL); + pctx->debug_lexer = ISC_FALSE; pctx->prevtok = pctx->currtok = 0; @@ -1610,9 +1610,6 @@ getnexttoken(ndcpcontext *pctx) { case ISC_R_SUCCESS: switch (token.type) { case isc_tokentype_unknown: - if (pctx->debug_lexer) - fprintf(stderr, "unknown token\n"); - result = ISC_R_FAILURE; break; @@ -1629,12 +1626,6 @@ getnexttoken(ndcpcontext *pctx) { tokstr[CONF_MAX_IDENT - 1] = '\0'; } - if (pctx->debug_lexer) - fprintf(stderr, "lexer token: %s : %s\n", - (token.type == isc_tokentype_special ? - "special" : "string"), - tokstr); - result = isc_symtab_lookup(pctx->thekeywords, tokstr, KEYWORD_SYM_TYPE, &keywordtok); @@ -1659,11 +1650,6 @@ getnexttoken(ndcpcontext *pctx) { pctx->currtok = L_INTEGER; sprintf(pctx->tokstr, "%lu", (unsigned long)pctx->intval); - - if(pctx->debug_lexer) - fprintf(stderr, "lexer token: number : %lu\n", - (unsigned long)pctx->intval); - break; case isc_tokentype_qstring: @@ -1672,12 +1658,6 @@ getnexttoken(ndcpcontext *pctx) { CONF_MAX_IDENT); pctx->tokstr[CONF_MAX_IDENT - 1] = '\0'; pctx->currtok = L_QSTRING; - - if (pctx->debug_lexer) - fprintf(stderr, - "lexer token: qstring : \"%s\"\n", - pctx->tokstr); - break; case isc_tokentype_eof: @@ -1690,39 +1670,23 @@ getnexttoken(ndcpcontext *pctx) { * The only way to tell that we closed the * main file and not an included file. */ - if (pctx->debug_lexer) - fprintf(stderr, "lexer token: EOF\n"); - pctx->currtok = L_END_INPUT; } else { - if (pctx->debug_lexer) - fprintf(stderr, - "lexer token: EOF (main)\n"); - pctx->currtok = L_END_INCLUDE; } result = ISC_R_SUCCESS; break; case isc_tokentype_initialws: - if (pctx->debug_lexer) - fprintf(stderr, "lexer token: initial ws\n"); - result = ISC_R_FAILURE; break; case isc_tokentype_eol: - if (pctx->debug_lexer) - fprintf(stderr, "lexer token: eol\n"); - result = ISC_R_FAILURE; break; case isc_tokentype_nomore: - if (pctx->debug_lexer) - fprintf(stderr, "lexer token: nomore\n"); - result = ISC_R_FAILURE; break; } diff --git a/lib/dns/config/confparser.y b/lib/dns/config/confparser.y index 06d503566b..9411eed4d8 100644 --- a/lib/dns/config/confparser.y +++ b/lib/dns/config/confparser.y @@ -16,7 +16,7 @@ * SOFTWARE. */ -/* $Id: confparser.y,v 1.101 2000/07/07 23:11:45 brister Exp $ */ +/* $Id: confparser.y,v 1.102 2000/07/18 13:19:27 brister Exp $ */ #include @@ -122,7 +122,6 @@ static isc_lexspecials_t specials; static isc_result_t tmpres; -static int debug_lexer; static in_port_t default_port; int yyparse(void); @@ -5351,12 +5350,6 @@ dns_c_parse_namedconf(const char *filename, isc_mem_t *mem, INSIST(keywords == NULL); INSIST(callbacks == NULL); -#if 1 - if (getenv("DEBUG_LEXER") != NULL) { /* XXX debug */ - debug_lexer++; - } -#endif - specials['{'] = 1; specials['}'] = 1; specials[';'] = 1; @@ -5515,6 +5508,7 @@ yylex(void) isc_result_t res; int options = (ISC_LEXOPT_EOF | ISC_LEXOPT_NUMBER | + ISC_LEXOPT_CNUMBER | ISC_LEXOPT_QSTRING | ISC_LEXOPT_NOMORE); @@ -5764,10 +5758,6 @@ token_value(isc_token_t *token, isc_symtab_t *symtable) switch (token->type) { case isc_tokentype_unknown: - if (debug_lexer) { - fprintf(stderr, "unknown lexer token\n"); - } - res = -1; break; @@ -5789,24 +5779,11 @@ token_value(isc_token_t *token, isc_symtab_t *symtable) } else { res = keywordtok.as_integer; } - - if (debug_lexer) { - fprintf(stderr, "lexer token: %s : %s (%d)\n", - (token->type == isc_tokentype_special ? - "special" : "string"), tokstring, res); - } - break; case isc_tokentype_number: yylval.ul_int = (isc_uint32_t)token->value.as_ulong; res = L_INTEGER; - - if(debug_lexer) { - fprintf(stderr, "lexer token: number : %lu\n", - (unsigned long)yylval.ul_int); - } - break; case isc_tokentype_qstring: @@ -5817,12 +5794,6 @@ token_value(isc_token_t *token, isc_symtab_t *symtable) } else { res = L_QSTRING; } - - if (debug_lexer) { - fprintf(stderr, "lexer token: qstring : \"%s\"\n", - yylval.text); - } - break; case isc_tokentype_eof: @@ -5833,36 +5804,21 @@ token_value(isc_token_t *token, isc_symtab_t *symtable) /* the only way to tell that we * closed the main file and not an included file */ - if (debug_lexer) { - fprintf(stderr, "lexer token: EOF\n"); - } res = 0; } else { - if (debug_lexer) { - fprintf(stderr, "lexer token: EOF (main)\n"); - } res = L_END_INCLUDE; } break; case isc_tokentype_initialws: - if (debug_lexer) { - fprintf(stderr, "lexer token: initial ws\n"); - } res = -1; break; case isc_tokentype_eol: - if (debug_lexer) { - fprintf(stderr, "lexer token: eol\n"); - } res = -1; break; case isc_tokentype_nomore: - if (debug_lexer) { - fprintf(stderr, "lexer token: nomore\n"); - } res = -1; break; }