From c292a3ae50bd0605b015f80266418e391c3c10fe Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 11 Nov 2000 19:50:27 +0000 Subject: Sven: 13108: Handle traps synchronously pws: 13109, 13111: clear up zle display when output produced in trap. --- Src/utils.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'Src/utils.c') diff --git a/Src/utils.c b/Src/utils.c index b7b8d1295..e61e84a03 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1417,13 +1417,39 @@ checkrmall(char *s) return (getquery("ny", 1) == 'y'); } +/**/ +mod_export int +ztrapread(int fd, char *buf, int len) +{ + int ret; + + ALLOWTRAPS { + ret = read(fd, buf, len); + } DISALLOWTRAPS; + + return ret; +} + +/**/ +mod_export int +ztrapwrite(int fd, char *buf, int len) +{ + int ret; + + ALLOWTRAPS { + ret = write(fd, buf, len); + } DISALLOWTRAPS; + + return ret; +} + /**/ int read1char(void) { char c; - while (read(SHTTY, &c, 1) != 1) { + while (ztrapread(SHTTY, &c, 1) != 1) { if (errno != EINTR || errflag || retflag || breaks || contflag) return -1; } @@ -1440,7 +1466,7 @@ noquery(int purge) ioctl(SHTTY, FIONREAD, (char *)&val); if (purge) { for (; val; val--) - read(SHTTY, &c, 1); + ztrapread(SHTTY, &c, 1); } #endif -- cgit 1.4.1