_WCRTLINK int __F_NAME(rmdir,_wrmdir)( const CHAR_TYPE *path ) { APIRET rc; #ifdef __WIDECHAR__ size_t rcConvert; char mbcsPath[ MB_CUR_MAX * _MAX_PATH ]; unsigned char *p; /*** Convert the wide character string to a multibyte string ***/ rcConvert = wcstombs( mbcsPath, path, sizeof( mbcsPath ) ); p = _mbsninc( (unsigned char *)mbcsPath, rcConvert ); *p = '\0'; #endif #ifdef _M_I86 rc = DosRmDir( (PSZ)__F_NAME(path,mbcsPath), 0 ); #else rc = DosDeleteDir( (PSZ)__F_NAME(path,mbcsPath) ); #endif if( rc != 0 ) { return( __set_errno_dos( rc ) ); } return( 0 ); /* indicate no error */ }
unsigned LocalRmDir( char *name ) /***************************/ { return( StashErrCode( DosRmDir( name, 0 ), OP_LOCAL ) ); }
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 }