ExamineLinks.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Willie-s, August 25, 1992 12:04 pm PDT
DIRECTORY Commander, IO, PFS, Rope;
ExamineLinks: CEDAR PROGRAM
IMPORTS Commander, IO, PFS
~ BEGIN
ExamineProc: Commander.CommandProc ~ {
star: PFS.PATH ~ PFS.PathFromRope["*"];
Recurse: PROC ~ { PFS.EnumerateForInfo[pattern: star, proc: Each] };
Each: PFS.InfoProc ~ {
IF fileType = PFS.tDirectory AND attachedTo = NIL
THEN PFS.DoInWDir[fullFName, Recurse]
ELSE {
IF bytes < 0 THEN { -- broken attachment
IO.PutF1[cmd.out, " ** %g", [rope[PFS.RopeFromPath[fullFName]]]];
IO.PutF1[cmd.out, " (-> %g)\n", [rope[PFS.RopeFromPath[attachedTo]]] ];
RETURN
};
};
};
PFS.EnumerateForInfo[pattern: star, proc: Each];
};
Commander.Register["ExamineLinks", ExamineProc, "Recuresively finds broken file links in the current vux directory - does not follow linked directories"];
END.