From ad183c61a93ca0146407d314d4ae671c894f88a8 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sun, 18 Nov 2018 22:27:09 +0100 Subject: CLI: do not start daemon if calcurse is running Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/args.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/args.c b/src/args.c index 20d3659..b1bf5ec 100644 --- a/src/args.c +++ b/src/args.c @@ -390,7 +390,7 @@ int parse_args(int argc, char **argv) const char *cfile = NULL, *ifile = NULL, *confdir = NULL; int non_interactive = 1; - int ch; + int ch, cpid; regex_t reg; char buf[BUFSIZ]; struct tm tm; @@ -743,6 +743,8 @@ int parse_args(int argc, char **argv) status = 1; break; case OPT_DAEMON: + EXIT_IF(cpid = io_get_pid(path_cpid), + _("calcurse is running (pid = %d)"), cpid); daemon = 1; filter.type_mask = TYPE_MASK_APPT | TYPE_MASK_RECUR_APPT; break; -- cgit v1.2.3-70-g09d2