Let SIGUSR1 trigger a reload
In an effort to better integrate the import process with external applications, it's desirable to have a mechanism by which external programs can trigger a reload of calcurse's data. This patch adds that functionality via SIGUSR1. The reload request is handled in the main loop. When the user is currently entering data, the request is delayed until the main loop is re-entered. Signed-off-by: Tim Hentenaar <tim@hentenaar.com> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
committed by
Lukas Fleischer
parent
7f06c25230
commit
7f62fb185c
@@ -86,6 +86,10 @@ static void generic_hdlr(int sig)
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case SIGUSR1:
|
||||
want_reload = 1;
|
||||
ungetch(KEY_RESIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +116,7 @@ void sigs_init()
|
||||
if (!sigs_set_hdlr(SIGCHLD, generic_hdlr)
|
||||
|| !sigs_set_hdlr(SIGWINCH, generic_hdlr)
|
||||
|| !sigs_set_hdlr(SIGTERM, generic_hdlr)
|
||||
|| !sigs_set_hdlr(SIGUSR1, generic_hdlr)
|
||||
|| !sigs_set_hdlr(SIGINT, SIG_IGN))
|
||||
exit_calcurse(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user