4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.6 2008/02/15 03:32:07 james
14 * *** empty log message ***
16 * Revision 1.5 2008/02/14 10:34:47 james
17 * *** empty log message ***
19 * Revision 1.4 2008/02/14 10:34:30 james
20 * *** empty log message ***
22 * Revision 1.3 2008/02/14 02:46:44 james
23 * *** empty log message ***
25 * Revision 1.2 2008/02/14 00:57:58 james
26 * *** empty log message ***
28 * Revision 1.1 2008/02/13 18:05:06 james
29 * *** empty log message ***
36 //vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
39 server_msg (IPC_Msg * m, Context * c)
44 case IPC_MSG_TYPE_NOOP:
46 case IPC_MSG_TYPE_DEBUG:
47 // fprintf (stderr,"%p [%d] %s\n", m, m->hdr.size , m->debug.msg );
49 case IPC_MSG_TYPE_HISTORY:
50 history_add (c->h, m->history.history.line);
52 case IPC_MSG_TYPE_VT102:
53 if (sizeof (VT102) != m->vt102.len)
56 *(c->v) = m->vt102.vt102;
58 case IPC_MSG_TYPE_TERM:
59 vt102_parse (c, m->term.term, m->term.len);
61 case IPC_MSG_TYPE_STATUS:
62 cmd_new_status (c->d, c, m->status.status);
65 fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
79 s = socket_connect ("socket");
89 c.h = history_new (200);
91 c.k = keydis_ipc_new (s);
94 terminal_register_handlers ();
95 a.terminal = terminal_open (0, 1);
97 ansi_reset (&a, NULL);
101 struct timeval tv = { 0, 100000 };
109 socket_pre_select (s, &rfds, &wfds);
110 tty_pre_select (a.terminal, &rfds, &wfds);
112 select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
114 if (socket_post_select (s, &rfds, &wfds))
119 server_msg (s->msg, &c);
120 socket_consume_msg (s);
123 if (ansi_dispatch (&a, &c))
126 ansi_update (&a, &c);
129 ansi_terminal_reset (&a);