1 #include <exec/types.h>
2 #include <proto/exec.h>
4 #include <dos/filesystem.h>
9 int main(int argc
, char **argv
) {
13 struct IOFileSys iofs
;
14 struct FileHandle
*fh
;
21 Printf("in normal (cooked) mode\n");
22 Printf("type something: ");
25 FGets(out
, something
, 64);
26 *(strchr(something
, '\n')) = '\0';
28 Printf("you typed: %s\n", something
);
32 Printf("in raw mode\n");
33 Printf("type something: ");
40 Read(in
, &(something
[i
]), 1);
41 if (something
[i
] == 0x0d) {
45 if (! isprint(something
[i
]))
50 Printf("\nyou typed: %s\n", something
);
52 fh
= (struct FileHandle
*) in
;
54 iofs
.IOFS
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
55 iofs
.IOFS
.io_Message
.mn_ReplyPort
= &(((struct Process
*) FindTask(NULL
))->pr_MsgPort
);
56 iofs
.IOFS
.io_Message
.mn_Length
= sizeof(struct IOFileSys
);
58 iofs
.IOFS
.io_Device
= fh
->fh_Device
;
59 iofs
.IOFS
.io_Unit
= fh
->fh_Unit
;
60 iofs
.IOFS
.io_Command
= FSA_CONSOLE_MODE
;
61 iofs
.IOFS
.io_Flags
= 0;
63 iofs
.io_Union
.io_CONSOLE_MODE
.io_ConsoleMode
= FCM_NOECHO
;
67 Printf("in cooked mode with no echoing\n");
68 Printf("type something: ");
71 FGets(out
, something
, 64);
72 *(strchr(something
, '\n')) = '\0';
74 Printf("you typed: %s\n", something
);
78 Printf("restored normal (cooked) mode\n");