! ----- VALID_DISK_DEVICE.FUN ----- ! ! ----- SUBROUTINE TO VERIFY FOR A VALID DISK DEVICE ----- ! ! ----- Last Change 07/02/93 by Brian Lomasky ----- ! SUB VALID_DISK_DEVICE(STRING A_PARAM) %INCLUDE "NUSER.INC" %INCLUDE "$DCDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB" %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(3%) ! EQUATE $GETDVIW RECORD DECLARE LONG DEVICE_CLASS ! DEVICE CLASS DECLARE LONG DEVICE_CLASS_LENGTH! LENGTH OF DEVICE_CLASS 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 ! ----- 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%)::BUFFER_LENGTH = 4% DVIITEM(2%)::ITEM_CODE = DVI$_DEVCLASS DVIITEM(2%)::BUFFER_ADDRESS = LOC(DEVICE_CLASS) DVIITEM(2%)::RETURN_LENGTH_ADDRESS = LOC( & DEVICE_CLASS_LENGTH) DVIITEM(3%)::LIST_TERMINATOR = 0% ! ----- GET DEVICE INFO FOR THIS DISK ----- LOCAL_STATUS = SYS$GETDVIW(, , A_PARAM, & DVIITEM() BY REF, , , , ) SELECT LOCAL_STATUS CASE SS$_NORMAL ! ----- ERROR IF HOST IS NOT AVAILABLE ----- IF HOST_AVAIL = 0% THEN PRINT PRINT "Error - Disk device host" + & " is unavailable" + BEL CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) END IF ! ----- ERROR IF DEVICE IS NOT MOUNTED ----- IF MOUNTED = 0% THEN PRINT PRINT "Error - Disk device is" + & " not mounted" + BEL CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) END IF ! ----- ERROR IF NOT A DISK DEVICE ----- IF DEVICE_CLASS <> DC$_DISK THEN PRINT "Error - Device " + A_PARAM + & " is not a disk" + BEL CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) END IF CASE SS$_NOSUCHDEV, SS$_IVDEVNAM, SS$_IVLOGNAM PRINT PRINT "Error - No such disk device" + BEL CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) CASE ELSE PRINT "Unexpected VALID_DISK $GETDVI " + & A_PARAM + " error " + NUM1$(LOCAL_STATUS) CALL SYS$EXIT(ERROR_WITH_NO_PUTMSG BY VALUE) END SELECT END SUB