Google
 

Trailing-Edge - PDP-10 Archives - LCG_Integration_Tools_Clearinghouse_T20_v7_30Apr86 - tools/compil2/tdir.com
There are 6 other files named tdir.com in the archive. Click here to see a list.
$ ! TDIR.COM - TDIRectory command to list files most recent to oldest
$
$ SAVE_VERIFY := 'COMMAND$DEBUG ! COMMAND$DEBUG == 1 to see more
$ SAVE_VERIFY = 'F$VERIFY( SAVE_VERIFY .AND. F$VERIFY( ) ) ! economize logs
$ COMMAND$DEBUG := 'COMMAND$DEBUG
$ GOTO START ! even in VERIFY mode, economize logging
$
$ ! This command sorts a DIRECTORY listing in sequence of date written,
$ ! from most recent backwards.  It emulates the TOPS-20 TDIRECTORY command.
$ !
$ ! To use:
$ ! 	$ @TDIRECORY filespecs
$ ! or:
$ !	$ TDIR*ECTORY :== @TDIRECTORY.COM
$ !	$ TDIR *.COM
$ !
$ ! REVISION HISTORY
$ !
$ ! 7-JAN-1983	WML	distributed on VMS INTEGRATION TOOLS tape
$ !			Walter M. Lamia
$ !
$ ! 29-Aug-1984	PFK	use PID-based temporary files
$ !			Peter F. Klammer
$ !
$ ! 2-Oct-1984	PFK	for debugging only, COMMAND$DEBUG == 1;
$ !			for full trace, COMMAND$DEBUG == 1 and SET VERIFY;
$ !			SET VERIFY alone, default for batch, is suppressed
$ !
$ ! 10-OCT-1984	PFK	made symbol names more self-documentary;
$ !			output to SYS$OUTPUT, not file, removed TYPE command
$ !
$ ! END REVISION HISTORY
$
$START:
$ ON CONTROL_Y THEN GOTO ABORT
$ ON ERROR THEN GOTO ABORT
$ SORT=""
$ READ=""
$
$ PID = ""
$ PID = F$EXTRACT( 5, 3, F$PID( PID ) )
$
$ WRITE SYS$OUTPUT " [TDIR: taking directory now...]"
$ DIRECTORY/DATE/SIZE=ALL/PROT/NOTRAIL-
/OUT=SYS$LOGIN:'PID'TDIR.TMP 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7'
$ OPEN/READ DIRFILE SYS$LOGIN:'PID'TDIR.TMP
$ OPEN/WRITE TOSORT SYS$LOGIN:'PID'TDIR.TMP
$ TIMESTAMP="ZZZZZZZZZZZZZZZZ"
$ READ DIRFILE LINE
$ WRITE TOSORT TIMESTAMP, LINE
$ READ DIRFILE LINE
$ WRITE TOSORT TIMESTAMP, LINE
$ READ DIRFILE LINE
$ WRITE TOSORT TIMESTAMP, LINE
$
$ADDKEY:
$ READ/END=DOSORT DIRFILE LINE
$ TIMESTAMP=F$EXTRACT( 0, 16, F$CVTIME( F$EXTRACT( 32, 17, LINE ) ) )
$ WRITE TOSORT TIMESTAMP, LINE
$ GOTO ADDKEY
$
$DOSORT:
$ CLOSE DIRFILE
$ CLOSE TOSORT
$ WRITE SYS$OUTPUT " [TDIR: sorting now...]"
$ SORT/KEY=(POS:1,SIZ:16,DESCEND)/STABLE SYS$LOGIN:'PID'TDIR.TMP SYS$LOGIN:'PID'TDIR.TMP
$ OPEN/READ FROMSORT SYS$LOGIN:'PID'TDIR.TMP
$
$STRIPKEYS:
$ READ/END=STRIPDONE FROMSORT LINE
$ LINE=F$EXTRACT( 16, 999, LINE )
$ WRITE SYS$OUTPUT LINE
$ GOTO STRIPKEYS
$STRIPDONE:
$
$ABORT:
$ CLOSE/ERROR=3 TOSORT
$3:
$ CLOSE/ERROR=2 DIRFILE
$2:
$ CLOSE/ERROR=1 FROMSORT
$1:
$ DELETE/NOLOG/NOCONF SYS$LOGIN:'PID'TDIR.TMP;*
$ SAVE_VERIFY := 'F$VERIFY( SAVE_VERIFY )'
$ EXIT