4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.6 2008/02/14 00:57:58 james
14 * *** empty log message ***
16 * Revision 1.5 2008/02/13 18:05:06 james
17 * *** empty log message ***
19 * Revision 1.4 2008/02/13 17:21:55 james
20 * *** empty log message ***
22 * Revision 1.3 2008/02/08 15:06:52 james
23 * *** empty log message ***
25 * Revision 1.2 2008/02/07 15:42:49 james
26 * *** empty log message ***
28 * Revision 1.1 2008/02/05 14:25:49 james
29 * *** empty log message ***
39 static void send_history(History *h,Client *c)
48 History_ent *l=&h->lines[rptr];
51 if (ipc_msg_send_history(c->s,l))
59 int main (int argc,char *argv[])
68 s = socket_listen ("socket");
70 c.t = ptty_open (NULL, NULL);
72 c.h = history_new (200);
73 c.l = file_log_new ("log");
75 terminal_register_handlers ();
76 a.terminal = terminal_open (0, 1);
78 ansi_reset (&a, NULL);
80 clients=clients_new();
84 struct timeval tv = { 0, 100000 };
90 tty_pre_select (c.t, &rfds,&wfds);
94 socket_pre_select (s, &rfds, &wfds);
96 clients_pre_select (clients,&rfds,&wfds);
98 select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
100 if (FD_ISSET (s->fd, &rfds) && ((cs=socket_accept (s)))) {
103 /*New client connexion */
104 cl=clients_new_client (clients, cs, &c);
106 send_history(c.h,cl);
112 clients_post_select (clients, &c, &rfds, &wfds);
114 if (FD_ISSET (c.t->rfd, &rfds))
119 red = c.t->recv (c.t, buf, sizeof (buf));
126 clients_output (clients, buf, red);
127 vt102_parse (&c, buf, red);
131 ansi_dispatch (&a, &c);
132 ansi_update (&a, &c);
137 clients_shutdown (clients);
138 ansi_terminal_reset (&a);