summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/config.c b/config.c
index 756f832..bd1aeb8 100644
--- a/config.c
+++ b/config.c
@@ -19,6 +19,7 @@ int getconfstr(char *confname, char *filename, char* dest) {
if (fp == NULL) {
printf("error: could not open configuration file '%s'.\n", filename);
+ debugprint(DEBUG_CRIT, "error: could not open configuration file '%s'.\n", filename);
exit(1);
}
// Loop through the whole file, looking for the requested configuration option
@@ -74,6 +75,7 @@ int getconfstr(char *confname, char *filename, char* dest) {
// Check for start and end quotes
if (conf[0] != '"' || conf[strlen(conf) - 1] != '"') {
printf("Error reading configuration option '%s', not enclosed in double quotes in configuration file '%s'!\n", confname, filename);
+ debugprint(DEBUG_CRIT, "Error reading configuration option '%s', not enclosed in double quotes in configuration file '%s'!\n", confname, filename);
exit(1);
}
@@ -93,8 +95,7 @@ int getconfint(char *confname, char *filename) {
char result[MAXCHAR];
if (!getconfstr(confname, filename, result)) {
printf("getconfint(): error getting configuration option '%s' from configuration file '%s'.\n", confname, filename);
- // TODO - Do something useful here instead of exiting
- exit(1);
+ debugprint(DEBUG_CRIT, "getconfint(): error getting configuration option '%s' from configuration file '%s'.\n", confname, filename);
}
return strtol(result, NULL, 10); // Convert resulting string to an integer, base 10
@@ -126,6 +127,7 @@ int checkpassword(char *password, char *filename) {
}
printf("checkpassword(): unexpectedly got to end of function, quitting.\n");
+ debugprint(DEBUG_CRIT, "checkpassword(): unexpectedly got to end of function, quitting.\n");
exit(1);
}
@@ -142,6 +144,7 @@ int createconfigfile(char *filename) {
if (stat(dir, &st) == -1) {
if (mkdir(dir, 0700)) {
printf("Error creating config directory '%s'.\n", dir);
+ debugprint(DEBUG_CRIT, "Error creating config directory '%s'.\n", dir);
exit(1);
} else {
printf("Created config directory '%s'.\n", dir);
@@ -154,6 +157,7 @@ int createconfigfile(char *filename) {
if (fp == NULL) {
printf("error: could not open default configuration file '%s' for writing.\n", filename);
+ debugprint(DEBUG_CRIT, "error: could not open default configuration file '%s' for writing.\n", filename);
exit(1);
}
@@ -233,8 +237,7 @@ int createconfigfile(char *filename) {
// Write complete string to file
if ((fprintf(fp, "%s", string)) < 0) {
- printf("error: could not write to replay log file.\n");
- exit(1);
+ debugprint(DEBUG_CRIT, "error: could not write to replay log file.\n");
}
fclose(fp);