aboutsummaryrefslogtreecommitdiffstats
path: root/apps/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/client.c')
-rw-r--r--apps/client.c134
1 files changed, 0 insertions, 134 deletions
diff --git a/apps/client.c b/apps/client.c
deleted file mode 100644
index 93ade70..0000000
--- a/apps/client.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * client.c:
- *
- * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
- * All rights reserved.
- *
- */
-
-static char rcsid[] = "$Id$";
-
-/*
- * $Log$
- * Revision 1.6 2008/02/15 03:32:07 james
- * *** empty log message ***
- *
- * Revision 1.5 2008/02/14 10:34:47 james
- * *** empty log message ***
- *
- * Revision 1.4 2008/02/14 10:34:30 james
- * *** empty log message ***
- *
- * Revision 1.3 2008/02/14 02:46:44 james
- * *** empty log message ***
- *
- * Revision 1.2 2008/02/14 00:57:58 james
- * *** empty log message ***
- *
- * Revision 1.1 2008/02/13 18:05:06 james
- * *** empty log message ***
- *
- */
-
-#include <sympathy.h>
-#include "client.h"
-
- //vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
-
-static void
-server_msg (IPC_Msg * m, Context * c)
-{
- switch (m->hdr.type)
- {
-
- case IPC_MSG_TYPE_NOOP:
- break;
- case IPC_MSG_TYPE_DEBUG:
-// fprintf (stderr,"%p [%d] %s\n", m, m->hdr.size , m->debug.msg );
- break;
- case IPC_MSG_TYPE_HISTORY:
- history_add (c->h, m->history.history.line);
- break;
- case IPC_MSG_TYPE_VT102:
- if (sizeof (VT102) != m->vt102.len)
- abort ();
-
- *(c->v) = m->vt102.vt102;
- break;
- case IPC_MSG_TYPE_TERM:
- vt102_parse (c, m->term.term, m->term.len);
- break;
- case IPC_MSG_TYPE_STATUS:
- cmd_new_status (c->d, c, m->status.status);
- break;
- default:
- fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
- }
-}
-
-void
-client (void)
-{
- Socket *s;
- fd_set rfds, wfds;
-
- ANSI a = { 0 };
- Context c;
-
-
- s = socket_connect ("socket");
-
- if (!s)
- {
- printf ("no socket");
- return;
- }
-
- c.t = NULL;
- c.v = vt102_new ();
- c.h = history_new (200);
- c.l = NULL;
- c.k = keydis_ipc_new (s);
- c.d = cmd_new ();
-
- terminal_register_handlers ();
- a.terminal = terminal_open (0, 1);
-
- ansi_reset (&a, NULL);
-
- for (;;)
- {
- struct timeval tv = { 0, 100000 };
-
- if (c.d->disconnect)
- break;
-
- FD_ZERO (&rfds);
- FD_ZERO (&wfds);
-
- socket_pre_select (s, &rfds, &wfds);
- tty_pre_select (a.terminal, &rfds, &wfds);
-
- select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
-
- if (socket_post_select (s, &rfds, &wfds))
- break;
-
- while (s->msg)
- {
- server_msg (s->msg, &c);
- socket_consume_msg (s);
- }
-
- if (ansi_dispatch (&a, &c))
- break;
-
- ansi_update (&a, &c);
-
- }
- ansi_terminal_reset (&a);
- terminal_atexit ();
- printf ("QUAT\n");
-
-
-}