! ----- DISK_UNAVAILABLE.FUN ----- ! ! ----- FUNCTION THAT RETURNS TRUE IF THE DISK PORTION OF ----- ! ----- THE PASSED FILESPEC DOES NOT HAVE AN AVAILABLE HOST OR IS ----- ! ----- NOT MOUNTED ----- ! ! ----- Last Change 07/02/93 by Brian Lomasky ----- ! FUNCTION WORD DISK_UNAVAILABLE(STRING PASSED_FILESPEC) %INCLUDE "NUSER.INC" %INCLUDE "$DVIDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB" ! ----- SYSTEM SERVICE ERROR CODES AND FUNCTION VALUES ----- EXTERNAL LONG CONSTANT SS$_IVDEVNAM ! INVALID DEVICE NAME EXTERNAL LONG CONSTANT SS$_IVLOGNAM ! INVALID LOGICAL NAME EXTERNAL LONG CONSTANT SS$_NOSUCHDEV ! NO SUCH DEVICE RECORD DVIBUF ! $GETDVIW RECORD VARIANT CASE WORD BUFFER_LENGTH WORD ITEM_CODE LONG BUFFER_ADDRESS LONG RETURN_LENGTH_ADDRESS CASE LONG LIST_TERMINATOR END VARIANT END RECORD DVIBUF DIM DVIBUF DVIITEM(2%) ! EQUATE $GETDVIW RECORD DECLARE LONG HOST_AVAIL ! 1 IF HOST IS AVAILABLE DECLARE LONG HOST_AVAIL_LENGTH ! LENGTH OF HOST_AVAIL DECLARE LONG LOCAL_STATUS ! SYSTEM SERVICE STATUS DECLARE LONG MOUNTED ! NON-ZERO IF DEVICE MOUNTED DECLARE LONG MOUNTED_LENGTH ! LENGTH OF MOUNTED DECLARE STRING TEMP_STRING ! TEMPORARY STRING EXTERNAL LONG FUNCTION & SYS$GETDVIW ! GET DEVICE INFORMATION/WAIT DISK_UNAVAILABLE = TRUE ! ASSUME ERROR STATUS ! ----- EXTRACT DISK SPECIFICATION (LESS :) ----- TEMP_STRING = LEFT(PASSED_FILESPEC, & POS(PASSED_FILESPEC, ":", 1%) - 1%) EXIT FUNCTION IF TEMP_STRING = "" ! ----- STORE DATA FOR $GETDVIW ----- DVIITEM(0%)::BUFFER_LENGTH = 4% DVIITEM(0%)::ITEM_CODE = DVI$_HOST_AVAIL DVIITEM(0%)::BUFFER_ADDRESS = LOC(HOST_AVAIL) DVIITEM(0%)::RETURN_LENGTH_ADDRESS = LOC(HOST_AVAIL_LENGTH) DVIITEM(1%)::BUFFER_LENGTH = 4% DVIITEM(1%)::ITEM_CODE = DVI$_MOUNTCNT DVIITEM(1%)::BUFFER_ADDRESS = LOC(MOUNTED) DVIITEM(1%)::RETURN_LENGTH_ADDRESS = LOC(MOUNTED_LENGTH) DVIITEM(2%)::LIST_TERMINATOR = 0% ! ----- GET DEVICE INFO FOR THIS DISK ----- LOCAL_STATUS = SYS$GETDVIW(, , TEMP_STRING, & DVIITEM() BY REF, , , , ) SELECT LOCAL_STATUS CASE SS$_NORMAL ! ----- EXIT IF HOST IS NOT AVAILABLE ----- EXIT FUNCTION IF HOST_AVAIL = 0% ! ----- EXIT IF DEVICE IS NOT MOUNTED ----- EXIT FUNCTION IF MOUNTED = 0% CASE SS$_NOSUCHDEV, SS$_IVDEVNAM, SS$_IVLOGNAM EXIT FUNCTION ! EXIT IF NO SUCH / INVALID DEV CASE ELSE PRINT "Unexpected DISK_UNAVAILABLE $GETDVI" + & " Error " + NUM1$(LOCAL_STATUS) + & " - Continuing..." + BEL END SELECT DISK_UNAVAILABLE = FALSE ! RETURN SUCCESS STATUS END FUNCTION