blob: 1e1a6f57bc56f26a8b25e4095fff115a2cc8595b [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// util/input.c -- generic input handling
4//
5// $Id: input.c 8349 2013-02-04 21:15:28Z Zesstra $
6
7#include <input_to.h>
8
9#pragma strong_types
10#pragma save_types
MG Mud User88f12472016-06-24 23:31:02 +020011#pragma range_check
12#pragma no_clone
13
14varargs void input(mixed prompt, mixed pargs, mixed ctrl, mixed ctrlargs)
15{
16 mixed prompttext;
17 if(closurep(prompt))
18 prompttext = apply(prompt, pointerp(pargs) ? pargs : ({}));
19 else prompttext = prompt;
20 if (!stringp(prompttext)) prompttext="";
21 input_to("done", INPUT_PROMPT, prompttext, prompt, pargs, ctrl, ctrlargs);
22}
23
24void done(string in, mixed prompt, mixed pargs, mixed ctrl, mixed ctrlargs)
25{
26 if(closurep(ctrl) &&
27 apply(ctrl, ({ in }) + (pointerp(ctrlargs) ? ctrlargs : ({}))))
28 return;
29 input(prompt, pargs, ctrl, ctrlargs);
30}