aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2018-11-18 22:27:09 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2019-01-07 16:57:53 +0100
commitad183c61a93ca0146407d314d4ae671c894f88a8 (patch)
treeef82f839041d99eb099fa3a761308cbca1e89a27 /src
parent7851f46fbb1e84fe4fa62a36d1f79b936f040e66 (diff)
downloadcalcurse-ad183c61a93ca0146407d314d4ae671c894f88a8.tar.gz
calcurse-ad183c61a93ca0146407d314d4ae671c894f88a8.zip
CLI: do not start daemon if calcurse is running
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/args.c4
1 files changed, 3 insertions, 1 deletions
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;