From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 24-JUN-1992 00:21:04.64
To:	INFO-VAX@SRI.COM
CC:	
Subj:	New and Improved Disk Display

There have been several suggested changes to the command procedure
DISK_DISPLAY. I have incorporated them and am reposting the utility.

Thanks to all for their input.

Tom

-----
Tom Ohlendorf, Programmer/Analyst  Towson State University          
HRS Advisory Committee             Administration Building, Room 128
INTERNET: D7AP002@TOA.TOWSON.EDU   Towson, MD 21204                 
VOICE: (410) 830-3642 FAX: (410) 830-3476 CSN: TSUPER01               
-----------------------------------Cut Here-------------------------------------
$!	DISK_DISPLAY.COM - GRAPHIC DISPLAY OF DISK USAGE
$ 	V = F$VERIFY(0)
$	NORM[0,32] = %X6D305B1B
$	BOLD[0,32] = %X6D315B1B
$       MYSIZE == F$GETDVI("SYS$OUTPUT","TT_PAGE")
$       _esc[0,8] = 27
$       OPEN/WRITE DISK_FILE SYS$LOGIN:DISK_LIST.TMP
$       TESTLEN = 0
$LOOP:
$       DISK = F$DEVICE(,"DISK")
$       IF DISK .EQS. "" THEN GOTO OUTPUT_IT
$	IF .NOT. F$GETDVI(DISK,"MNT") THEN GOTO LOOP
$ 	LOGVOLNAM = F$GETDVI(DISK,"LOGVOLNAM")
$ 	LOGVOLLEN = F$LEN(LOGVOLNAM)
$       IF LOGVOLLEN .GT. TESTLEN THEN TESTLEN = LOGVOLLEN
$	MEDIA_NAME = F$GETDVI(DISK,"MEDIA_NAME") 
$       MEDIA_LEN = F$LEN(MEDIA_NAME)
$	FREEBLOCKS = F$GETDVI(DISK,"FREEBLOCKS") 
$	MAXBLOCK   = F$GETDVI(DISK,"MAXBLOCK") 
$       IF MAXBLOCK .EQ. 0 
$          THEN 
$             PERCENT = 0
$          ELSE
$	      PERCENT    = (MAXBLOCK - FREEBLOCKS) * 100 / MAXBLOCK
$       ENDIF
$	IF PERCENT .GE.  0 THEN PERCENT_BAR = F$FAO("!#*|",PERCENT/2)
$	IF PERCENT .LT.  0 THEN PERCENT_BAR = BOLD + "Device Error" + NORM
$	IF PERCENT .GE. 70 THEN PERCENT_BAR = BOLD + PERCENT_BAR + NORM
$       WRITE disk_file -
              F$FAO("!23<!AS !AS !> !AS!UL%", -
              MEDIA_NAME, LOGVOLNAM, PERCENT_BAR, PERCENT)
$       GOTO LOOP
$OUTPUT_IT:
$       CLOSE                       DISK_FILE
$       POSITION == MEDIA_LEN + 2
$       SORT/KEY=(POSI:'POSITION',SIZE='TESTLEN')   SYS$LOGIN:DISK_LIST.TMP  SYS$LOGIN:DISK_LIST.TMP
$       OPEN/READ DISK_FILE SYS$LOGIN:DISK_LIST.TMP
$COUNT_LOOP:
$       COUNT = 2
$       WRITE SYS$OUTPUT "''_esc'[H''_esc'[2J''_esc'[0m''_esc[?25h"
$	WRITE SYS$OUTPUT F$FAO("!23<Disk Device!> !50*-")
$WRITE_LOOP:
$       READ/END_OF_FILE=ALL_DONE DISK_FILE RECORD
$       WRITE SYS$OUTPUT RECORD 
$       COUNT = COUNT + 1
$       IF COUNT .GT. MYSIZE THEN GOTO COUNT_LOOP
$       GOTO WRITE_LOOP
$ALL_DONE:
$       CLOSE                       DISK_FILE
$       DELETE                      SYS$LOGIN:DISK_LIST.TMP;*
-----------------------------------Cut Here-------------------------------------

