!Program scans all directories and totals up files with the Archive bit set. !System password will have to be quoted if all files are to be checked. !J. Butler Jun 86 %begin %include "inc:ssi.imp" %include "inc:fsutil.imp" %ownstring(255)s="", outfile="",eventmess="" %integer threshhold, no of dirs, i, part, arch, vuln, totarch, totvuln %string (255) File,a,b %string (7) %array dirs(0:511) %routine get dirs(%integer partition, %string (255) mask, %integername No of Dirs, %string (7) %arrayname dirs) !Get the list of directories on the specified partition %integerfn part enquiry(%integer part, bit, address, %integername size) %integer blockno %string (255) blk blockno = part<<1+bit blk = tostring((blockno&255)+'0') size = fcommr('\'<<8,blk, byteinteger(address), 532) !t!printstring("SI "); phex(size); newline %result=0 %end %routine move(%integer bytes, %bytename from, to) *Subq.l #1, d0 f loop: *move.b (a0)+, (a1)+ *dbra d0, f loop %end %recordformat DINFO FM(%string (7) name, %shortinteger partno, dirno) %routine do bit(%integer bit) %string (7) dir %integer i, len %bytearray buff(0:511) len = 512 i = part enquiry(partition, bit, addr(buff(0)), len) !t! printstring("PE"); write(i, 1); newline %if i = 0 %start !t! write(len, 3); newline !t! %for i = 0, 1, len-1 %cycle; printsymbol(buff(i)); %repeat !t! newline %for i = 0, 1, len>>3-1 %cycle move(7, buff(i<<3), charno(dir, 1)); length(dir) = 7 length(dir) = length(dir) - 1 %while dir # "" %and %c charno(dir, length(dir)) = ' ' !t! printstring(dir); newline %if dir # "---" %and (mask = "" %or matches(dir, mask)) %start dirs(no of dirs) = dir; no of dirs = no of dirs + 1 %finish %repeat %finish !t! printstring("DI"); write(no of dirs, 1); newline %end do bit(0); do bit(1) %end %routine check files(%string (15) directory, %integername arch, vuln) %string (127) Temp, s %integer Index, av, size, totblocks %on 7 %start; ->end; %finish arch=0; vuln=0; totblocks=0; index=1 %cycle temp = finfo(directory, index) av = charno(temp, 19) s = substring(temp, 40, length(temp)) s -> s.("(").temp !t! printsymbol(av); space; printstring(s); newline size = stoi(s) %if av = 'A' %start arch = arch + size %elseif av = 'V' vuln = vuln + size %finish totblocks = totblocks + size index=index+1 %repeatuntil temp="" end: {t} printstring(directory); spaces(8-length(directory)) {t} printstring("Arch:"); write(arch, 5) {t} %if vuln#0 %start {t} printstring(" Vuln:"); write(vuln, 5) {t} %finish {t} newline %end %on 3 %start; ->eod; %finish file = ""; outfile = ""; threshhold = 100 define param("DIR", file, pam major) define int param("Threshhold", threshhold, 0) define param("OUT", outfile, 0) process parameters(cli param) %if file -> a.("*").b %start no of dirs=0 %for part=0,1,7 %cycle get dirs(part, file, no of dirs, dirs) %repeat %else dirs(0) = file; no of dirs = 1 %finish eod: !Disks with <=7 partitions will drop in here on event 3,3 set terminal mode(8) open output(1, outfile) %and selectoutput(1) %if outfile # "" totarch=0; totvuln=0 %for i=0,1,no of dirs-1 %cycle !t! printline(dirs(i)."...") checkfiles(dirs(i), arch,vuln) totarch = totarch + arch; totvuln = totvuln + vuln %repeat New Line printstring("Total:"); spaces(2) printstring("Arch:"); write(totarch, 5) %if vuln#0 %start printstring(" Vuln:"); write(totvuln, 5) %finish newline %endofprogram