W.I.P.:
[AROS.git] / test / rawtest.c
blobbcad0a0fb4559121e7a7874bbfdc02de6ccae23f
1 #include <exec/types.h>
2 #include <proto/dos.h>
3 #include <string.h>
4 #include <stdlib.h>
6 #define MODE_CON 0
7 #define MODE_RAW 1
9 void SetConsoleMode( LONG mode );
10 TEXT GetChar( void );
11 void PutChar( TEXT buffer );
12 void PutString( STRPTR buffer );
13 void Wait4Char( void );
15 int main( void )
17 TEXT ch;
19 SetConsoleMode( MODE_RAW );
21 while( TRUE )
23 Wait4Char();
24 ch = GetChar();
25 PutString( " >" );
26 PutChar( ch );
27 PutString( "< " );
29 if( ch == 'x' )
30 break;
33 SetConsoleMode( MODE_CON );
35 return 0;
38 void SetConsoleMode( LONG mode )
40 SetMode( Input() , mode );
43 TEXT GetChar( void )
45 TEXT buffer;
47 Read( Output() , &buffer , 1 );
49 return buffer;
52 void PutChar( TEXT buffer )
54 Write( Output() , &buffer , 1 );
57 void PutString( STRPTR buffer )
59 Write( Output() , buffer , strlen( buffer ) );
62 void Wait4Char( void )
64 WaitForChar( Input() , 0 );