Google
 

Trailing-Edge - PDP-10 Archives - tops10and20_integ_tools_v9_3-aug-86 - 70,6067/com10a/tdismo.com
There is 1 other file named tdismo.com in the archive. Click here to see a list.
$	verify = F$VERIFY("NO")
$ ! TDISMOUNT.COM - Written: 11-Aug-82/SLP  Revised: 1-Oct-82
$ !
$ ! This procedure discovers which tape drive(s), if any, you have mounted
$ ! and/or allocated, and dismounts/deallocates them.
$ !
$ !	13-Dec-82/SLP - Dismount Floppy drives too.
$ !
$ !	Special option: If P1 is non-null, then the summary message is
$ !	suppressed.  Thus, messages are issued only if a drive is actually
$ !	dismounted or deallocated.  This is intended to allow this procedure
$ !	to be called at logout to insure no tapes are mounted.
$	!
$ 	! Each device in the following list must be EXACTLY "name_length"
$	! characters long.
$	!
$	names = "MTA0:MTA1:DYA0:DYA1:"	! Names of devices to check
$	name_length = 5			! Length of the name of each device
$	!
$	dismount_count = 0		! Number of drives dismounted
$	deallocate_count = 0		! Number of drives deallocated
$ next_drive:
$	!
$	! Any more drives?
$	!
$	IF F$LENGTH(names) .LT. name_length THEN -
$	   GOTO scan_done
$	!
$	! Yes, peel off name of device.
$	!
$	dev_name = F$EXTRACT(0, name_length, names)
$	names = F$EXTRACT(name_length, F$LENGTH(names)-name_length, names)
$	!
$	! See if assigned to this process.
$	!
$	IF F$GETJPI("","PID") .NES. F$GETDVI(dev_name,"PID") THEN -
$ 	   GOTO next_drive
$	!
$	! Get logical name, if there is one.
$	!
$	log_name = F$GETDVI(dev_name,"LOGVOLNAM")
$	vol_name = F$GETDVI(dev_name,"VOLNAM")
$	!
$	! Need to DISMOUNT first?
$	!
$	IF .NOT. F$GETDVI(dev_name,"MNT") THEN -
$	   GOTO deallocate
$	WRITE SYS$OUTPUT "%Dismounting ''dev_name' ''vol_name' ''log_name'"
$	DISMOUNT 'dev_name'
$	dismount_count = dismount_count + 1
$ deallocate:
$	! Still allocated? (Can get deallocated by DISMOUNT)
$	IF .NOT. F$GETDVI(dev_name,"ALL") THEN -
$	   GOTO next_drive
$	WRITE SYS$OUTPUT "%Deallocating ''dev_name'"
$	DEALLOCATE 'dev_name'
$	deallocate_count = deallocate_count + 1
$	GOTO next_drive
$ scan_done:
$	IF (P1 .NES. "") .AND. (dismount_count .EQ. 0) -
	.AND. (deallocate_count .EQ. 0) THEN GOTO exit
$	WRITE SYS$OUTPUT " "
$	IF (P1 .NES. "") .AND. (dismount_count .EQ. 0) THEN GOTO deal_summary
$	drives = " drives"
$	IF dismount_count .EQ. 1 THEN drives = " drive"
$	IF dismount_count .EQ. 0 THEN dismount_count = "No"
$	WRITE SYS$OUTPUT "%", dismount_count, drives, " dismounted."
$ deal_summary:
$	drives = " drives"
$	IF deallocate_count .EQ. 1 THEN drives = " drive"
$	IF deallocate_count .EQ. 0 THEN deallocate_count = "No"
$	WRITE SYS$OUTPUT "%", deallocate_count, drives, " deallocated."
$	WRITE SYS$OUTPUT " "
$ exit:
$	IF verify THEN SET VERIFY
$	EXIT