Changeset 1571 in MondoRescue for branches/stable/mondo/src/lib/mr_conf.c


Ignore:
Timestamp:
Jul 26, 2007, 2:12:40 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Improve mr_conf functions loging with conf file filename printed
  • MINDI_CONF_DIR depends on MONDO_CONF_DIR (just a bit better)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/lib/mr_conf.c

    r1559 r1571  
    8080static int internal_flags = 0;  /*state of the module */
    8181static FILE *CONF = NULL;       /* Configuration file FD */
     82static char *mr_conf_filename = NULL;   /* Configuration filename */
    8283
    8384/*if output all error and warning messages*/
     
    108109    CONF = fopen(filename, "r");
    109110
     111    mr_asprintf(&mr_conf_filename,filename);
     112
    110113    /*if file is empty or not exist => error */
    111114    if (length == 0) {
     
    146149    mr_free(buffer);
    147150    fclose(CONF);
     151
     152    mr_free(mr_conf_filename);
    148153
    149154    /*set flag that module is in "close" state */
     
    389394        switch (error_code) {
    390395        case MRCONF_BAD_FILE:
    391             mr_msg_int(1,line,file,"%s %s %s", MRCONF_STR_ERROR, MRCONF_STR_BAD_FILE,
     396            mr_msg_int(1,line,file,"%s (%s) %s %s", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_BAD_FILE,
    392397                   add_line);
    393398            break;
    394399
    395400        case MRCONF_READING_FAILED:
    396             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_ERROR, MRCONF_STR_READING_FAILED);
     401            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_READING_FAILED);
    397402            break;
    398403
    399404        case MRCONF_FIELD_NOT_FOUND:
    400             mr_msg_int(1,line,file,"%s %s \"%s\"", MRCONF_STR_ERROR, MRCONF_STR_FIELD_NOT_FOUND, add_line);
    401             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_WARNING, MRCONF_STR_SET_TO_ZERO);
     405            mr_msg_int(1,line,file,"%s (%s) %s \"%s\"", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_FIELD_NOT_FOUND, add_line);
     406            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_WARNING, mr_conf_filename, MRCONF_STR_SET_TO_ZERO);
    402407            break;
    403408
    404409        case MRCONF_FIELD_NO_VALUE:
    405             mr_msg_int(1,line,file,"%s %s \"%s\"", MRCONF_STR_ERROR, MRCONF_STR_FIELD_NO_VALUE, add_line);
    406             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_WARNING, MRCONF_STR_IGNORE);
     410            mr_msg_int(1,line,file,"%s (%s) %s \"%s\"", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_FIELD_NO_VALUE, add_line);
     411            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_WARNING, mr_conf_filename, MRCONF_STR_IGNORE);
    407412            break;
    408413
    409414        case MRCONF_CLOSE_BUT_NOT_OPEN:
    410             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_WARNING, MRCONF_STR_CLOSE_BUT_NOT_OPEN);
     415            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_WARNING, mr_conf_filename, MRCONF_STR_CLOSE_BUT_NOT_OPEN);
    411416            break;
    412417
    413418        case MRCONF_CALL_BUT_NOT_OPEN:
    414             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_WARNING, MRCONF_STR_CALL_BUT_NOT_OPEN);
     419            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_WARNING, mr_conf_filename, MRCONF_STR_CALL_BUT_NOT_OPEN);
    415420            break;
    416421
    417422        case MRCONF_OPEN_OPENED:
    418             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_ERROR, MRCONF_STR_OPEN_OPENED);
     423            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_OPEN_OPENED);
    419424            break;
    420425
    421426        case MRCONF_STRING_QUOTE:
    422             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_ERROR, MRCONF_STR_STRING_QUOTE);
     427            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_STRING_QUOTE);
    423428            break;
    424429
    425430        case MRCONF_STRING_ENDQUOTE:
    426             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_ERROR, MRCONF_STR_STRING_ENDQUOTE);
     431            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_STRING_ENDQUOTE);
    427432            break;
    428433
    429434        default:
    430             mr_msg_int(1,line,file,"%s %s", MRCONF_STR_ERROR, MRCONF_STR_DEFAULT_ERROR);
    431             break;
    432         }
    433     }
    434 }
     435            mr_msg_int(1,line,file,"%s (%s) %s", MRCONF_STR_ERROR, mr_conf_filename, MRCONF_STR_DEFAULT_ERROR);
     436            break;
     437        }
     438    }
     439}
Note: See TracChangeset for help on using the changeset viewer.