-static void read_config(int signalnum) {
- FILE *fp;
- int continuous_mode_seen = 0;
- struct swb_config_line line;
- char *default_browser = 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 {
- /* Don't need this line's contents */
- free(line.value);
- }
+ if (read(eventpipe[0], &eventnum, sizeof eventnum) == (sizeof eventnum)) {
+ /* Handle the event passed to us */
+ switch (eventnum) {
+ /* SIGHUP received -- reread config file */
+ case SIGHUP:
+ read_config();
+ break;
+ default:
+ return FALSE;