summaryrefslogtreecommitdiff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-11-11 19:50:27 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-11-11 19:50:27 +0000
commitc292a3ae50bd0605b015f80266418e391c3c10fe (patch)
tree8f2baf5a9e1cb7a9615190025d9825ed9824f952 /Src/utils.c
parent89d480f57d59a794d8c2e04fc5270bed13b7a28a (diff)
downloadzsh-c292a3ae50bd0605b015f80266418e391c3c10fe.tar.gz
zsh-c292a3ae50bd0605b015f80266418e391c3c10fe.zip
Sven: 13108: Handle traps synchronously
pws: 13109, 13111: clear up zle display when output produced in trap.
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/Src/utils.c b/Src/utils.c
index b7b8d1295..e61e84a03 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1418,12 +1418,38 @@ checkrmall(char *s)
}
/**/
+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