aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-07-20 19:45:26 +0000
committerFrederic Culot <calcurse@culot.org>2009-07-20 19:45:26 +0000
commitb55cad85dad5bd4bb81c92f6acaef7394b23d9b5 (patch)
tree29f1747c1d00f9a04cbc50ba04db9ba69feaddc3 /src/utils.c
parentc20463c47d5d7bfbeed013d7d0410c65a34cf783 (diff)
downloadcalcurse-b55cad85dad5bd4bb81c92f6acaef7394b23d9b5.tar.gz
calcurse-b55cad85dad5bd4bb81c92f6acaef7394b23d9b5.zip
Beginning of work on implementing calcurse daemon.
Diffstat (limited to 'src/utils.c')
-rwxr-xr-xsrc/utils.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index e041bef..34cb142 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.76 2009/07/12 17:48:14 culot Exp $ */
+/* $calcurse: utils.c,v 1.77 2009/07/20 19:45:27 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -57,6 +57,7 @@
#include "todo.h"
#include "day.h"
#include "keys.h"
+#include "dmon.h"
#include "mem.h"
/* General routine to exit calcurse properly. */
@@ -94,6 +95,8 @@ exit_calcurse (int status)
mem_stats ();
if (remove_lock)
io_unset_lock ();
+
+ dmon_start (status);
exit (status);
}
@@ -938,3 +941,17 @@ file_close (FILE *f, const char *pos)
ret = fclose (f);
EXIT_IF (ret != 0, _("Error when closing file at %s"), pos);
}
+
+/*
+ * Sleep the given number of seconds, but make it more 'precise' than sleep(3)
+ * (hence the 'p') in a way that even if a signal is caught during the sleep
+ * process, this function will return to sleep afterwards.
+ */
+void
+psleep (unsigned secs)
+{
+ unsigned unslept;
+
+ for (unslept = sleep (secs); unslept; unslept = sleep (unslept))
+ ;
+}