Navigation


Changeset 918:46f9982b7d26 in freeDiameter for libfdcore/fdd.y


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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.