tools/genmodule: Add 'writethunk' emitter
[AROS.git] / test / rawtest.c
blob25c04ecf75ca5415896b855c34b78d6c067a1282
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <proto/dos.h>
8 #include <string.h>
9 #include <stdlib.h>
11 #define MODE_CON 0
12 #define MODE_RAW 1
14 void SetConsoleMode( LONG mode );
15 TEXT GetChar( void );
16 void PutChar( TEXT buffer );
17 void PutString( STRPTR buffer );
18 void Wait4Char( void );
20 int main( void )
22 TEXT ch;
24 SetConsoleMode( MODE_RAW );
26 while( TRUE )
28 Wait4Char();
29 ch = GetChar();
30 PutString( " >" );
31 PutChar( ch );
32 PutString( "< " );
34 if( ch == 'x' || ch == 3 )
35 break;
38 SetConsoleMode( MODE_CON );
39 PutChar( '\n' );
41 return 0;
44 void SetConsoleMode( LONG mode )
46 SetMode( Input() , mode );
49 TEXT GetChar( void )
51 TEXT buffer;
53 Read( Output() , &buffer , 1 );
55 return buffer;
58 void PutChar( TEXT buffer )
60 Write( Output() , &buffer , 1 );
63 void PutString( STRPTR buffer )
65 Write( Output() , buffer , strlen( buffer ) );
68 void Wait4Char( void )
70 WaitForChar( Input() , 1000000000 );