mirror of
https://github.com/PDP-10/its.git
synced 2026-01-17 16:53:23 +00:00
101 lines
2.3 KiB
Plaintext
101 lines
2.3 KiB
Plaintext
title TMPKIL -- Kill files on .TEMP. directory
|
|
|
|
a=1
|
|
b=2
|
|
c=3
|
|
d=4
|
|
e=5
|
|
t=6
|
|
tt=7
|
|
sp=17
|
|
p==sp ;to make DATIME > happy
|
|
|
|
dski=10
|
|
|
|
.insrt SYSENG;FSDEFS >
|
|
.insrt RWK;SYSCAL >
|
|
datime"$$ABS==1 ;include routines for absoulute time
|
|
.insrt SYSENG;DATIME >
|
|
|
|
pdl: -20,,.
|
|
block 20
|
|
|
|
dir: block 2000
|
|
dirend:
|
|
|
|
go: .close 1, ;runs as demon on system startup
|
|
move sp,pdl ;initialize the PDL
|
|
|
|
skipn expire ;is this simply an old-file reap?
|
|
jrst dirget ; yes, don't bother with the time
|
|
|
|
call datime"timget ;get the time
|
|
camn a,[-1] ;is the time unknown?
|
|
.logout 1, ; yes, don't do anything!
|
|
movn b,expire ;get expiration period
|
|
call datime"timadd ;that time ago
|
|
|
|
dirget: syscal open,[cnti .uii ;read in the directory in image mode
|
|
argi dski
|
|
[sixbit /DSK/]
|
|
[sixbit /.FILE./]
|
|
[sixbit /(DIR)/]
|
|
[sixbit /.TEMP./]]
|
|
.lose %lsfil
|
|
|
|
move t,[444400,,dir] ;read in the directory
|
|
movei tt,2000 ;(all 1k of it)
|
|
syscal siot,[argi dski ? t ? tt]
|
|
.lose %lsfil
|
|
.close dski,
|
|
|
|
move d,udnamp+dir ;get relative loc of name section
|
|
addi d,dir ;make it absolute
|
|
|
|
|
|
chkfil: cail d,dirend ;is it the end?
|
|
jrst [skipn debug ;debugging?
|
|
.logout 1, ;all done, log out
|
|
.value ;must be debuging!
|
|
jrst .]
|
|
|
|
move tt,unrndm(d) ;get flag word
|
|
tlnn tt,unreap ;is it not to be reaped?
|
|
tlne tt,unigfl ; or otherwise ignored?
|
|
jrst nxtfil ; yes, skip it
|
|
|
|
;reap
|
|
skipe expire ; are we expiring old ones only?
|
|
camle a,undate(d) ; yes, is it new?
|
|
caia ; no, gobble it down
|
|
jrst nxtfil ; yes, skip it!
|
|
|
|
;; Here we have found a file which does not have it's don't-reap bit
|
|
;; on and is not to be ignored. Therefore we should delete it
|
|
|
|
syscal delete,[[sixbit /DSK/]
|
|
unfn1(d) ;FN1 from directory
|
|
unfn2(d) ;FN2 from directory
|
|
[sixbit /.TEMP./]]
|
|
jrst [skipn debug ;huh? must of gone away by itself?
|
|
jrst nxtfil ; so ignore it
|
|
.value ;debuging, so let's notice the fact
|
|
jrst nxtfil] ;but continue
|
|
|
|
nxtfil: addi d,lunblk
|
|
jrst chkfil
|
|
|
|
vrsadr: .fnam1
|
|
.fnam2
|
|
debug: 0
|
|
expire: 0 ;if nonzero, this is EXPIRE so only delete
|
|
;files older than this many seconds ago.
|
|
second==1
|
|
minute==60.*second
|
|
hour=60.*minute
|
|
day=24.*hour
|
|
week=7.*day
|
|
month=30.*day
|
|
|
|
end go
|