1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

zsh-workers/9799

This commit is contained in:
Tanaka Akira 2000-02-21 03:09:26 +00:00
parent 9063cd0d55
commit 245847e9e4

View file

@ -1311,6 +1311,23 @@ read1char(void)
return STOUC(c);
}
/**/
int
noquery(int purge)
{
int c, val = 0;
#ifdef FIONREAD
ioctl(SHTTY, FIONREAD, (char *)&val);
if (purge) {
while(val--)
read(SHTTY, &c, 1);
}
#endif
return val;
}
/**/
int
getquery(char *valid_chars, int purge)
@ -1318,26 +1335,17 @@ getquery(char *valid_chars, int purge)
int c, d;
int isem = !strcmp(term, "emacs");
#ifdef FIONREAD
int val = 0;
#endif
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 == ' ') {