int getzlequery(void) { int c; #ifdef FIONREAD int val; /* check for typeahead, which is treated as a negative response */ ioctl(SHTTY, FIONREAD, (char *)&val); if (val) { putc('n', shout); return 'n'; } #endif /* get a character from the tty and interpret it */ c = getkey(0); if (c == '\t') c = 'y'; else if (icntrl(c) || c == EOF) c = 'n'; else c = tulower(c); /* echo response and return */ putc(c, shout); return c; }
void refresh() /**/ { unsigned char *s,*t,*sen,*scs = line+cs; char **qbuf; int ln = 0,nvcs,nvln = -1,t0; cost = 0; if (resetneeded) { resetvideo(); resetneeded = 0; if (isset(SINGLELINEZLE) || !termok) vcs = 0; else printf("%s",pmpt); } zleactive = 1; if (isset(SINGLELINEZLE) || !termok) { singlerefresh(); return; } /* first, we generate the video line buffers so we know what to put on the screen. s = ptr into the video buffer. t = ptr into the real buffer. sen = end of the video buffer (eol) */ s = (unsigned char *)(nbuf[ln = 0]+pptlen); t = line; sen = (unsigned char *)(*nbuf+winw); for (; *t; t++) { if (icntrl((char)*t)) if (*t == '\n') { if (t == scs) { nvcs = (char *)s-nbuf[nvln = ln]; scs = (unsigned char *)NULL; } nextline } else if ((char)*t == '\t') { int t1 = (char *)s-nbuf[ln]; if ((t1|7)+1 >= winw) nextline else do *s++ = ' '; while ((++t1) & 7); }