diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -48,7 +48,7 @@ int getconfstr(char *confname, char *filename, char* dest) { // If we got here, then either we found the configuration option or we ran out of file if (!found) { - debugprint("Error reading configuration option '%s', did not find it in configuration file '%s'.\n", confname, filename); + debugprint(DEBUG_SOME, "Error reading configuration option '%s', did not find it in configuration file '%s'.\n", confname, filename); fclose(fp); return 0; } @@ -80,7 +80,7 @@ int getconfstr(char *confname, char *filename, char* dest) { strncpy(dest, conf + 1, strlen(conf) - 2); // Copy result to destination string without quotes dest[strlen(conf) - 2] = '\0'; // Null terminate - debugprint("getconfstr(): returning '%s'.\n", dest); + debugprint(DEBUG_FULL, "getconfstr(): returning '%s'.\n", dest); // Close fine and return success fclose(fp); @@ -107,21 +107,21 @@ int checkpassword(char *password, char *filename) { char confpassword[MAXCHAR]; if (!getconfstr("password", filename, confpassword)) { - debugprint("checkpassword(): error getting configuration option 'password' from configuration file '%s'.\n", filename); + debugprint(DEBUG_CRIT, "checkpassword(): error getting configuration option 'password' from configuration file '%s'.\n", filename); return 0; } // Ensure passwords are the same length if (strlen(password) != strlen(confpassword)) { - debugprint("Password length mismatch!\n"); + debugprint(DEBUG_SOME, "Password length mismatch!\n"); return 0; } // Ensure passwords match if (strncmp(password, confpassword, strlen(password)) == 0) { - debugprint("confpassword matches password.\n"); + debugprint(DEBUG_FULL, "confpassword matches password.\n"); return 1; } else { - debugprint("confpassword does NOT match password!\n"); + debugprint(DEBUG_SOME, "confpassword does NOT match password!\n"); return 0; } @@ -227,9 +227,9 @@ int createconfigfile(char *filename) { "# Replay log goes to basedir/replay.log\n" "replaylogging = \"1\"\n" "\n" - "# Debug output control (\"2\" for print to screen, \"1\" for print to file, or \"0\" for disabled)\n" - "# (The debug file can be found in <basedir>/debug.txt)\n" - "debug = \"1\"\n"; + "# Debug verbosity (\"0\" for critical only, \"1\" for some extra info, \"2\" for full debug mode)\n" + "# (All output goes to <basedir>/debug.txt)\n" + "debug = \"2\"\n"; // Write complete string to file if ((fprintf(fp, "%s", string)) < 0) { |