char inkey(void){ int i; command_count=0; while(TRUE){ i=msdos_getch(); if(i==EOF){ eof_flag++; msg_flag=FALSE; if(!character_generated||character_saved) exit_game(); disturb(1,0); if(eof_flag>100){ panic_save=1; strcpy(died_from,"(end of input: panic saved)"); if(!save_char()){ strcpy(died_from,"panic: unexpected eof"); death=TRUE; } exit_game(); } return ESCAPE; } if(i!=CTRL('R')) return (char) i; msdos_raw(); break; } return (CTRL('R')); }
/* We need to call different procedures, dependent on the session type: VIO/window or an (XFree86) xterm */ static char os2_getch() { static int IsXterm = 0; static int init = 0; if (!init) { if (getenv("WINDOWID")) { IsXterm = 1; } init = 1; } if (IsXterm) { return ansi_getc(); } else { return msdos_getch(); } }