C:Avail - FLUSH should now handle systems with >2G of memory
[AROS.git] / test / consolemodes.c
blob06b892bdd25e61928259a5f4ab3dbe437c42b7dd
1 #include <exec/types.h>
2 #include <proto/exec.h>
3 #include <proto/dos.h>
4 #include <string.h>
5 #include <stdlib.h>
6 #include <ctype.h>
8 int main(int argc, char **argv) {
9 BPTR in, out;
10 TEXT something[64];
11 int i;
13 in = Input();
14 out = Output();
16 SetMode(in, 0);
18 Printf("in normal (cooked) mode\n");
19 Printf("type something: ");
20 Flush(out);
22 FGets(out, something, 64);
23 *(strchr(something, '\n')) = '\0';
25 Printf("you typed: %s\n", something);
27 SetMode(in, 1);
29 Printf("in raw mode\n");
30 Printf("type something: ");
31 Flush(out);
33 something[63] = '\0';
34 i = 0;
35 while (i < 63) {
36 WaitForChar(in, 0);
37 Read(in, &(something[i]), 1);
38 if (something[i] == 0x0d) {
39 something[i] = '\0';
40 break;
42 if (! isprint(something[i]))
43 continue;
44 i++;
47 Printf("\nyou typed: %s\n", something);
49 /* TODO: Switch to cooked mode */
51 Printf("in cooked mode with no echoing\n");
52 Printf("type something: ");
53 Flush(out);
55 FGets(out, something, 64);
56 *(strchr(something, '\n')) = '\0';
58 Printf("you typed: %s\n", something);
60 SetMode(in, 0);
62 Printf("restored normal (cooked) mode\n");
64 return 0;