aboutsummaryrefslogtreecommitdiffstats
path: root/test/test.c
blob: 8cb6be13751e84f8610bc6d5260e8894e79db235 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * test.c:
 *
 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
 * All rights reserved.
 *
 */

static char rcsid[] =
  "$Id$";

/*
 * $Log$
 * Revision 1.6  2008/02/15 23:52:12  james
 * *** empty log message ***
 *
 * Revision 1.5  2008/02/14 10:34:30  james
 * *** empty log message ***
 *
 * Revision 1.7  2008/02/14 02:46:44  james
 * *** empty log message ***
 *
 * Revision 1.6  2008/02/14 00:57:58  james
 * *** empty log message ***
 *
 * Revision 1.5  2008/02/13 18:05:06  james
 * *** empty log message ***
 *
 * Revision 1.4  2008/02/13 17:21:55  james
 * *** empty log message ***
 *
 * Revision 1.3  2008/02/08 15:06:52  james
 * *** empty log message ***
 *
 * Revision 1.2  2008/02/07 15:42:49  james
 * *** empty log message ***
 *
 * Revision 1.1  2008/02/05 14:25:49  james
 * *** empty log message ***
 *
 */

#include <sympathy.h>


int
main (int argc, char *argv[])
{
  fd_set rfds, wfds;
  ANSI a = { 0 };
  Context c;


  c.t = ptty_open (NULL, NULL);
  c.v = vt102_new ();
  c.h = history_new (200);
  c.l = file_log_new ("log");
  c.k = keydis_vt102_new ();

  terminal_register_handlers ();
  a.terminal = terminal_open (0, 1);

  ansi_reset (&a, NULL);

  for (;;)
    {
      struct timeval tv = { 10, 0 };

      FD_ZERO (&rfds);
      FD_ZERO (&wfds);

      tty_pre_select (c.t, &rfds, &wfds);
      tty_pre_select (a.terminal, &rfds, &wfds);


      select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);

      if (FD_ISSET (c.t->rfd, &rfds))
        {
	  if (vt102_dispatch(&c)) break;
        }

      ansi_dispatch (&a, &c);
      ansi_update (&a, &c);


    }

  ansi_terminal_reset (&a);
  terminal_atexit ();
  printf ("QUAT\n");
}