# HG changeset patch # User Thomas Klausner # Date 1360666270 -3600 # Node ID 6cdb2a54aaf670793af98d9a91793cc56680a9bd # Parent e6bf3214d1ef47e7c9c60db67061f97c05958124 Log config file errors using the standard logging framework instead of fprintf. diff -r e6bf3214d1ef -r 6cdb2a54aaf6 libfdcore/fdd.l --- a/libfdcore/fdd.l Sun Jan 20 03:22:41 2013 +0100 +++ b/libfdcore/fdd.l Tue Feb 12 11:51:10 2013 +0100 @@ -51,8 +51,7 @@ #define YY_USER_ACTION { \ yylloc->first_column = yylloc->last_column + 1; \ yylloc->last_column = yylloc->first_column + yyleng - 1; \ - TRACE_DEBUG(FULL, \ - "(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \ + TRACE_DEBUG_ERROR("(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \ yylloc->first_line, yylloc->first_column, \ yylloc->last_line, yylloc->last_column, \ yy_act, yyleng, yytext); \ @@ -103,7 +102,7 @@ int ret = sscanf(yytext, "%i", &yylval->integer); if (ret != 1) { /* No matching: an error occurred */ - fprintf(stderr, "Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno)); + TRACE_DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno)); return LEX_ERROR; /* trig an error in yacc parser */ /* Maybe we could REJECT instead of failing here? */ } @@ -146,7 +145,7 @@ <*>[[:alnum:]]+ | /* This rule is only useful to print a complete token in error messages */ /* Unrecognized character */ <*>. { - fprintf(stderr, "Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext); + TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext); return LEX_ERROR; } diff -r e6bf3214d1ef -r 6cdb2a54aaf6 libfdcore/fdd.y --- a/libfdcore/fdd.y Sun Jan 20 03:22:41 2013 +0100 +++ b/libfdcore/fdd.y Tue Feb 12 11:51:10 2013 +0100 @@ -61,12 +61,13 @@ /* Function to report error */ void yyerror (YYLTYPE *ploc, struct fd_config * conf, char const *s) { - if (ploc->first_line != ploc->last_line) - fprintf(stderr, "%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s); - else if (ploc->first_column != ploc->last_column) - fprintf(stderr, "%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s); - else - fprintf(stderr, "%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s); + if (ploc->first_line != ploc->last_line) { + TRACE_DEBUG_ERROR("%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s); + } else if (ploc->first_column != ploc->last_column) { + TRACE_DEBUG_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s); + } else { + TRACE_DEBUG_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s); + } } int got_peer_noip = 0;