diff options
Diffstat (limited to 'Source/DiVine/examples/divine-test.c')
-rwxr-xr-x | Source/DiVine/examples/divine-test.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/DiVine/examples/divine-test.c b/Source/DiVine/examples/divine-test.c new file mode 100755 index 0000000..dcad89e --- /dev/null +++ b/Source/DiVine/examples/divine-test.c @@ -0,0 +1,38 @@ +#include <unistd.h> +#include <string.h> + +#include <divine.h> + +int +main( int argc, char *argv[] ) +{ + int i; + DiVine *divine; + const char *msg = "DiVine Test!"; + int len = strlen( msg ); + + /* open the connection to the input driver */ + divine = divine_open( "/tmp/divine" ); + if (!divine) + return -1; + + /* wait a bit */ + sleep( 3 ); + + /* write a string */ + for (i=0; i<len; i++) { + /* simulate typing each character */ + divine_send_symbol( divine, msg[i] ); + + /* wait a second */ + sleep( 1 ); + } + + /* simulate a press/release of escape */ + divine_send_symbol( divine, DIKS_ESCAPE ); + + /* close the connection */ + divine_close( divine ); + + return 0; +} |