home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- FUNCTION DISKTEST (drive)
- *****************************************************************
-
- * Tests a disk drive for validity (or readiness)
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- * Activate interrupt 24 handler and initialize local variables
- LOCAL old_int24 := SETINT24(.T.), ;
- ret_value := 0, temp_file := ' '
-
-
- * Make sure drive letter was passed
- IF VALTYPE(drive) != 'C'
- RETURN(-1)
- ENDIF
-
- * Get first character of passed drive and add a colon
- drive = SUBSTR(drive,1,1) + ':'
-
- * Try to create a unique file on selected drive
- temp_file = TEMPFILE('', drive)
-
- IF EMPTY(temp_file)
-
- * Attempt failed, return INT24 error code
- ret_value = GETINT24()
-
- * If GETINT24 returns zero, disk drive is invalid
- ret_value = IF(ret_value = 0, -1, ret_value)
-
- ELSE
- * Attempt succeeded, erase temporary file
- ERASE (temp_file)
- ENDIF
-
- * Reset the interrupt 24 handler to entry condition
- SETINT24(old_int24)
-
- RETURN ret_value
-
-
-
-