4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.5 2008/02/13 18:05:06 james
14 * *** empty log message ***
16 * Revision 1.4 2008/02/13 17:21:55 james
17 * *** empty log message ***
19 * Revision 1.3 2008/02/08 15:06:52 james
20 * *** empty log message ***
22 * Revision 1.2 2008/02/07 15:42:49 james
23 * *** empty log message ***
25 * Revision 1.1 2008/02/05 14:25:49 james
26 * *** empty log message ***
35 int main (int argc,char *argv[])
44 s = socket_listen ("socket");
46 c.t = ptty_open (NULL, NULL);
48 c.h = history_new (200);
49 c.l = file_log_new ("log");
51 terminal_register_handlers ();
52 a.terminal = terminal_open (0, 1);
54 ansi_reset (&a, NULL);
56 clients=clients_new();
60 struct timeval tv = { 0, 100000 };
66 tty_pre_select (c.t, &rfds,&wfds);
67 tty_pre_select (a.terminal, &rfds,&wfds);
69 socket_pre_select (s, &rfds, &wfds);
71 clients_pre_select (clients,&rfds,&wfds);
73 select (FD_SETSIZE, &rfds, NULL, NULL, &tv);
75 cs = socket_post_select (s, &rfds, &wfds);
79 /*New client connexion */
80 clients_new_client (clients, cs, &c);
84 clients_post_select (clients, &c, &rfds, &wfds);
86 if (FD_ISSET (c.t->rfd, &rfds))
91 red = c.t->recv (c.t, buf, sizeof (buf));
98 clients_output (clients, buf, red);
99 vt102_parse (&c, buf, red);
103 ansi_dispatch (&a, &c);
104 ansi_update (&a, &c);
107 clients_shutdown (clients);
108 ansi_terminal_reset (&a);