actualName, plan, pictureFile: Rope.ROPE;
WHILE
TRUE
DO
-- stop when command line is exhausted and IO.EndOfStream is raised
userNamePattern: Rope.ROPE ← IO.GetTokenRope[stream, Break].token;
fingerResult: FingerOps.FingerList ← FingerOps.GetMatchingObjects[pattern: userNamePattern];
matches: CARDINAL ← 0;
FOR list: FingerOps.FingerList ← fingerResult, list.rest
WHILE list #
NIL
DO
matches ← matches + 1
ENDLOOP;
SELECT matches
FROM
0 => IO.PutRope[cmd.out, Rope.Cat["\nThere were no matches on the pattern \"", userNamePattern, "\".\n"]];
1 => IO.PutRope[cmd.out, Rope.Cat["\nThere was 1 match on the pattern \"", userNamePattern, "\":\n"]];
ENDCASE => IO.PutRope[cmd.out, Rope.Cat["\nThere were ", Convert.RopeFromCard[matches], " matches on the pattern \"", userNamePattern, "\":\n"]];
UNTIL fingerResult =
NIL
DO
nextObject: FingerOps.FingerObject = fingerResult.first;
[actualName, plan, pictureFile, data] ← FingerOps.GetProps[nextObject];
output results
IO.PutRope[cmd.out, Rope.Cat["\n\"", nextObject.name, "\""]];
IF Rope.Length[actualName] > 0 THEN IO.PutRope[cmd.out, Rope.Cat[" (", actualName, ")"]];
IO.PutRope[cmd.out, Rope.Cat[" is a ", IF nextObject.type = person THEN "Person" ELSE "Machine"]];
IF nextObject.type = person
THEN
TRUSTED {
WITH personData: data^
SELECT
FROM
person =>
{
IF personData.mailRead # BasicTime.nullGMT
THEN
IO.PutRope[cmd.out, Rope.Cat["\n\tLast read mail at ", Convert.RopeFromTime[personData.mailRead]]];
FOR mList:
LIST
OF FingerOps.MachineData ← personData.used, mList.rest
UNTIL mList =
NIL
DO
IO.PutRope[cmd.out, Rope.Cat["\n\t", IF mList.first.operation = login THEN "Logged in to " ELSE "Logged out from ", mList.first.machine, " at ", Convert.RopeFromTime[mList.first.time]]]
ENDLOOP}
ENDCASE
}
ELSE
TRUSTED {
WITH machineData: data^
SELECT
FROM
machine =>
IO.PutRope[cmd.out, Rope.Cat["\n ", machineData.lastUser, IF machineData.operation = login THEN " Logged in to " ELSE " Logged out from ", nextObject.name, " at ", Convert.RopeFromTime[machineData.time]]];
ENDCASE
};
IF Rope.Length[plan] > 0 THEN IO.PutRope[cmd.out, Rope.Cat["\n\tPlan: ", plan]];
IO.PutRope[cmd.out, "\n"];
fingerResult ← fingerResult.rest;
ENDLOOP;
IO.PutRope[cmd.out, "\n"];
EXITS FingerProblem => {
IO.PutRope[cmd.out,
SELECT fingerErrorCode FROM
Aborted => "\n... Transaction Aborted; Retry Finger Operation",
Error => "\n... Internal Finger Error; Contact Implementor",
Failure => "\n... Connection with server broken; try again later",
ENDCASE => NIL ] };