summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2007-08-15 15:30:17 +0000
committerFrederic Culot <calcurse@culot.org>2007-08-15 15:30:17 +0000
commit1096c2d29f93d72aa701f88f09df9ce9e6177de7 (patch)
tree15ee586ca61a8e92205ef91e6dc3d80ee27fbbe2
parent3d2aab3cb7957934123188e926dd5f129ea29a3b (diff)
downloadcalcurse-1096c2d29f93d72aa701f88f09df9ce9e6177de7.tar.gz
calcurse-1096c2d29f93d72aa701f88f09df9ce9e6177de7.zip
handling of SIGWINCH added
-rwxr-xr-xsrc/sigs.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/sigs.c b/src/sigs.c
index 4928744..e498b24 100755
--- a/src/sigs.c
+++ b/src/sigs.c
@@ -1,4 +1,4 @@
-/* $Id: sigs.c,v 1.2 2007/07/28 13:11:42 culot Exp $ */
+/* $Id: sigs.c,v 1.3 2007/08/15 15:30:17 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -31,12 +31,13 @@
#include "i18n.h"
#include "vars.h"
+#include "wins.h"
/*
* General signal handling routine.
* Catch return values from children (user-defined notification commands).
* This is needed to avoid zombie processes running on system.
- * Also catch CTRL-C (SIGINT) to exit properly.
+ * Also catch CTRL-C (SIGINT), and SIGWINCH to resize screen automatically.
*/
static void
signal_handler(int sig)
@@ -46,6 +47,9 @@ signal_handler(int sig)
while (waitpid(WAIT_MYPGRP, NULL, WNOHANG) > 0)
;
break;
+ case SIGWINCH:
+ wins_reset();
+ break;
}
}
@@ -61,6 +65,14 @@ sigs_init(struct sigaction *sa)
exit(EXIT_FAILURE);
}
+ sa->sa_handler = signal_handler;
+ sa->sa_flags = 0;
+ sigemptyset(&sa->sa_mask);
+ if (sigaction(SIGWINCH, sa, NULL) != 0) {
+ perror("sigaction");
+ exit(EXIT_FAILURE);
+ }
+
sa->sa_handler = SIG_IGN;
sa->sa_flags = 0;
sigemptyset(&(sa->sa_mask));