Trailing-Edge
-
PDP-10 Archives
-
decuslib10-10
-
43,50517/killit.mac
There is 1 other file named killit.mac in the archive. Click here to see a list.
TITLE KILLIT - DELETE FILES FOR COBOL
T1=1
T2=2
T3=3
T4=4
T5=5
T6=6
J=16
P=17
CHAN==17 ;HOPE THAT CHANNEL 17 ISN'T USED YET
ENTRY KILLIT
KILLIT: PUSH P,T1
PUSH P,T2
PUSH P,T3
PUSH P,T4
PUSH P,T5
PUSH P,T6
HLLZ T1,-1(J) ;GET -ARG,,0
AOBJN T1,. ;0,,ARGS
CAIG T1,1 ;1 OR LESS?
JRST TOOFEW ;TOO FEW ARGS
CAIN T1,2 ;ASSUME DSK?
JRST DEFULT ;DEFAULT
SETZ T1, ;CLEAR RESULT
PUSHJ P,GETARG ;GET THE DEVICE
MOVE T2,T1 ;INTO T2
OPENIT: MOVEI T1,17 ;BINARY DUMP
SETZ T3, ;NO BUFFERS
OPEN CHAN,T1 ;CHANNEL 0 IS FREE BY DEFINITION
JRST NODEV
SETZB T1,T2
PUSHJ P,GETARG
SETZB T3,T4
SETZ T6,
LOOKUP CHAN,T1 ;LOOKUP FILE
JRST .+2 ;FAIL
RENAME CHAN,T6 ;DELETE
SETO T6, ;FLAG LOOKUP OR RENAME FAILURE
MOVE T1,(J)
MOVE T1,(T1)
MOVEI T2,21 ;ASSUME "YES"
SKIPE T6 ;WAS I RIGHT?
MOVEI T2,20 ;OF COURSE NOT
IDPB T2,T1 ;DEPOSIT ANSWER
RELEAS CHAN, ;RELEASE THE I/O CHANNEL
POP P,T6
POP P,T5
POP P,T4
POP P,T3
POP P,T2
POP P,T1
POPJ P, ;RETURN
GETARG: MOVE T3,(J) ;GET CALL ARG
HRRZ T6,1(T3) ;GET SIZE
MOVE T3,(T3) ;GET POINTER
MOVE T4,[POINT 6,T1] ;MAKE POINTER
ILDB T5,T3 ;GET BYTE
TLNE T3,100 ;SIXBIT?
SUBI T5,40 ;NO
IDPB T5,T4 ;DEPOSIT BYTE
SOJG T6,.-4 ;LOOP
AOJ J, ;ADVANCE ARG POINTER
POPJ P,
TOOFEW: OUTSTR [ASCIZ/TOO FEW ARGUMENTS TO KILLIT
/]
EXIT
NODEV: OUTSTR [ASCIZ/KILLIT CANNOT OPEN DEVICE
/]
EXIT
DEFULT: MOVE T2,[SIXBIT/DSK/]
JRST OPENIT
END