diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-21 03:09:26 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-02-21 03:09:26 +0000 |
commit | 245847e9e4a772c1eca3ce695cdf841eab6e0c81 (patch) | |
tree | ecf12a13941ddd0a94a03bc90bb47d2199c058b5 | |
parent | 9063cd0d55abbb51d39fc8b1687f32e5cc29310d (diff) | |
download | zsh-245847e9e4a772c1eca3ce695cdf841eab6e0c81.tar.gz zsh-245847e9e4a772c1eca3ce695cdf841eab6e0c81.tar.xz zsh-245847e9e4a772c1eca3ce695cdf841eab6e0c81.zip |
zsh-workers/9799
-rw-r--r-- | Src/utils.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/Src/utils.c b/Src/utils.c index 292bd9249..c6b9dface 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1313,31 +1313,39 @@ read1char(void) /**/ int -getquery(char *valid_chars, int purge) +noquery(int purge) { - int c, d; - int isem = !strcmp(term, "emacs"); + int c, val = 0; #ifdef FIONREAD - int val = 0; + ioctl(SHTTY, FIONREAD, (char *)&val); + if (purge) { + while(val--) + read(SHTTY, &c, 1); + } #endif + return val; +} + +/**/ +int +getquery(char *valid_chars, int purge) +{ + int c, d; + int isem = !strcmp(term, "emacs"); + attachtty(mypgrp); if (!isem) setcbreak(); -#ifdef FIONREAD - ioctl(SHTTY, FIONREAD, (char *)&val); - if(purge) { - while(val--) - read(SHTTY, &c, 1); - } else if (val) { + if (noquery(purge)) { if (!isem) settyinfo(&shttyinfo); write(SHTTY, "n\n", 2); return 'n'; } -#endif + while ((c = read1char()) >= 0) { if (c == 'Y' || c == '\t') c = 'y'; @@ -1494,13 +1502,17 @@ spckword(char **s, int hist, int cmd, int ask) *guess = *best = ztokens[ic - Pound]; } if (ask) { - char *pptbuf; - pptbuf = promptexpand(sprompt, 0, best, guess); - zputs(pptbuf, shout); - free(pptbuf); - fflush(shout); - zbeep(); - x = getquery("nyae ", 0); + if (noquery(0)) { + x = 'n'; + } else { + char *pptbuf; + pptbuf = promptexpand(sprompt, 0, best, guess); + zputs(pptbuf, shout); + free(pptbuf); + fflush(shout); + zbeep(); + x = getquery("nyae ", 0); + } } else x = 'y'; if (x == 'y' || x == ' ') { |