/*
* $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 ***
*
#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;
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);
ansi_dispatch (&a, &c);
ansi_update (&a, &c);
+
+
}
clients_shutdown (clients);