Navigation


Changeset 918:46f9982b7d26 in freeDiameter


Ignore:
Timestamp:
Feb 12, 2013, 10:57:32 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Use logging routines for configuration file parsing (based on patch by Thomas)

Location:
libfdcore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/fdd.l

    r740 r918  
    5252        yylloc->first_column = yylloc->last_column + 1;                 \
    5353        yylloc->last_column = yylloc->first_column + yyleng - 1;        \
    54         TRACE_DEBUG(FULL,                                               \
     54        TRACE_DEBUG_ERROR(                                              \
    5555                "(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \
    5656                yylloc->first_line, yylloc->first_column,               \
     
    104104                                if (ret != 1) {
    105105                                        /* No matching: an error occurred */
    106                                         fprintf(stderr, "Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
     106                                        TRACE_DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
    107107                                        return LEX_ERROR; /* trig an error in yacc parser */
    108108                                        /* Maybe we could REJECT instead of failing here? */
     
    146146<*>[[:alnum:]]+         |       /* This rule is only useful to print a complete token in error messages */
    147147        /* Unrecognized character */
    148 <*>.                    { 
    149                                 fprintf(stderr, "Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
     148<*>.                    {
     149                                TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
    150150                                return LEX_ERROR;
    151151                        }
  • libfdcore/fdd.y

    r808 r918  
    6262void yyerror (YYLTYPE *ploc, struct fd_config * conf, char const *s)
    6363{
    64         if (ploc->first_line != ploc->last_line)
    65                 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);
    66         else if (ploc->first_column != ploc->last_column)
    67                 fprintf(stderr, "%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
    68         else
    69                 fprintf(stderr, "%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);
     64        if (ploc->first_line != ploc->last_line) {
     65                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);
     66        } else if (ploc->first_column != ploc->last_column) {
     67                TRACE_DEBUG_ERROR("%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s);
     68        } else {
     69                TRACE_DEBUG_ERROR("%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s);
     70        }
    7071}
    7172
     
    327328                                if (fd == NULL) {
    328329                                        int ret = errno;
    329                                         TRACE_DEBUG(INFO, "Unable to open extension file %s for reading: %s\n", fname, strerror(ret));
     330                                        TRACE_DEBUG_ERROR("Unable to open extension file %s for reading: %s\n", fname, strerror(ret));
    330331                                        yyerror (&yylloc, conf, "Error adding extension");
    331332                                        YYERROR;
     
    501502                                if (fd == NULL) {
    502503                                        int ret = errno;
    503                                         TRACE_DEBUG(INFO, "Unable to open certificate file %s for reading: %s\n", $3, strerror(ret));
     504                                        TRACE_DEBUG_ERROR("Unable to open certificate file %s for reading: %s\n", $3, strerror(ret));
    504505                                        yyerror (&yylloc, conf, "Error on file name");
    505506                                        YYERROR;
     
    509510                                if (fd == NULL) {
    510511                                        int ret = errno;
    511                                         TRACE_DEBUG(INFO, "Unable to open private key file %s for reading: %s\n", $5, strerror(ret));
     512                                        TRACE_DEBUG_ERROR("Unable to open private key file %s for reading: %s\n", $5, strerror(ret));
    512513                                        yyerror (&yylloc, conf, "Error on file name");
    513514                                        YYERROR;
     
    532533                                if (fd == NULL) {
    533534                                        int ret = errno;
    534                                         TRACE_DEBUG(INFO, "Unable to open CA file %s for reading: %s\n", $3, strerror(ret));
     535                                        TRACE_DEBUG_ERROR("Unable to open CA file %s for reading: %s\n", $3, strerror(ret));
    535536                                        yyerror (&yylloc, conf, "Error on file name");
    536537                                        YYERROR;
     
    572573                                if (fd == NULL) {
    573574                                        int ret = errno;
    574                                         TRACE_DEBUG(INFO, "Unable to open CRL file %s for reading: %s\n", $3, strerror(ret));
     575                                        TRACE_DEBUG_ERROR("Unable to open CRL file %s for reading: %s\n", $3, strerror(ret));
    575576                                        yyerror (&yylloc, conf, "Error on file name");
    576577                                        YYERROR;
     
    615616                                                        &err_pos),
    616617                                                { yyerror (&yylloc, conf, "Error setting Priority parameter.");
    617                                                   fprintf(stderr, "Error at position : %s\n", err_pos);
     618                                                  TRACE_DEBUG_ERROR("Error at position : %s\n", err_pos);
    618619                                                  YYERROR; } );
    619620                        }
     
    632633                                if (fd == NULL) {
    633634                                        int ret = errno;
    634                                         TRACE_DEBUG(INFO, "Unable to open DH file %s for reading: %s\n", $3, strerror(ret));
     635                                        TRACE_DEBUG_ERROR("Unable to open DH file %s for reading: %s\n", $3, strerror(ret));
    635636                                        yyerror (&yylloc, conf, "Error on file name");
    636637                                        YYERROR;
Note: See TracChangeset for help on using the changeset viewer.