_WCRTLINK int getch( void ) { int c; APIRET rc; KBDKEYINFO info; if( (c = _RWD_cbyte) != 0 ) { _RWD_cbyte = 0; return( c ); } #ifdef DEFAULT_WINDOWING if( _WindowsGetch != NULL ) { // Default windowing LPWDATA res; res = _WindowsIsWindowedHandle( (int)STDIN_FILENO ); return( _WindowsGetch( res ) ); } #endif #if defined(__OS2_286__) if( _RWD_osmode == DOS_MODE ) { return( _dos( DOS_GET_CHAR_NO_ECHO_CHECK ) ); } #endif if( (c = _RWD_cbyte2) != 0 ) { _RWD_cbyte2 = 0; return( c ); } rc = KbdCharIn( &info, 0, 0 ); if( rc == ERROR_KBD_DETACHED ) return( EOF ); if( info.chChar == 0 || info.chChar == 0xe0 ) { _RWD_cbyte2 = info.chScan; } return( info.chChar ); }
_WCRTLINK int putch( int c ) { #ifdef DEFAULT_WINDOWING if( _WindowsPutch != NULL ) { LPWDATA res; res = _WindowsIsWindowedHandle( STDOUT_FILENO ); _WindowsPutch( res, c ); } #else _dos( DOS_OUTPUT_CHAR, c ); #endif return( c ); }
_WCRTLINK int getche( void ) { int c; c = _RWD_cbyte; _RWD_cbyte = 0; if( c == 0 ) { #ifdef DEFAULT_WINDOWING if( _WindowsGetche != NULL ) { LPWDATA res; res = _WindowsIsWindowedHandle( STDOUT_FILENO ); c = _WindowsGetche( res ); } #else c = _dos( 1 ); #endif } return( c ); }