Add a still experimental patch to handle a bit more gracefully signals - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 8b9a42a02ecb1b04fe9c466555b7b2d0eb2d447d
(DIR) parent dc1c3fef628754ee58e1aa697fc60ba7e769a879
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sun, 16 Sep 2018 15:23:43
Add a still experimental patch to handle a bit more gracefully signals
Diffstat:
wip/sacc-git/patch-sigcont-and-sigtstp.patch | 107 +++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)
---
diff -r dc1c3fef6287 -r 8b9a42a02ecb wip/sacc-git/patch-sigcont-and-sigtstp.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wip/sacc-git/patch-sigcont-and-sigtstp.patch Sun Sep 16 15:23:43 2018 +0200
@@ -0,0 +1,107 @@
+Add initial and incomplete support for SIG{CONT,TSTP}
+
+This is probably still not completely correct, e.g. can we gracefully
+handle the case where `/' is pressed and some input for the search
+was entered?
+
+Apart that, signals are properly not handled correctly when in
+PAGER and the screen is messed up there too.
+
+--- common.h.orig
++++ common.h
+@@ -35,4 +35,6 @@ char *uiprompt(char *fmt, ...);
+ Item *uiselectitem(Item *entry);
+ void uisetup(void);
+ void uisigwinch(int signal);
++void uisigcont(int signal);
++void uisigtstp(int signal);
+ void uistatus(char *fmt, ...);
+diff --git a/sacc.c b/sacc.c
+index 1ed1d1c..60e62ca 100644
+--- sacc.c.orig
++++ sacc.c
+@@ -965,6 +965,10 @@ setup(void)
+ uisetup();
+ sa.sa_handler = uisigwinch;
+ sigaction(SIGWINCH, &sa, NULL);
++ sa.sa_handler = uisigcont;
++ sigaction(SIGCONT, &sa, NULL);
++ sa.sa_handler = uisigtstp;
++ sigaction(SIGTSTP, &sa, NULL);
+ }
+ }
+
+diff --git a/ui_ti.c b/ui_ti.c
+index ae11338..c324043 100644
+--- ui_ti.c.orig
++++ ui_ti.c
+@@ -1,3 +1,4 @@
++#include <signal.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -554,8 +555,7 @@ uisigwinch(int signal)
+ {
+ Dir *dir;
+
+- setupterm(NULL, 1, NULL);
+- putp(tparm(change_scroll_region, 0, lines-2, 0, 0, 0, 0, 0, 0, 0));
++ uisetup();
+
+ if (!curentry || !(dir = curentry->dat))
+ return;
+@@ -565,3 +565,19 @@ uisigwinch(int signal)
+
+ uidisplay(curentry);
+ }
++
++void
++uisigcont(int signal)
++{
++
++ uicleanup();
++ uisigwinch(signal);
++}
++
++void
++uisigtstp(int signal)
++{
++
++ uicleanup();
++ kill(getpid(), SIGSTOP);
++}
+diff --git a/ui_txt.c b/ui_txt.c
+index 3b9d964..d7d868f 100644
+--- ui_txt.c.orig
++++ ui_txt.c
+@@ -1,10 +1,12 @@
+ #include <ctype.h>
+ #include <errno.h>
++#include <signal.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <termios.h>
++#include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+
+@@ -336,3 +338,17 @@ uisigwinch(int signal)
+ printstatus(curentry, cmd);
+ fflush(stdout);
+ }
++
++void
++uisigcont(int signal)
++{
++
++ uisigwinch(signal);
++}
++
++void
++uisigtstp(int signal)
++{
++
++ kill(getpid(), SIGSTOP);
++}