DIRECTORY Commander USING [CommandProc, Register], DefaultRemoteNames USING [Get], FS USING [Error, FileInfo, StreamOpen], IO USING [BreakProc, GetChar, GetTokenRope, PutF, PutFR, STREAM], Process USING [CheckForAbort], Rope USING [Flatten, Length, Replace, ROPE, Run, SkipOver, SkipTo]; CheckBasicLoadees: CEDAR PROGRAM IMPORTS Commander, DefaultRemoteNames, FS, IO, Process, Rope = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; CheckBasicLoadeesCommand: Commander.CommandProc = { stream: STREAM = FS.StreamOpen["Basic.Loadees"]; currentDir: ROPE _ DefaultRemoteNames.Get[].current; currentDirLen: INT = Rope.Length[currentDir]; previousDir: ROPE _ DefaultRemoteNames.Get[].previous; previousDirLen: INT = Rope.Length[previousDir]; fileCount: INT _ 0; LineBreak: IO.BreakProc = { IF char = '\n THEN RETURN [break] ELSE RETURN [other]; }; DO line: ROPE _ IO.GetTokenRope[stream, LineBreak].token; start: INT = Rope.SkipOver[line, 0, " \t"]; fileName: ROPE = Rope.Flatten[line, start, Rope.SkipTo[line, start, " \n/"]]; otherName: ROPE _ NIL; IF Rope.Length[fileName] = 0 THEN { IF fileCount = 0 THEN LOOP; EXIT; }; [] _ IO.GetChar[stream]; Process.CheckForAbort[]; {fullName: ROPE _ NIL; fullName _ FS.FileInfo[fileName ! FS.Error => IF error.group # bug THEN { IO.PutF[cmd.out, "Not checked: %g,\n %g\n", [rope[fileName]], [rope[error.explanation]]]; GO TO bailOut } ].fullFName; SELECT TRUE FROM Rope.Run[fullName, 0, previousDir, 0, FALSE] = previousDirLen => { newFile: ROPE = Rope.Replace[fileName, 0, previousDirLen, currentDir]; fullName _ FS.FileInfo[newFile ! FS.Error => IF error.group # bug THEN { IF error.code # $unknownFile THEN IO.PutF[cmd.out, "Not checked: %g,\n %g\n", [rope[fileName]], [rope[error.explanation]]]; GO TO bailOut } ].fullFName; IO.PutF[cmd.out, "More recent? %g.\n", [rope[fileName]]]; }; Rope.Run[fullName, 0, currentDir, 0, FALSE] # currentDirLen => { IO.PutF[cmd.out, "Unusual directory: %g\n", [rope[fileName]]]; GO TO bailOut }; ENDCASE => { GO TO bailOut; }; EXITS bailOut => {}; }; fileCount _ fileCount + 1; ENDLOOP; msg _ IO.PutFR["%g files checked.\n", [integer[fileCount]]]; }; Commander.Register[ "///Commands/CheckBasicLoadees", CheckBasicLoadeesCommand, "checks Basic.Loadees for being current."]; END. PCheckBasicLoadees.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson, March 12, 1985 1:07:08 pm PST [cmd: Handle] RETURNS [result: REF _ NIL, msg: ROPE _ NIL] CommandObject = [ in, out, err: STREAM, commandLine, command: ROPE, propertyList: List.AList, procData: CommandProcHandle] This entry points at the previous directory, so we have to check for a new file on the release directory. This entry doe not point at either the new directory or the old, so warn the user about it. No further checking is needed. This file checks out nicely, so go bail out Ê ˜codešœ™Kšœ Ïmœ1™Kšžœžœ˜ K˜—šžœ˜ Kšœ+™+Kšžœžœ ˜Kšœ˜—K˜—Kšžœ˜K˜—K˜Kšžœ˜—Kšœžœ4˜