VOID TDendwin() { char outbuf[TDBUFSIZE]; if (!TDisopen) { return; } #if !defined(PMFEWIN3) && !defined(NT_GENERIC) TEput('\r'); TEput('\n'); #endif TDobptr = outbuf; TDoutbuf = outbuf; TDoutcount = TDBUFSIZE; _puts(VE); _puts(TE); _echoit = TRUE; _rawmode = FALSE; _pfast = FALSE; _puts(EA); /* clean display attributes up */ if (LD) { _puts(LE); } if (KY) { _puts(KE); /* get out of keypad mode */ } /* ** Terminal exit string to allow users to ** reset terminal to whatever state they want. */ _puts(ES); IITDrstsize(); TEwrite(TDoutbuf, (i4)(TDBUFSIZE - TDoutcount)); TEflush(); TEclose(); TDisopen = FALSE; if (curscr) { /* code for STANDOUT taken out since ** STANDOUT should never be set now, ** I hope. (dkh) */ _endwin = TRUE; } }
STATUS disp_prompt(char *buffer,char *achar,char *range) { STATUS ret_val = OK ; char caracter ; char *legal = NULL ; char termBuffer [255] ; #ifdef NT_GENERIC COORD coordinate; int numchars, i; char tempchar [80]; #endif if (achar == NULL) { #ifndef NT_GENERIC STprintf(termBuffer,ERx("%s%s%s%s%s"),REG_CHAR,ATTR_OFF, PROMPT_POS,DEL_EOL,buffer); TEwrite(termBuffer,STlength(termBuffer)); TEflush(); #else SetConsoleActiveScreenBuffer(hTEconsole); coordinate.X=0; coordinate.Y=22; SetConsoleCursorPosition(hTEconsole, coordinate); WriteConsole(hTEconsole, buffer, strlen(buffer), &numchars, NULL); coordinate.X=strlen(buffer); coordinate.Y=22; SetConsoleCursorPosition(hTEconsole, coordinate); strcpy (tempchar, " "); for (i=2; i<=(80-strlen(buffer)); i++) strcat (tempchar, " "); WriteConsole(hTEconsole, tempchar, strlen(tempchar), &numchars, NULL); #endif } else { #ifndef NT_GENERIC STprintf(termBuffer,ERx("%s%s%s%s%s[ %s ]%s "),REG_CHAR,ATTR_OFF, PROMPT_POS,DEL_EOL,REV_VIDEO,buffer,ATTR_OFF); TEwrite(termBuffer,STlength(termBuffer)); TEflush(); #else SetConsoleActiveScreenBuffer(hTEconsole); coordinate.X=0; coordinate.Y=22; SetConsoleCursorPosition(hTEconsole, coordinate); SetConsoleTextAttribute(hTEconsole, FOREGROUND_BLUE|BACKGROUND_RED|BACKGROUND_GREEN|BACKGROUND_BLUE|BACKGROUND_INTENSITY); STpolycat(3, ERx("[ "), buffer, ERx(" ]"), &termBuffer); WriteConsole(hTEconsole, termBuffer, strlen(termBuffer), &numchars, NULL); coordinate.X=strlen(termBuffer); coordinate.Y=22; SetConsoleCursorPosition(hTEconsole, coordinate); strcpy (tempchar, " "); for (i=2; i<=(80-strlen(termBuffer)); i++) strcat (tempchar, " "); SetConsoleTextAttribute(hTEconsole, FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY|BACKGROUND_BLUE); WriteConsole(hTEconsole, tempchar, strlen(tempchar), &numchars, NULL); #endif TEinflush(); for (;;) { EXinterrupt(EX_OFF); #ifdef VMS sys$setast(0); #endif caracter = TEget(0); EXinterrupt(EX_ON); #ifdef VMS sys$setast(1); #endif if (range == NULL || (legal = STindex(range,&caracter,0)) != NULL) break; else { TEput(BELL); TEflush(); } } *achar = caracter; } return (ret_val); }