#include <unistd.h>
#include <libconfig.h>
-#include "AppConfiguration.h"
#define REMOTE_PATH "REMOTE"
#define MAXLINKS 30
if (!file) {
fprintf(stderr, "Error: Cannot load configuration file %s!\n", fname);
write_at_console("Cannot load configuration file!");
+ fclose(file);
exit(3);
}
- /* File exists, so file has been locked. Release it. */
- fclose(file);
/* Read the file. If there is an error, report it and exit. */
- if(!config_read_file(&cfg, fname))
+ if(!config_read(&cfg, file))
{
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s: In file %s, line %d\n",
+ config_error_text(&cfg),
+ config_error_file(&cfg),
+ config_error_line(&cfg));
config_destroy(&cfg);
+ fclose(file);
exit(3);/* from original code. */
}
if (MyNode==-1) {
write_at_console("Node number must be specified");
config_destroy(&cfg);
+ fclose(file);
exit(1);
};
}
else
{
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "node_number");
config_destroy(&cfg);
+ fclose(file);
exit(1);
}
to_connect++;
}
else {
- AppConfiguration::error(&cfg);
+ fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+ "Warning",
+ fname,
+ "host");
}
config_destroy(&cfg);
+ fclose(file);
if (k==0) all_connected=TRUE;
}