SUBROUTINE SPCDEV( dev, space, ier ) C C Finds the available space remaining for device dev by: C 1) Installing VFY, C 2) Executing VFY with the /FR switch to create a list C file output LST.LST, C 3) Opens LST.LST and finds the remaining space, and C 4) Deletes LST.LST and returns. C C Dev must be at least 3 bytes long. C C Robert Hays, 11-JUL-85 C BYTE icmrem(7) ! Command line to remove VFY. C CHARACTER*19 icmlin ! Command line to pass to VFY. CHARACTER*30 icmins ! Command line to install. CHARACTER*3 dev(*) ! Device to find space on. CHARACTER*80 line ! One line of LST.LST. C INTEGER*2 vfy(3) ! Task name, RAD50. INTEGER*2 ins(3) ! Install VFY. INTEGER*2 lenlin ! Length of icmlin. INTEGER*2 lenins ! Length of icmins. INTEGER*2 lenrem ! Length of icmrem. INTEGER*2 efn ! Local event flag. INTEGER*2 iesb(8) ! Status block. INTEGER*2 ids ! Directive status. INTEGER*2 lun ! Needed for MCR spawn call. C INTEGER*4 space ! Space remaining on device. C DATA efn/1/ DATA vfy/'..','.V','FY'/ DATA icmlin/'VFY LST.LST= :/FR'/ DATA lenlin/19/ DATA ins/'..','.I','NS'/ DATA icmins/'INS $VFY/TASK=...VFY/INC=40000'/ DATA lenins/30/ DATA icmrem/'R','E','M',' ','V','F','Y'/ DATA lenrem/7/ DATA lun/1/ C C Executable begins here. C icmlin(13:15) = dev ! Load device into command line. C C Install VFY. C CALL SPAWN( RAD50(ins), , , efn, , iesb, , icmins, lenins, + , , ids ) CALL WAITFR( EFN ) ! Wait for install to finish. C C Run VFY. C CALL SPAWN( RAD50(vfy), , , efn, , iesb, , icmlin, lenlin, + , , ids ) IF( ids .LT. 0 ) THEN ier = -1 GO TO 9000 ENDIF CALL WAITFR( EFN ) ! Wait for VFY to finish. C C Remove VFY. C CALL MCRMSG( 2, -1, lun, icmrem, lenrem, ier ) C C Open LST.LST and get the remaining space. C OPEN( UNIT=lun, FILE='lst.lst', STATUS='old') 1000 CONTINUE READ( lun, 10, END = 9000, ERR = 8000) n, line(1:n) 10 FORMAT(Q,A) IF( line(3:5) .NE. dev ) THEN ! Find the record with the GO TO 1000 ! device name in it. If it ENDIF ! doesn't, go to 1000. CLOSE( UNIT=lun, DISPOSE='delete' ) C space = 0 DO 300 i=7,n ! Find the number on the line. IF( LGE(line(i:i), '0') .AND. LLE(line(i:i), '9') ) + THEN DO 250 j=i,n ! Convert the number. IF( line(j:j) .EQ. '.' ) THEN GO TO 301 ELSE space = 10 * space + + ichar(line(j:j)) - 48 ENDIF 250 CONTINUE ENDIF 300 CONTINUE 301 CONTINUE 9000 CONTINUE RETURN 8000 CONTINUE GO TO 1000 ! The read error is from n = 0. END