!Program scans all directories and lists files matching the "wild" pattern !supplied. System password will have to be quoted if all files are to be checked. !J. Butler Mar 88 %begin %include "inc:ssi.imp" %include "inc:fsutil.imp" %ownstring(255)s="", outfile="",eventmess="" %integer threshhold, no of dirs, i, part %string (255) File,a,b, param,dir,pattern %string (7) %array dirs(0:1023) %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 getline(%integername ptr, %string (255) %name s) s="" %while byteinteger(ptr) # nl %cycle s = s.tostring(byteinteger(ptr)); ptr=ptr+1 %repeat ptr=ptr+1 % %end %routine check files(%string (255) directory, pattern) %string (255) s %integer i, Index, ad, len, ptr %on 3,9 %start; %return; %finish ad = heapget(4000) connectfile(directory.":", 0, ad, len) ptr = ad %while ptr a.(":") printline(directory.":".s) %if matches(s, pattern) %repeat heapput(ad) %end param = cli param outfile = "" %unless param -> param.("/").outfile dir = "*" %and pattern=param %unless param -> dir.(":").pattern Printline("Null pattern") %and %stop %if pattern = "" %if dir -> a.("*").b %start no of dirs=0 %for part=0,1,7 %cycle get dirs(part, dir, no of dirs, dirs) %repeat %else dirs(0) = dir; no of dirs = 1 %finish open output(1, outfile) %and selectoutput(1) %if outfile # "" %for i=0,1,no of dirs-1 %cycle !t! printline(dirs(i)."...") checkfiles(dirs(i), pattern) %repeat New Line %endofprogram