From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Signal handling/zcurses
Date: Thu, 21 Apr 2011 08:47:15 -0700 [thread overview]
Message-ID: <110421084717.ZM11635@torch.brasslantern.com> (raw)
In-Reply-To: <20110421143145.GC6357@layslair.ath.cx>
On Apr 21, 4:31pm, Anthony Charles wrote:
}
} man 3 getch says about wgetch in portability section that it may not
} be interrupted by signals or it may return ERR with errno set to EINTR
} depending of the implementation and OS. In my case, on Debian it
} seems it's the second choice :)
Try this.
Index: Src/Modules/curses.c
===================================================================
--- curses.c 4 Nov 2008 04:47:53 -0000 1.4
+++ curses.c 21 Apr 2011 15:39:05 -0000
@@ -1070,7 +1070,11 @@
#endif
#ifdef HAVE_WGET_WCH
- switch (wget_wch(w->win, &wi)) {
+ while ((errno = 0), (ret = wget_wch(w->win, &wi)) == ERR) {
+ if (errno != EINTR)
+ break;
+ }
+ switch (ret) {
case OK:
ret = wctomb(instr, (wchar_t)wi);
if (ret == 0) {
@@ -1092,9 +1096,10 @@
return 1;
}
#else
- ci = wgetch(w->win);
- if (ci == ERR)
- return 1;
+ while ((errno = 0), (ci = wgetch(w->win)) == ERR) {
+ if (errno != EINTR)
+ return 1;
+ }
if (ci >= 256) {
keypadnum = ci;
*instr = '\0';
--
next prev parent reply other threads:[~2011-04-21 15:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-20 10:19 Anthony Charles
2011-04-20 14:40 ` Bart Schaefer
2011-04-20 19:22 ` Anthony Charles
2011-04-21 8:48 ` Bart Schaefer
2011-04-21 14:31 ` Anthony Charles
2011-04-21 15:47 ` Bart Schaefer [this message]
2011-04-21 18:08 ` Anthony Charles
2011-04-22 3:07 ` Bart Schaefer
2011-04-22 5:52 ` Bart Schaefer
2011-04-22 14:22 ` Bart Schaefer
2011-04-27 8:38 ` Anthony Charles
2011-04-21 18:29 ` Anthony Charles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=110421084717.ZM11635@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).