From ccc64e79a870d37ddff7afa92a41fd9a8dbecd42 Mon Sep 17 00:00:00 2001 From: james <> Date: Thu, 14 Feb 2008 00:57:58 +0000 Subject: *** empty log message *** --- apps/sympathyd.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'apps/sympathyd.c') diff --git a/apps/sympathyd.c b/apps/sympathyd.c index 2e45ed1..6480713 100644 --- a/apps/sympathyd.c +++ b/apps/sympathyd.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.6 2008/02/14 00:57:58 james + * *** empty log message *** + * * Revision 1.5 2008/02/13 18:05:06 james * *** empty log message *** * @@ -32,6 +35,27 @@ static char rcsid[] = "$Id$"; #include "client.h" #include "clients.h" + +static void send_history(History *h,Client *c) +{ +int rptr=h->wptr; + +HISTORY_INC(h,rptr); + +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++; + +} +HISTORY_INC(h,rptr); +} +} + int main (int argc,char *argv[]) { fd_set rfds, wfds; @@ -64,21 +88,25 @@ int main (int argc,char *argv[]) FD_ZERO (&wfds); tty_pre_select (c.t, &rfds,&wfds); - tty_pre_select (a.terminal, &rfds,&wfds); + + FD_SET(s->fd,&rfds); socket_pre_select (s, &rfds, &wfds); clients_pre_select (clients,&rfds,&wfds); - select (FD_SETSIZE, &rfds, NULL, NULL, &tv); - - cs = socket_post_select (s, &rfds, &wfds); + select (FD_SETSIZE, &rfds, &wfds, NULL, &tv); - if (cs) + if (FD_ISSET (s->fd, &rfds) && ((cs=socket_accept (s)))) { { + Client *cl; /*New client connexion */ - clients_new_client (clients, cs, &c); + cl=clients_new_client (clients, cs, &c); + + send_history(c.h,cl); + } + } clients_post_select (clients, &c, &rfds, &wfds); @@ -102,6 +130,8 @@ int main (int argc,char *argv[]) ansi_dispatch (&a, &c); ansi_update (&a, &c); + + } clients_shutdown (clients); -- cgit v1.2.3