int __close( int hid ) { int is_closed; int rc; HANDLE h; #ifdef DEFAULT_WINDOWING LPWDATA res; #endif __handle_check( hid, -1 ); is_closed = 0; rc = 0; h = __getOSHandle( hid ); #ifdef DEFAULT_WINDOWING if( _WindowsCloseWindow != 0 ) { res = _WindowsIsWindowedHandle( hid ); if( res != NULL ) { _WindowsRemoveWindowedHandle( hid ); _WindowsCloseWindow( res ); is_closed = 1; } } #endif if( !is_closed && !CloseHandle( h ) ) { rc = __set_errno_nt(); } __freePOSIXHandle( hid ); __SetIOMode_nogrow( hid, 0 ); return( rc ); }
int __close( int handle ) { tiny_ret_t rc; #ifdef DEFAULT_WINDOWING LPWDATA res; #endif int rv; __handle_check( handle, -1 ); rv = 0; rc = TinyClose( handle ); if( TINY_OK(rc) ) { #ifdef DEFAULT_WINDOWING if( _WindowsCloseWindow != 0 ) { res = _WindowsIsWindowedHandle( handle ); if( res != NULL ) { _WindowsRemoveWindowedHandle( handle ); _WindowsCloseWindow( res ); } } #endif } else { __set_errno( EBADF ); rv = -1; } __SetIOMode_nogrow( handle, 0 ); return( rv ); }