From d822bfbd6298abc653fb27164bb412016e6a0cc0 Mon Sep 17 00:00:00 2001 From: Jann Horn Date: Wed, 8 Jul 2015 11:05:01 +0200 Subject: [PATCH] allow suppressing next suspend --- sleepy.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sleepy.c b/sleepy.c index 7c871e8..4f78424 100644 --- a/sleepy.c +++ b/sleepy.c @@ -1,7 +1,22 @@ #include +#include +#include +#include +#include + +time_t last; + +void keep_running(int _) { + time(&last); + puts("\nmarching on..."); +} int main(void) { - time_t last = 0; + puts("stops roughly at 15-minute time boundaries"); + puts("CTRL+C for no stop in the next 5 minutes"); + puts("stop with ctrl+\\ (SIGQUIT)"); + signal(SIGQUIT, exit); + signal(SIGINT, keep_running); while(1) { sleep(30); time_t unixtime = time(NULL); -- 2.20.1