summaryrefslogtreecommitdiff
path: root/Source/DiVine/examples/divine-test.c
blob: dcad89eef9cbb838f12f6976a6e62f2894253288 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
}