IOMisc:
CEDAR
DEFINITIONS =
BEGIN
AskUser provides for a standard way of interacting with the user to obtain one of a small, specified set of responses, such as Yes or No, or Yes, No, All, or Quit.
AskUser: PROC [msg: Rope.ROPE, in, out: IO.STREAM, defaultKey: ATOM ← NIL, keyList: LIST OF ATOM ← NIL, timeout: INT ← -1] RETURNS [value: ATOM];
provides a standard way of asking a user to respond/confirm to a proposed operation using either the specified exec, or viewer. keyList = NIL => LIST[$Yes, $No].
A CR matches the first atom in the KeyList, so order is important.
A rubout is like typing 'N.
The character the user types must match the first character of one of the atoms in the keylist. If so, the entire print name is echoed and AskUser returns. Otherwise, the question is repeated.
Timeout is in seconds, -1 means don't timeout.
END.
Stolen from UserExecConfirmImpl by Teitelman