aboutsummaryrefslogtreecommitdiffstats
path: root/apps/sympathyd.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/sympathyd.c')
-rw-r--r--apps/sympathyd.c86
1 files changed, 56 insertions, 30 deletions
diff --git a/apps/sympathyd.c b/apps/sympathyd.c
index 6480713..8f45ca5 100644
--- a/apps/sympathyd.c
+++ b/apps/sympathyd.c
@@ -6,10 +6,14 @@
*
*/
-static char rcsid[] = "$Id$";
+static char rcsid[] =
+ "$Id$";
/*
* $Log$
+ * Revision 1.7 2008/02/14 02:46:44 james
+ * *** empty log message ***
+ *
* Revision 1.6 2008/02/14 00:57:58 james
* *** empty log message ***
*
@@ -36,30 +40,41 @@ static char rcsid[] = "$Id$";
#include "clients.h"
-static void send_history(History *h,Client *c)
+static void
+send_history (History * h, Client * c)
{
-int rptr=h->wptr;
+ int rptr = h->wptr;
-HISTORY_INC(h,rptr);
+ HISTORY_INC (h, rptr);
-HISTORY_INC(h,rptr);
-while (rptr!=h->wptr)
-{
-History_ent *l=&h->lines[rptr];
-if (l->valid) {
+ HISTORY_INC (h, rptr);
+ while (rptr != h->wptr)
+ {
+ History_ent *l = &h->lines[rptr];
+ if (l->valid)
+ {
-if (ipc_msg_send_history(c->s,l))
- c->dead++;
+ if (ipc_msg_send_history (c->s, l))
+ c->dead++;
+ }
+ HISTORY_INC (h, rptr);
+ }
}
-HISTORY_INC(h,rptr);
-}
+
+static void
+send_vt102 (VT102 * v, Client * c)
+{
+ if (ipc_msg_send_vt102 (c->s, v))
+ c->dead++;
+
}
-int main (int argc,char *argv[])
+int
+main (int argc, char *argv[])
{
fd_set rfds, wfds;
- ANSI a = { 0 };
+// ANSI a = { 0 };
Context c;
Socket *s, *cs;
Clients *clients;
@@ -71,49 +86,56 @@ int main (int argc,char *argv[])
c.v = vt102_new ();
c.h = history_new (200);
c.l = file_log_new ("log");
+ c.k = keydis_vt102_new (&c);
+#if 0
terminal_register_handlers ();
a.terminal = terminal_open (0, 1);
ansi_reset (&a, NULL);
+#endif
- clients=clients_new();
+ clients = clients_new ();
for (;;)
{
- struct timeval tv = { 0, 100000 };
-
+ struct timeval tv = { 10, 0 };
FD_ZERO (&rfds);
FD_ZERO (&wfds);
- tty_pre_select (c.t, &rfds,&wfds);
+ tty_pre_select (c.t, &rfds, &wfds);
+#if 0
+ tty_pre_select (a.terminal, &rfds, &wfds);
+#endif
- FD_SET(s->fd,&rfds);
+ FD_SET (s->fd, &rfds);
socket_pre_select (s, &rfds, &wfds);
- clients_pre_select (clients,&rfds,&wfds);
+ clients_pre_select (clients, &rfds, &wfds);
select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
- if (FD_ISSET (s->fd, &rfds) && ((cs=socket_accept (s)))) {
+ if (FD_ISSET (s->fd, &rfds) && ((cs = socket_accept (s))))
{
- Client *cl;
- /*New client connexion */
- cl=clients_new_client (clients, cs, &c);
+ {
+ Client *cl;
+ /*New client connexion */
+ cl = clients_new_client (clients, cs, &c);
+
+ send_history (c.h, cl);
+ send_vt102 (c.v, cl);
- send_history(c.h,cl);
-
+ }
}
- }
clients_post_select (clients, &c, &rfds, &wfds);
if (FD_ISSET (c.t->rfd, &rfds))
{
- char buf[1024];
+ char buf[IPC_MAX_BUF];
int red;
red = c.t->recv (c.t, buf, sizeof (buf));
@@ -128,14 +150,18 @@ int main (int argc,char *argv[])
}
}
+#if 0
ansi_dispatch (&a, &c);
ansi_update (&a, &c);
+#endif
+
-
}
clients_shutdown (clients);
+#if 0
ansi_terminal_reset (&a);
+#endif
terminal_atexit ();
printf ("QUAT\n");
}