rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 2ab8e78dfa862d4a378f766548442c24efa516cc
parent c95bdf7ce9be6c6ed8ca4b0a474fc4947836eba9
Author: Toby Goodwin <toby@paccrat.org>
Date:   Thu, 25 Aug 2016 21:46:12 +0100

Merge pull request #14 from muennich/edit-sigh

Restore signal handlers when catching signals in edit_alloc()
Diffstat:
Medit-edit.c | 5++++-
Medit-editline.c | 5++++-
Medit-readline.c | 5++++-
Medit-vrl.c | 5++++-
4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/edit-edit.c b/edit-edit.c @@ -37,7 +37,11 @@ void *edit_begin(int fd) { } +static void (*oldint)(int), (*oldquit)(int); + static void edit_catcher(int sig) { + sys_signal(SIGINT, oldint); + sys_signal(SIGQUIT, oldquit); write(2, "\n", 1); rc_raise(eError); } @@ -46,7 +50,6 @@ char *edit_alloc(void *cookie, size_t *count) { const char *r; HistEvent he; struct cookie *c = cookie; - void (*oldint)(int), (*oldquit)(int); oldint = sys_signal(SIGINT, edit_catcher); oldquit = sys_signal(SIGQUIT, edit_catcher); diff --git a/edit-editline.c b/edit-editline.c @@ -29,7 +29,11 @@ void *edit_begin(int fd) { } /* +static void (*oldint)(int), (*oldquit)(int); + static void edit_catcher(int sig) { + sys_signal(SIGINT, oldint); + sys_signal(SIGQUIT, oldquit); write(2, "\n", 1); rc_raise(eError); } @@ -42,7 +46,6 @@ char *edit_alloc(void *cookie, size_t *count) { const char *r; HistEvent he; struct cookie *c = cookie; - void (*oldint)(int), (*oldquit)(int); oldint = sys_signal(SIGINT, edit_catcher); oldquit = sys_signal(SIGQUIT, edit_catcher); diff --git a/edit-readline.c b/edit-readline.c @@ -32,7 +32,11 @@ void *edit_begin(int fd) { return c; } +static void (*oldint)(int), (*oldquit)(int); + static void edit_catcher(int sig) { + sys_signal(SIGINT, oldint); + sys_signal(SIGQUIT, oldquit); write(2, "\n", 1); rc_raise(eError); } @@ -41,7 +45,6 @@ static char *prompt; char *edit_alloc(void *cookie, size_t *count) { struct cookie *c = cookie; - void (*oldint)(int), (*oldquit)(int); oldint = sys_signal(SIGINT, edit_catcher); oldquit = sys_signal(SIGQUIT, edit_catcher); diff --git a/edit-vrl.c b/edit-vrl.c @@ -32,7 +32,11 @@ void *edit_begin(int fd) { } /* +static void (*oldint)(int), (*oldquit)(int); + static void edit_catcher(int sig) { + sys_signal(SIGINT, oldint); + sys_signal(SIGQUIT, oldquit); write(2, "\n", 1); rc_raise(eError); } @@ -45,7 +49,6 @@ char *edit_alloc(void *cookie, size_t *count) { const char *r; HistEvent he; struct cookie *c = cookie; - void (*oldint)(int), (*oldquit)(int); oldint = sys_signal(SIGINT, edit_catcher); oldquit = sys_signal(SIGQUIT, edit_catcher);