{ Find all users who have a specified file } %include "Inc:Util.Imp" %include "Inc:Fs.Imp" %include "Sethost.Inc" @16_1114 %routine Signal(%integer Sig Code) %own %integer Max Name %own %string (8) %array Names (1:512) %begin %integer i %string (255) File, Outfile, Fs, F %integer Home Host, Other Host {GET NAMES} { ripped off from managr:admin } %routine Get Names !Grab the list of users ACTUALLY on this FS. %integer part %routine do part(%integer part) %string (255) s, t %integer i, j, l %bytearray buff(0:511) s = tostring(part+'0') l = fcommr('\'<<8,s,buff(0),512) %for i = 0, 8, 504 %cycle t = "" %for j = 0, 1, 7 %cycle %exit %if buff(i+j) <= ' ' t = t . tostring(buff(i+j)) %repeat %unless t = "---" %start Max Name = Max Name + 1 %signal 15, 9, 99, "Directory overflow" %if Max Name > 512 Names(Max Name) = t %finish %repeat %end Max Name = 0 %for part = 0, 1, 7 %cycle do part(part<<1); do part(part<<1+1) %repeat %end %routine Do Fs (%string (255) Fs) %string (255) Inf, Temp %label no %on %event 3 %start -> no %finish Home Host = Current Host Other Host = Connect to Host (Fs) Get Names %for i = 1, 1, Max Name %cycle Inf = Ninfo (Names(i) . ":" . File) Select Host (Home Host) Temp = Fs . " " Length (Temp) = 12 Print String (Temp) Temp = Names(i) . ":" . " " Length (Temp) = 12 Print String (Temp) Print String (Inf) Newline no: Select Host (Other Host) %repeat Disconnect Host (Other Host) Select Host (Home Host) %end {MAIN CODE OF WHO_HAS} %on %event 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 %start Disconnect Host (Other Host) Select Host (Home Host) Select Output (0) Newline Print String ("Screwed up at line: ") Write (Event_Line, 0) Newline Signal (Event_Sub << 4 + Event_Event) { Not literal indeed ! } %finish Home Host = Current Host Other Host = Home Host Fs = "B::C::" Outfile = ":" Define Param ("File", File, PAM Major!PAM No Default) Define Param ("FS", Fs, 0) Define Param ("Outfile", Outfile, PAM Newgroup) Process Parameters (CLI Param) Open Output (1, Outfile) Select Output (1) %while Fs -> F . ("::") . Fs %cycle Do Fs (F . "::") %repeat %endofprogram