4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.3 2008/02/14 02:46:44 james
14 * *** empty log message ***
16 * Revision 1.2 2008/02/14 00:57:58 james
17 * *** empty log message ***
19 * Revision 1.1 2008/02/13 18:05:06 james
20 * *** empty log message ***
28 server_msg (IPC_Msg * m, Context * c)
33 case IPC_MSG_TYPE_NOOP:
35 case IPC_MSG_TYPE_DEBUG:
36 // fprintf (stderr,"%p [%d] %s\n", m, m->hdr.size , m->debug.msg );
38 case IPC_MSG_TYPE_HISTORY:
39 history_add (c->h, m->history.history.line);
41 case IPC_MSG_TYPE_VT102:
42 if (sizeof (VT102) != m->vt102.len)
45 *(c->v) = m->vt102.vt102;
47 case IPC_MSG_TYPE_TERM:
48 vt102_parse (c, m->term.term, m->term.len);
51 fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
64 s = socket_connect ("socket");
74 c.h = history_new (200);
76 c.k = keydis_ipc_new (s);
78 terminal_register_handlers ();
79 a.terminal = terminal_open (0, 1);
81 ansi_reset (&a, NULL);
85 struct timeval tv = { 0, 100000 };
90 socket_pre_select (s, &rfds, &wfds);
91 tty_pre_select (a.terminal, &rfds, &wfds);
93 select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
95 if (socket_post_select (s, &rfds, &wfds))
100 server_msg (s->msg, &c);
101 socket_consume_msg (s);
104 if (ansi_dispatch (&a, &c))
107 ansi_update (&a, &c);
110 ansi_terminal_reset (&a);