1 From ffde3048b9c7291172ffc98b47dc8abe644f9cd6 Mon Sep 17 00:00:00 2001
2 From: "S. Gilles" <sgilles@math.umd.edu>
3 Date: Mon, 4 Feb 2019 09:41:13 -0500
4 Subject: [PATCH 4/5] redraw on SIGUSR1
7 fbpdf.c | 16 ++++++++++++++--
8 1 file changed, 14 insertions(+), 2 deletions(-)
10 diff --git a/fbpdf.c b/fbpdf.c
11 index b006af0..e50b045 100644
14 @@ -51,6 +51,7 @@ static int zoom = 15;
15 static int zoom_def = 15; /* default zoom */
18 +static sig_atomic_t should_redraw;
20 static void draw(void)
22 @@ -116,8 +117,13 @@ static int readkey(void)
26 - if (read(0, &b, 1) <= 0)
27 + if (read(0, &b, 1) <= 0) {
28 + if (should_redraw) {
37 @@ -173,6 +179,11 @@ static void sigcont(int sig)
41 +static void sigreload(int sig)
46 static int reload(void)
49 @@ -220,7 +231,8 @@ static void mainloop(void)
50 int hstep = scols / PAGESTEPS;
53 - signal(SIGCONT, sigcont);
54 + sigaction(SIGCONT, &(struct sigaction){.sa_handler = sigcont}, 0);
55 + sigaction(SIGUSR1, &(struct sigaction){.sa_handler = sigreload}, 0);