<> <> <> <<>> DIRECTORY Commander USING [CommandProc, Handle, Register], CommandTool USING [ArgumentVector, Failed, Parse], Convert, File, FileBackdoor, FSBackdoor, IO, Process USING [CheckForAbort], Rope; PigsInSpace: CEDAR PROGRAM IMPORTS Commander, CommandTool, Convert, File, FileBackdoor, FSBackdoor, IO, Process, Rope = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; PigsInSpaceProc: Commander.CommandProc = { <<[cmd: REF CommandObject] RETURNS [result: REF _ NIL, msg: ROPE _ NIL]>> <> <> <> <> <<>> out: STREAM _ cmd.out; count: INT _ 10; volume: File.Volume; fileCounter: INT _ 0 ; pigItem: TYPE = RECORD [ fullGName: ROPE _ NIL, size: INT _ 0 ]; pigArray: TYPE = RECORD [ items: SEQUENCE length: NAT OF pigItem ]; pigs: REF pigArray; minSize: INT _ 0; lastEntry: FSBackdoor.EntryPtr; localCount, cachedCount, attachedCount: INT _ 0; matchProc: UNSAFE PROC [entry: FSBackdoor.EntryPtr] RETURNS [accept, stop: BOOLEAN] ={ lastEntry _ entry; RETURN[TRUE, FALSE]; }; acceptProc: SAFE PROC RETURNS [stop: BOOLEAN] = TRUSTED { thisFP: File.FP _ File.nullFP; <> fileName: ROPE; fileNameLessVersion: ROPE; nameBodyRopeText: Rope.Text; stop _ FALSE; nameBodyRopeText _ FSBackdoor.TextFromTextRep[@lastEntry[lastEntry.nameBody]]; fileNameLessVersion _ IF nameBodyRopeText.InlineFetch[0] # '[ THEN Rope.Concat["[]<>", nameBodyRopeText] ELSE nameBodyRopeText; fileName _ Rope.Cat[fileNameLessVersion, "!", Convert.RopeFromCard[from: lastEntry.version, showRadix: FALSE]]; WITH e: lastEntry^ SELECT FROM local => { thisFP _ e.fp; localCount _ localCount + 1; }; cached => { thisFP _ e.fp; cachedCount _ cachedCount + 1; }; attached => { attachedCount _ attachedCount + 1; }; ENDCASE ; IF thisFP # File.nullFP THEN { -- skips attachments errorFree: BOOL _ TRUE; fileCounter _ fileCounter + 1; IF fileCounter MOD 100 = 0 THEN { IF fileCounter MOD 1000 = 0 THEN cmd.out.PutF["(%g) ", IO.int[fileCounter]] ELSE cmd.out.PutRope[". "]; }; doAFile[thisFP: thisFP, fileName: fileName]; < {>> <