ccflush() { int bufsize = tt_obp - tt_ob; int n; int ttflush(); if (tt_ob != cc_buffer) abort(); if (cc_trace_fp != NULL) { (void) fwrite(tt_ob, 1, bufsize, cc_trace_fp); putc(-1, cc_trace_fp); } if (bufsize < tt.tt_token_min) { ttflush(); return; } tt_obp = tt_ob = cc_tt_ob; tt_obe = cc_tt_obe; tt.tt_flush = ttflush; cc_time0 = cc_time; cc_time += bufsize; n = cc_sweep_phase(cc_buffer, bufsize, cc_tokens); cc_compress_phase(cc_output, bufsize, cc_tokens, n); cc_output_phase(cc_buffer, cc_output, bufsize); ttflush(); tt_obp = tt_ob = cc_buffer; tt_obe = cc_buffer + cc_bufsize; tt.tt_flush = ccflush; }
static void tcapclose(void) { putpad(tgoto(CM, 0, term.t_nrow)); putpad(TE); ttflush(); ttclose(); }
ttcooked() { ttflush(); if (dosversion > 1) { inregs.h.ah = 0x33; /* Reset BREAK check status. */ inregs.h.al = 0x01; inregs.h.dl = breakstat; intdos(&inregs, &outregs); if (outregs.h.al == 0xff) { ewprintf("ttclose can't set break check status"); return(FALSE); } inregs.h.ah = 0x44; /* Reset IOCTRL status. */ inregs.h.al = 0x01; inregs.x.bx = 0x00; /* 0 = stdin. */ inregs.x.dx = stdinstat & 7; intdos(&inregs, &outregs); if (outregs.x.cflag != 0x00) { ewprintf("ttclose can't set IOCTRL status"); return(FALSE); } } #ifdef IBMPC /* 90.02.23 by S.Yoshida */ cancelkey(); resetcursor(); /* 91.01.05 Reset cursor by S.Yoshida */ #endif /* IBMPC */ #ifdef PC9801 /* 90.03.06 by K.Takano */ cancelkey(); if (use_metakey) resetezkey(); #endif /* PC9801 */ return(TRUE); }
/* * Erase to end of page. */ tteeop() { #ifdef TCCONIO ttflush(); clreol(); { register int line; for (line = ttrow + 1; line <= nrow; ++line) { gotoxy(1,line+1); clreol(); } ttrow = ttcol = HUGE; } #else if(CD) putpad(CD, nrow - ttrow); else { tteeol(); if (insdel) ttdell(ttrow + 1, LI, LI - ttrow - 1); else /* do it by hand */ { register int line; for (line = ttrow + 1; line <= LI; ++line) { ttmove(line, 0); tteeol(); } } ttrow = ttcol = HUGE; } #endif }
static void tcapkclose(void) { #if PKCODE putpad(TE); ttflush(); #endif }
/* * Write character to the display. Characters are buffered up, * to make things a little bit more efficient. */ int ttputc(int c) { if (nobuf >= NOBUF) ttflush(); obuf[nobuf++] = c; return (c); }
static void tcapkopen(void) { putpad(TI); ttflush(); strcpy(sres, "NORMAL"); }
/* * This function gets called just before we go back home to the command * interpreter */ bool ttclose () { ttflush(); if (tcsetattr(0, TCSADRAIN, &ostate) < 0) { ERROR("Can't restore terminal flags"); return false; } return true; }
/* * This function gets called just before we go back home to the command * interpreter */ void ttclose () { ttflush (); if (tcsetattr(0, TCSADRAIN, &ostate) < 0) { puts ("Can't restore terminal flags"); exit (1); } }
/* * Erase the echo line. */ void eerase(void) { ttcolor(CTEXT); ttmove(nrow - 1, 0); tteeol(); ttflush(); epresf = FALSE; }
/* * This function restores all terminal settings to their default values, * in anticipation of exiting or suspending the editor. */ int ttcooked(void) { ttflush(); if (tcsetattr(0, TCSASOFT | TCSADRAIN, &oldtty) < 0) { ewprintf("ttclose can't tcsetattr"); return (FALSE); } return (TRUE); }
/* * Tidy up the virtual display system * in anticipation of a return back to the host * operating system. Right now all we do is position * the cursor to the last line, erase the line, and * close the terminal channel. */ void vttidy (void) { ttcolor (CTEXT); ttnowindow (); /* No scroll window. */ ttmove (nrow - 1, 0); /* Echo line. */ tteeol (); tttidy (); ttflush (); ttclose (); }
static void tcapkopen(void) { #if PKCODE putpad(TI); ttflush(); ttrow = 999; ttcol = 999; sgarbf = TRUE; #endif xstrcpy(sres, "NORMAL"); }
void xxflush(int intr) { struct xx *xp, *xq; for (xp = xx_head; xp != 0 && !(intr && wwinterrupt()); xp = xq) { switch (xp->cmd) { case xc_move: if (xp->link == 0) (*tt.tt_move)(xp->arg0, xp->arg1); break; case xc_scroll: xxflush_scroll(xp); break; case xc_inschar: (*tt.tt_move)(xp->arg0, xp->arg1); tt.tt_nmodes = xp->arg3; (*tt.tt_inschar)(xp->arg2); break; case xc_insspace: (*tt.tt_move)(xp->arg0, xp->arg1); (*tt.tt_insspace)(xp->arg2); break; case xc_delchar: (*tt.tt_move)(xp->arg0, xp->arg1); (*tt.tt_delchar)(xp->arg2); break; case xc_clear: (*tt.tt_clear)(); break; case xc_clreos: (*tt.tt_move)(xp->arg0, xp->arg1); (*tt.tt_clreos)(); break; case xc_clreol: (*tt.tt_move)(xp->arg0, xp->arg1); (*tt.tt_clreol)(); break; case xc_write: (*tt.tt_move)(xp->arg0, xp->arg1); tt.tt_nmodes = xp->arg3; (*tt.tt_write)(xp->buf, xp->arg2); break; } xq = xp->link; xxfree(xp); } if ((xx_head = xp) == 0) { xx_tail = 0; xxbufp = xxbuf; } ttflush(); }
wwend() { wwupdate(); if (tt.tt_insert) (*tt.tt_setinsert)(0); if (tt.tt_modes) (*tt.tt_setmodes)(0); (*tt.tt_move)(tt.tt_nrow - 1, 0); (*tt.tt_end)(); ttflush(); (void) wwsettty(0, &wwoldtty, &wwnewtty); }
/* * Move the cursor to the specified * origin 0 row and column position. Try to * optimize out extra moves; redisplay may * have left the cursor in the right * location last time! */ ttmove(row, col) { if (ttrow!=row || ttcol!=col) { #ifdef TCCONIO ttflush(); gotoxy(col+1, row+1); #else putpad(tgoto(CM, col, row), 1); #endif ttrow = row; ttcol = col; } }
void ccstart(void) { ttflush(); tt_obp = tt_ob = cc_buffer; tt_obe = tt_ob + cc_bufsize; tt.tt_flush = ccflush; if (cc_trace) { cc_trace_fp = fopen("window-trace", "a"); (void) fcntl(fileno(cc_trace_fp), F_SETFD, 1); } ccreset(); }
void ccend(void) { ttflush(); tt_obp = tt_ob = cc_tt_ob; tt_obe = cc_tt_obe; tt.tt_flush = 0; if (cc_trace_fp != NULL) { (void) fclose(cc_trace_fp); cc_trace_fp = NULL; } }
/* * Erase to end of line. */ tteeol() { #ifdef TCCONIO ttflush(); clreol(); #else if(CE) putpad(CE, 1); else { register int i=ncol-ttcol; while(i--) ttputc(' '); ttrow = ttcol = HUGE; } #endif }
/* VARARGS */ void ewprintf(const char *fmt, ...) { va_list ap; if (inmacro) return; va_start(ap, fmt); ttcolor(CTEXT); ttmove(nrow - 1, 0); eformat(fmt, ap); va_end(ap); tteeol(); ttflush(); epresf = TRUE; }
Dpause() { #ifdef hpux return FALSE; #else #if BSDUNIX || LINUX extern int sgarbf; (*term.t_move)( term.t_nrow - 1, 0 ); (*term.t_eeop)(); ttflush(); ttclose(); killpg(getpgrp(0), 18); /* SIGTSTP -- stop the current program */ ttopen(); sgarbf = TRUE; window_refresh(FALSE, 1); #endif return( TRUE ); #endif }
/* * Delete nchunk line(s) from "row", replacing the * bottom line on the screen with a blank line. * Unless we're using the scrolling region, this is * done with a crafty sequences of insert and delete * lines. The presence of the echo area makes a * boundry condition go away. */ ttdell(row, bot, nchunk) { register int i, nl; if (row == bot) { /* One line special case */ ttmove(row, 0); tteeol(); return; } #ifdef TCCONIO ttflush(); window(1, row+1, ncol, bot+1); gotoxy(1, 1); while (nchunk--) delline(); window(1, 1, ncol, nrow); ttrow = HUGE; /* Unknown. */ ttcol = HUGE; #else if (CS) { /* scrolling region */ nl = bot - row; ttwindow(row, bot); ttmove(bot, 0); while (nchunk--) putpad(SF, nl); ttnowindow(); } else if(insdel) { ttmove(row, 0); /* Else use insert/delete line */ nl = nrow - ttrow; if (pDL) putpad(tgoto(pDL, 0, nchunk), nl); else for (i=0; i<nchunk; i++) /* For all lines in the chunk */ putpad(DL, nl); ttmove(1+bot-nchunk,0); nl = nrow - ttrow; /* ttmove() changes ttrow */ if (pAL) putpad(tgoto(pAL, 0, nchunk), nl); else for (i=0; i<nchunk; i++) /* For all lines in the chunk */ putpad(AL, nl); ttrow = HUGE; ttcol = HUGE; } else panic("ttdell: Can't insert/delete line"); #endif /* TCCONIO */ }
/* * This function gets called just before we go back home to the command * interpreter. On VMS it puts the terminal back in a reasonable state. * Another no-operation on CPM. */ ttclose() { #if AMIGA Close(terminal); #endif #if VMS int status; int iosb[1]; ttflush(); status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0, oldmode, sizeof(oldmode), 0, 0, 0, 0); if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL) exit(status); status = SYS$DASSGN(iochan); if (status != SS$_NORMAL) exit(status); #endif #if CPM #endif #if MSDOS && !__OS2__ int_restore(0x23); /* de-install control-break handler */ #endif #if BSDUNIX stty(1, &ostate); #if NONBLOCK fcntl(0,F_SETFL,oldstatus); #endif #endif #if linux || __OpenBSD__ || __APPLE__ tcsetattr(1, TCSADRAIN, &ostate); // return to original mode #endif #if NCURSES endwin(); #endif }
/* * Make a noise. */ void ttbeep(void) { putpad(bell, 1); ttflush(); }
/* * Do completion on a list of objects, listing instead of completing. */ static int complt_list(int flags, char *buf, int cpos) { struct list *lh, *lh2, *lh3; struct list *wholelist = NULL; struct buffer *bp; int i, maxwidth, width; int preflen = 0; int oldrow = ttrow; int oldcol = ttcol; int oldhue = tthue; char *linebuf; size_t linesize, len; char *cp; lh = NULL; ttflush(); /* The results are put into a completion buffer. */ bp = bfind("*Completions*", TRUE); if (bclear(bp) == FALSE) return (FALSE); /* * First get the list of objects. This list may contain only * the ones that complete what has been typed, or may be the * whole list of all objects of this type. They are filtered * later in any case. Set wholelist if the list has been * cons'ed up just for us, so we can free it later. We have * to copy the buffer list for this function even though we * didn't for complt. The sorting code does destructive * changes to the list, which we don't want to happen to the * main buffer list! */ if ((flags & EFBUF) != 0) wholelist = lh = copy_list(&(bheadp->b_list)); else if ((flags & EFFUNC) != 0) { buf[cpos] = '\0'; wholelist = lh = complete_function_list(buf); } else if ((flags & EFFILE) != 0) { buf[cpos] = '\0'; wholelist = lh = make_file_list(buf); /* * We don't want to display stuff up to the / for file * names preflen is the list of a prefix of what the * user typed that should not be displayed. */ cp = strrchr(buf, '/'); if (cp) preflen = cp - buf + 1; } else panic("broken complt call: flags"); /* * Sort the list, since users expect to see it in alphabetic * order. */ lh2 = lh; while (lh2 != NULL) { lh3 = lh2->l_next; while (lh3 != NULL) { if (strcmp(lh2->l_name, lh3->l_name) > 0) { cp = lh2->l_name; lh2->l_name = lh3->l_name; lh3->l_name = cp; } lh3 = lh3->l_next; } lh2 = lh2->l_next; } /* * First find max width of object to be displayed, so we can * put several on a line. */ maxwidth = 0; lh2 = lh; while (lh2 != NULL) { for (i = 0; i < cpos; ++i) { if (buf[i] != lh2->l_name[i]) break; } if (i == cpos) { width = strlen(lh2->l_name); if (width > maxwidth) maxwidth = width; } lh2 = lh2->l_next; } maxwidth += 1 - preflen; /* * Now do the display. Objects are written into linebuf until * it fills, and then put into the help buffer. */ linesize = MAX(ncol, maxwidth) + 1; if ((linebuf = malloc(linesize)) == NULL) { free_file_list(wholelist); return (FALSE); } width = 0; /* * We're going to strlcat() into the buffer, so it has to be * NUL terminated. */ linebuf[0] = '\0'; for (lh2 = lh; lh2 != NULL; lh2 = lh2->l_next) { for (i = 0; i < cpos; ++i) { if (buf[i] != lh2->l_name[i]) break; } /* if we have a match */ if (i == cpos) { /* if it wraps */ if ((width + maxwidth) > ncol) { addline(bp, linebuf); linebuf[0] = '\0'; width = 0; } len = strlcat(linebuf, lh2->l_name + preflen, linesize); width += maxwidth; if (len < width && width < linesize) { /* pad so the objects nicely line up */ memset(linebuf + len, ' ', maxwidth - strlen(lh2->l_name + preflen)); linebuf[width] = '\0'; } } } if (width > 0) addline(bp, linebuf); free(linebuf); /* * Note that we free lists only if they are put in wholelist lists * that were built just for us should be freed. However when we use * the buffer list, obviously we don't want it freed. */ free_file_list(wholelist); popbuftop(bp, WEPHEM); /* split the screen and put up the help * buffer */ update(CMODE); /* needed to make the new stuff actually * appear */ ttmove(oldrow, oldcol); /* update leaves cursor in arbitrary place */ ttcolor(oldhue); /* with arbitrary color */ ttflush(); return (0); }
/* * Do completion on a list of objects. * c is SPACE, TAB, or CR * return TRUE if matched (or partially matched) * FALSE is result is ambiguous, * ABORT on error. */ static int complt(int flags, int c, char *buf, size_t nbuf, int cpos, int *nx) { struct list *lh, *lh2; struct list *wholelist = NULL; int i, nxtra, nhits, bxtra, msglen, nshown; int wflag = FALSE; char *msg; lh = lh2 = NULL; if ((flags & EFFUNC) != 0) { buf[cpos] = '\0'; wholelist = lh = complete_function_list(buf); } else if ((flags & EFBUF) != 0) { lh = &(bheadp->b_list); } else if ((flags & EFFILE) != 0) { buf[cpos] = '\0'; wholelist = lh = make_file_list(buf); } else panic("broken complt call: flags"); if (c == ' ') wflag = TRUE; else if (c != '\t' && c != CCHR('M')) panic("broken complt call: c"); nhits = 0; nxtra = HUGE; for (; lh != NULL; lh = lh->l_next) { if (memcmp(buf, lh->l_name, cpos) != 0) continue; if (nhits == 0) lh2 = lh; ++nhits; if (lh->l_name[cpos] == '\0') nxtra = -1; /* exact match */ else { bxtra = getxtra(lh, lh2, cpos, wflag); if (bxtra < nxtra) nxtra = bxtra; lh2 = lh; } } if (nhits == 0) msg = " [No match]"; else if (nhits > 1 && nxtra == 0) msg = " [Ambiguous. Ctrl-G to cancel]"; else { /* * Being lazy - ought to check length, but all things * autocompleted have known types/lengths. */ if (nxtra < 0 && nhits > 1 && c == ' ') nxtra = 1; /* ??? */ for (i = 0; i < nxtra && cpos < nbuf; ++i) { buf[cpos] = lh2->l_name[cpos]; eputc(buf[cpos++]); } /* XXX should grow nbuf */ ttflush(); free_file_list(wholelist); *nx = nxtra; if (nxtra < 0 && c != CCHR('M')) /* exact */ *nx = 0; return (TRUE); } /* * wholelist is NULL if we are doing buffers. Want to free lists * that were created for us, but not the buffer list! */ free_file_list(wholelist); /* Set up backspaces, etc., being mindful of echo line limit. */ msglen = strlen(msg); nshown = (ttcol + msglen + 2 > ncol) ? ncol - ttcol - 2 : msglen; eputs(msg); ttcol -= (i = nshown); /* update ttcol! */ while (i--) /* move back before msg */ ttputc('\b'); ttflush(); /* display to user */ i = nshown; while (i--) /* blank out on next flush */ eputc(' '); ttcol -= (i = nshown); /* update ttcol on BS's */ while (i--) ttputc('\b'); /* update ttcol again! */ *nx = nxtra; return ((nhits > 0) ? TRUE : FALSE); }
static char * veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap) { int dynbuf = (buf == NULL); int cpos, epos; /* cursor, end position in buf */ int c, i, y; int cplflag = FALSE; /* display completion list */ int cwin = FALSE; /* completion list created */ int mr = 0; /* match left arrow */ int ml = 0; /* match right arrow */ int esc = 0; /* position in esc pattern */ struct buffer *bp; /* completion list buffer */ struct mgwin *wp; /* window for compl list */ int match; /* esc match found */ int cc, rr; /* saved ttcol, ttrow */ char *ret; /* return value */ static char emptyval[] = ""; /* XXX hackish way to return err msg*/ if (inmacro) { if (dynbuf) { if ((buf = malloc(maclcur->l_used + 1)) == NULL) return (NULL); } else if (maclcur->l_used >= nbuf) return (NULL); bcopy(maclcur->l_text, buf, maclcur->l_used); buf[maclcur->l_used] = '\0'; maclcur = maclcur->l_fp; return (buf); } epos = cpos = 0; ml = mr = esc = 0; cplflag = FALSE; if ((flag & EFNEW) != 0 || ttrow != nrow - 1) { ttcolor(CTEXT); ttmove(nrow - 1, 0); epresf = TRUE; } else eputc(' '); eformat(fp, ap); if ((flag & EFDEF) != 0) { if (buf == NULL) return (NULL); eputs(buf); epos = cpos += strlen(buf); } tteeol(); ttflush(); for (;;) { c = getkey(FALSE); if ((flag & EFAUTO) != 0 && c == CCHR('I')) { if (cplflag == TRUE) { complt_list(flag, buf, cpos); cwin = TRUE; } else if (complt(flag, c, buf, nbuf, epos, &i) == TRUE) { cplflag = TRUE; epos += i; cpos = epos; } continue; } cplflag = FALSE; if (esc > 0) { /* ESC sequence started */ match = 0; if (ml == esc && key_left[ml] && c == key_left[ml]) { match++; if (key_left[++ml] == '\0') { c = CCHR('B'); esc = 0; } } if (mr == esc && key_right[mr] && c == key_right[mr]) { match++; if (key_right[++mr] == '\0') { c = CCHR('F'); esc = 0; } } if (match == 0) { esc = 0; continue; /* hack. how do we know esc pattern is done? */ } if (esc > 0) { esc++; continue; } } switch (c) { case CCHR('A'): /* start of line */ while (cpos > 0) { if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); --ttcol; } ttputc('\b'); --ttcol; } ttflush(); break; case CCHR('D'): if (cpos != epos) { tteeol(); epos--; rr = ttrow; cc = ttcol; for (i = cpos; i < epos; i++) { buf[i] = buf[i + 1]; eputc(buf[i]); } ttmove(rr, cc); ttflush(); } break; case CCHR('E'): /* end of line */ while (cpos < epos) { eputc(buf[cpos++]); } ttflush(); break; case CCHR('B'): /* back */ if (cpos > 0) { if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); --ttcol; } ttputc('\b'); --ttcol; ttflush(); } break; case CCHR('F'): /* forw */ if (cpos < epos) { eputc(buf[cpos++]); ttflush(); } break; case CCHR('Y'): /* yank from kill buffer */ i = 0; while ((y = kremove(i++)) >= 0 && y != '\n') { int t; if (dynbuf && epos + 1 >= nbuf) { void *newp; size_t newsize = epos + epos + 16; if ((newp = realloc(buf, newsize)) == NULL) goto memfail; buf = newp; nbuf = newsize; } if (!dynbuf && epos + 1 >= nbuf) { ewprintf("Line too long"); return (emptyval); } for (t = epos; t > cpos; t--) buf[t] = buf[t - 1]; buf[cpos++] = (char)y; epos++; eputc((char)y); cc = ttcol; rr = ttrow; for (t = cpos; t < epos; t++) eputc(buf[t]); ttmove(rr, cc); } ttflush(); break; case CCHR('K'): /* copy here-EOL to kill buffer */ kdelete(); for (i = cpos; i < epos; i++) kinsert(buf[i], KFORW); tteeol(); epos = cpos; ttflush(); break; case CCHR('['): ml = mr = esc = 1; break; case CCHR('J'): c = CCHR('M'); /* FALLTHROUGH */ case CCHR('M'): /* return, done */ /* if there's nothing in the minibuffer, abort */ if (epos == 0 && !(flag & EFNUL)) { (void)ctrlg(FFRAND, 0); ttflush(); return (NULL); } if ((flag & EFFUNC) != 0) { if (complt(flag, c, buf, nbuf, epos, &i) == FALSE) continue; if (i > 0) epos += i; } buf[epos] = '\0'; if ((flag & EFCR) != 0) { ttputc(CCHR('M')); ttflush(); } if (macrodef) { struct line *lp; if ((lp = lalloc(cpos)) == NULL) goto memfail; lp->l_fp = maclcur->l_fp; maclcur->l_fp = lp; lp->l_bp = maclcur; maclcur = lp; bcopy(buf, lp->l_text, cpos); } ret = buf; goto done; case CCHR('G'): /* bell, abort */ eputc(CCHR('G')); (void)ctrlg(FFRAND, 0); ttflush(); ret = NULL; goto done; case CCHR('H'): /* rubout, erase */ case CCHR('?'): if (cpos != 0) { y = buf[--cpos]; epos--; ttputc('\b'); ttcol--; if (ISCTRL(y) != FALSE) { ttputc('\b'); ttcol--; } rr = ttrow; cc = ttcol; for (i = cpos; i < epos; i++) { buf[i] = buf[i + 1]; eputc(buf[i]); } ttputc(' '); if (ISCTRL(y) != FALSE) { ttputc(' '); ttputc('\b'); } ttputc('\b'); ttmove(rr, cc); ttflush(); } break; case CCHR('X'): /* kill line */ case CCHR('U'): while (cpos != 0) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } epos--; } ttflush(); break; case CCHR('W'): /* kill to beginning of word */ while ((cpos > 0) && !ISWORD(buf[cpos - 1])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } epos--; } while ((cpos > 0) && ISWORD(buf[cpos - 1])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } epos--; } ttflush(); break; case CCHR('\\'): case CCHR('Q'): /* quote next */ c = getkey(FALSE); /* FALLTHROUGH */ default: if (dynbuf && epos + 1 >= nbuf) { void *newp; size_t newsize = epos + epos + 16; if ((newp = realloc(buf, newsize)) == NULL) goto memfail; buf = newp; nbuf = newsize; } if (!dynbuf && epos + 1 >= nbuf) { ewprintf("Line too long"); return (emptyval); } for (i = epos; i > cpos; i--) buf[i] = buf[i - 1]; buf[cpos++] = (char)c; epos++; eputc((char)c); cc = ttcol; rr = ttrow; for (i = cpos; i < epos; i++) eputc(buf[i]); ttmove(rr, cc); ttflush(); } } done: if (cwin == TRUE) { /* blow away cpltion window */ bp = bfind("*Completions*", TRUE); if ((wp = popbuf(bp, WEPHEM)) != NULL) { if (wp->w_flag & WEPHEM) { curwp = wp; delwind(FFRAND, 1); } else { killbuffer(bp); } } } return (ret); memfail: if (dynbuf && buf) free(buf); ewprintf("Out of memory"); return (emptyval); }
int ansibeep(void) { ttputc(BEL); ttflush(); }
/* VOID */ ttbeep() { ttputc(BEL); ttflush(); }
/* * Make a noise. */ void ttbeep (void) { /* ttputc(BEL); */ ttflush (); }