{Users - wildcard match against entries in partition registers %option "-low-nons-nocheck" %include "inc:util.imp" %include "inc:fs.imp" %begin %constinteger filestore=1976 %integer p %string(255)parm,this %recordformat string list fm(%record(string list fm)%name next,%string(255)s) %record(string list fm)%name list %predicate Matches(%string (*) %name s, p) ! S=Subject, P=Pattern. Pattern is the one with the stars in it. %integer slen = 0, plen = 0 %predicate m (%integer spos,ppos) %integer psym = 0,ssym = 0 %cycle %if ppos=plen %start %true %if spos=slen %false %finish ppos = ppos+1; psym = charno(p,ppos) %exitif psym='*' %falseif spos=slen spos = spos+1; ssym = charno(s,spos) psym = ssym %if ssym!32=psym!32 %and 'a'<=psym!32<='z' %unless ssym=psym %start %falseunless psym='%' %finish %repeat %cycle %trueif m(spos,ppos) %exitif spos=slen spos = spos+1; ssym = charno(s,spos) %repeat %false %end slen = length(s) plen = length(p) %true %if m(0,0) %false %end %record(string list fm)%map top level directory ! Return a complete list of top level directories, ! upper cased, with blank and bad entries removed. ! All entries will have a colon at the end. %record(string list fm)%name list==nil,cell %string(255)s %integer a=0,p,i,j,k,l %bytearray buff(0:511) %on 3 %start %if filestore=1986 %start heapput(a) %unless a=0 %finish %result == list %finish %if filestore=1976 %start %for p = 0,1,15 %cycle s = tostring(p+'0') k = fcommr('\'<<8,s,buff(0),512) %for i = 0, 8, 504 %cycle s = "" %for j = i,1,i+7 %cycle k = buff(j) k = k-32 %if 'a'<=k<='z' s = s.tostring(k) %unless k<=' ' %repeat %unless s="---" %or s="*BAD*" %start s = tostring(p+'0').s cell == new(cell); cell_next == list; list == cell; cell_s = s %finish %repeat %repeat %elseif filestore=1986 connectfile("LOCAL:",0,a,l); p = a %cycle s = "" %while l>0 %cycle l = l-1; k = byte(p); p = p+1 %if k<=' ' %start %continueif s=""; %exit %finish k = k-32 %if 'a'<=k<='z' s = s.tostring(k) %repeat %exitif s="" s = "0".s cell == new(cell); cell_next == list; list == cell; cell_s = s %repeat heapput(a) %finish %result == list %end parm = "%".cliparam list == top level directory %while list##nil %cycle %if matches(list_s,parm) %start p = charno(list_s,1); charno(list_s,1) = ' ' printsymbol((p-'0')>>1+'0'); printsymbol(p&1+'a') printstring(list_s); newline %finish list == list_next %repeat %end