- FILE *fp;
- int continuous_mode_seen = 0;
- struct swb_config_line line;
- char *default_browser = NULL, *logger_name = NULL;
-
- set_config_defaults(&ctx);
-
- if (!(fp = open_config_file()))
- goto out_noopen;
-
- /* Parse the config file
- TODO: should we handle errors differently than EOF? */
- if (!parse_config_file_begin())
- goto out;
- while (!parse_config_file_line(fp, &line)) {
- if (line.parsed) {
- if (!strcmp(line.key, "continuous_mode")) {
- if (!continuous_mode_seen) {
- ctx.continuous_mode = atoi(line.value);
- continuous_mode_seen = 1;
- }
- free(line.value);
- } else if (!strcmp(line.key, "default_browser")) {
- if (!default_browser)
- default_browser = line.value;
- } else if (!strcmp(line.key, "other_browser_cmd")) {
- if (!ctx.other_browser_cmd)
- ctx.other_browser_cmd = line.value;
- } else if (!strcmp(line.key, "logging")) {
- if (!logger_name)
- logger_name = line.value;
- } else {
- /* Don't need this line's contents */
- free(line.value);
- }
+ struct swb_config cfg;
+
+ swb_config_init(&cfg);
+
+ swb_config_load(&cfg);
+
+ log_config(cfg.logging);
+#ifdef FREMANTLE
+ /* continuous mode is required on Fremantle */
+ ctx.continuous_mode = 1;
+ if (!cfg.continuous_mode)
+ log_msg("continuous_mode = 0 operation no longer supported, ignoring config setting\n");
+#else
+ ctx.continuous_mode = cfg.continuous_mode;
+#endif
+ free(ctx.other_browser_cmd);
+ if (cfg.other_browser_cmd) {
+ if (!(ctx.other_browser_cmd = strdup(cfg.other_browser_cmd))) {
+ log_perror(errno, "Failed to set other_browser_cmd");
+ exit(1);