summaryrefslogtreecommitdiffstats
path: root/bin/sh/trap.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-07-23 15:05:00 +0000
committertjr <tjr@FreeBSD.org>2002-07-23 15:05:00 +0000
commit8be25d316fd223870df5d6dffff6ac4135f3e8c0 (patch)
tree4e259b0ff912d02e73edc5d4205d38b1da0e25df /bin/sh/trap.c
parent93a279e0956078ea3ddcb28582cb182a39bdc46b (diff)
downloadFreeBSD-src-8be25d316fd223870df5d6dffff6ac4135f3e8c0.zip
FreeBSD-src-8be25d316fd223870df5d6dffff6ac4135f3e8c0.tar.gz
Catch SIGWINCH in interactive shells and call el_resize() to update
libedit's idea of the window size.
Diffstat (limited to 'bin/sh/trap.c')
-rw-r--r--bin/sh/trap.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index 810070a..2ea182c 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include "error.h"
#include "trap.h"
#include "mystring.h"
+#include "myhistedit.h"
/*
@@ -246,6 +247,12 @@ setsignal(int signo)
action = S_IGN;
break;
#endif
+#ifndef NO_HISTORY
+ case SIGWINCH:
+ if (rootshell && iflag && el != NULL)
+ action = S_CATCH;
+ break;
+#endif
}
}
@@ -359,6 +366,11 @@ onsig(int signo)
! trap[signo][0] == '\0' &&
! (trap[signo][0] == ':' && trap[signo][1] == '\0'))
breakwaitcmd = 1;
+
+#ifndef NO_HISTORY
+ if (signo == SIGWINCH)
+ el_resize(el);
+#endif
}
@@ -414,6 +426,9 @@ setinteractive(int on)
setsignal(SIGINT);
setsignal(SIGQUIT);
setsignal(SIGTERM);
+#ifndef NO_HISTORY
+ setsignal(SIGWINCH);
+#endif
is_interactive = on;
}
OpenPOWER on IntegriCloud