Stop daemon when calcurse enters interactive mode.
This commit is contained in:
parent
bccd37ef96
commit
279c564d2b
@ -8,6 +8,8 @@
|
||||
|
||||
* src/args.c (status_arg): new function
|
||||
* src/args.c: --status flag added
|
||||
|
||||
* src/dmon.c (dmon_stop): new function
|
||||
|
||||
2009-07-23 Frederic Culot <frederic@culot.org>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $calcurse: calcurse.c,v 1.84 2009/07/19 16:51:36 culot Exp $ */
|
||||
/* $calcurse: calcurse.c,v 1.85 2009/07/26 20:38:35 culot Exp $ */
|
||||
|
||||
/*
|
||||
* Calcurse - text-based organizer
|
||||
@ -53,6 +53,7 @@
|
||||
#include "args.h"
|
||||
#include "notify.h"
|
||||
#include "keys.h"
|
||||
#include "dmon.h"
|
||||
|
||||
/*
|
||||
* Calcurse is a text-based personal organizer which helps keeping track
|
||||
@ -101,6 +102,7 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
no_data_file = io_check_data_files ();
|
||||
dmon_stop ();
|
||||
io_set_lock ();
|
||||
}
|
||||
|
||||
|
19
src/dmon.c
19
src/dmon.c
@ -1,4 +1,4 @@
|
||||
/* $calcurse: dmon.c,v 1.3 2009/07/26 12:47:15 culot Exp $ */
|
||||
/* $calcurse: dmon.c,v 1.4 2009/07/26 20:38:36 culot Exp $ */
|
||||
|
||||
/*
|
||||
* Calcurse - text-based organizer
|
||||
@ -180,3 +180,20 @@ dmon_start (int parent_exit_status)
|
||||
(void)io_fprintln (path_dmon_log, _("awakened at %s\n"), nowstr ());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if calcurse is running in background, and if yes, send a SIGINT
|
||||
* signal to stop it.
|
||||
*/
|
||||
void
|
||||
dmon_stop (void)
|
||||
{
|
||||
int dpid;
|
||||
|
||||
dpid = io_get_pid (path_dpid);
|
||||
if (!dpid)
|
||||
return;
|
||||
|
||||
if (kill ((pid_t)dpid, SIGINT) < 0)
|
||||
EXIT (_("Could not stop calcurse daemon: %s\n"), strerror (errno));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $calcurse: dmon.h,v 1.1 2009/07/20 19:44:04 culot Exp $ */
|
||||
/* $calcurse: dmon.h,v 1.2 2009/07/26 20:38:36 culot Exp $ */
|
||||
|
||||
/*
|
||||
* Calcurse - text-based organizer
|
||||
@ -40,5 +40,6 @@
|
||||
#define CALCURSE_DMON_H
|
||||
|
||||
void dmon_start (int);
|
||||
void dmon_stop (void);
|
||||
|
||||
#endif /* CALCURSE_DMON_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user