void read_cmd(char *cmd) { STRINGINBUF sin; sin.cb=255; KbdStringIn(cmd, &sin, 0, 0); cmd[sin.cchIn]='\0'; VioWrtTTY("\r\n", 2, 0); }
void LocalGetBuff( char *buff, unsigned size ) /********************************************/ { struct _STRINGINBUF length; if( size > UCHAR_MAX ) { size = UCHAR_MAX; } length.cb = size; length.cchIn = 0; if( KbdStringIn( buff, &length, 0, 0 ) ) { buff[0] = '\r'; buff[1] = '\0'; return; } buff[ length.cchIn ] = '\0'; }
char * getpass (char *prompt) { static char Buf[80]; STRINGINBUF StringInBuf; printf ("%s", prompt); fflush (stdout); EchoOff (); StringInBuf.cb = sizeof (Buf) - 1; StringInBuf.cchIn = 0; KbdStringIn ((PSZ) Buf, &StringInBuf, IO_WAIT, 0); Buf[StringInBuf.cchIn] = '\0'; EchoOn (); return Buf; }
bool LocalInteractive( sys_handle fh ) /************************************/ { APIRET type; APIRET flags; //NYI: really should convert fh to sys_handle, but I know that it's // a one-to-one mapping #ifdef _M_I86 if( DosQHandType( fh, &type, &flags ) ) { #else if( DosQueryHType( fh, &type, &flags ) ) { #endif return( false ); } if( type == 1 ) { /* device type */ return( true ); } return( false ); } void LocalGetBuff( char *buff, unsigned size ) /********************************************/ { struct _STRINGINBUF length; if( size > UCHAR_MAX ) { size = UCHAR_MAX; } length.cb = size; length.cchIn = 0; if( KbdStringIn( buff, &length, 0, 0 ) ) { buff[0] = '\r'; buff[1] = NULLCHAR; return; } buff[length.cchIn] = NULLCHAR; } error_handle LocalRename( const char *from, const char *to ) /**********************************************************/ { #ifdef _M_I86 return( StashErrCode( DosMove( from, to, 0 ), OP_LOCAL ) ); #else return( StashErrCode( DosMove( from, to ), OP_LOCAL ) ); #endif } error_handle LocalMkDir( const char *name ) /*****************************************/ { #ifdef _M_I86 return( StashErrCode( DosMkDir( name, 0 ), OP_LOCAL ) ); #else return( StashErrCode( DosCreateDir( name, NULL ), OP_LOCAL ) ); #endif } error_handle LocalRmDir( const char *name ) /*****************************************/ { #ifdef _M_I86 return( StashErrCode( DosRmDir( name, 0 ), OP_LOCAL ) ); #else return( StashErrCode( DosDeleteDir( name ), OP_LOCAL ) ); #endif } error_handle LocalSetDrv( int drv ) /*********************************/ { #ifdef _M_I86 return( StashErrCode( DosSelectDisk( drv + 1 ), OP_LOCAL ) ); #else return( StashErrCode( DosSetDefaultDisk( drv + 1 ), OP_LOCAL ) ); #endif } int LocalGetDrv( void ) /*********************/ { APIRET drive; ULONG map; #ifdef _M_I86 if( DosQCurDisk( &drive, &map ) ) { #else if( DosQueryCurrentDisk( &drive, &map ) ) { #endif return( -1 ); } return( drive - 1 ); } error_handle LocalSetCWD( const char *name ) /******************************************/ { #ifdef _M_I86 return( StashErrCode( DosChDir( name, 0 ), OP_LOCAL ) ); #else return( StashErrCode( DosSetCurrentDir( name ), OP_LOCAL ) ); #endif } long LocalGetFileAttr( const char *name ) /***************************************/ { #ifdef _M_I86 USHORT attr; if( DosQFileMode( name, &attr, 0 ) ) { return( -1L ); } return( attr ); #else FILESTATUS3 fileinfo; if( DosQueryPathInfo( name, FIL_STANDARD, &fileinfo, sizeof( fileinfo ) ) ) { return( -1L ); } return( fileinfo.attrFile ); #endif }
USHORT __pascal KBDSTRINGIN(CHAR * pch, STRINGINBUF * pchIn, const USHORT fsWait, const HKBD hkbd) { return KbdStringIn(pch, pchIn, fsWait, hkbd); }