[name, password] ← UserCredentials.GetUserCredentials[]; {
nameText: REF TEXT ~ name.ToRefText;
nameString: LONG STRING ~ LOOPHOLE[nameText];
passwordText: REF TEXT ~ password.ToRefText;
passwordString: LONG STRING ~ LOOPHOLE[passwordText];
hostText: REF TEXT ~ host.ToRefText;
hostString: LONG STRING ~ LOOPHOLE[hostText];
patternText: REF TEXT ~ pattern.ToRefText;
patternString: LONG STRING ~ LOOPHOLE[patternText];
stp: UnsafeSTP.Handle ← UnsafeSTP.Create[];
aborted: BOOLEAN ← FALSE;
herald: LONG STRING ← stp.Open[hostString];
MessageWindow.Append[ConvertUnsafe.ToRope[herald], TRUE];
Heap.systemZone.FREE[@herald]; herald ← NIL;
MessageWindow.Append[" "];
stp.Login[nameString, passwordString]; {
nMod10: NAT ← 0;
Visit:
PROCEDURE [file:
LONG
STRING]
RETURNS [continue: UnsafeSTP.Continue] ~
TRUSTED {
matchingFiles ← CONS[ConvertUnsafe.ToRope[file], matchingFiles];
IF nMod10 = 0 THEN MessageWindow.Append["."];
nMod10 ← nMod10 + 1;
IF nMod10 = 10 THEN nMod10 ← 0;
continue ← IF aborted ← abortProc[] THEN no ELSE yes;
};
stp.SetDesiredProperties[desiredProperties];
stp.Enumerate[patternString, Visit ! UnsafeSTP.Error => {errorMsg ← ConvertUnsafe.ToRope[error]; CONTINUE}];
};
stp ← stp.Destroy;
MessageWindow.Append[" Closed."];
IF aborted THEN errorMsg ← errorMsg.Concat[" (List aborted by user request)"];
matchingFiles ← Reverse[matchingFiles];
};