chiark / gitweb /
*** empty log message ***
[sympathy.git] / apps / sympathyd.c
index 820f4d9703b986d220f20773f8e8b369f649624f..2e45ed1b8d74f2c0eedbc4243608a9f0342a4693 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.5  2008/02/13 18:05:06  james
+ * *** empty log message ***
+ *
  * Revision 1.4  2008/02/13 17:21:55  james
  * *** empty log message ***
  *
  * Revision 1.4  2008/02/13 17:21:55  james
  * *** empty log message ***
  *
@@ -24,16 +27,18 @@ static char rcsid[] = "$Id$";
  *
  */
 
  *
  */
 
-#include "sympathy.h"
+#include <sympathy.h>
 
 
-#include 
-void main (int argc,char *argv[])
+#include "client.h"
+#include "clients.h"
+
+int main (int argc,char *argv[])
 {
 {
-  fd_set rfd, wfd;
+  fd_set rfds, wfds;
   ANSI a = { 0 };
   Context c;
   Socket *s, *cs;
   ANSI a = { 0 };
   Context c;
   Socket *s, *cs;
-  Client **clients;
+  Client*clients;
 
 
   s = socket_listen ("socket");
 
 
   s = socket_listen ("socket");
@@ -55,34 +60,35 @@ void main (int argc,char *argv[])
       struct timeval tv = { 0, 100000 };
 
 
       struct timeval tv = { 0, 100000 };
 
 
-      FD_ZERO (&rfd);
-      FD_ZERO (&wfd);
+      FD_ZERO (&rfds);
+      FD_ZERO (&wfds);
 
 
-      tty_pre_select (c.t, &rfd);
-      tty_pre_select (a.terminal, &rfd);
+      tty_pre_select (c.t, &rfds,&wfds);
+      tty_pre_select (a.terminal, &rfds,&wfds);
 
 
-      socket_pre_select (s, &rfd, &wfd);
+      socket_pre_select (s, &rfds, &wfds);
 
 
-      client_pre_select (clients);
+      clients_pre_select (clients,&rfds,&wfds);
 
 
-      select (FD_SETSIZE, &rfd, NULL, NULL, &tv);
+      select (FD_SETSIZE, &rfds, NULL, NULL, &tv);
 
 
-      cs = socket_post_select (s, &rfd, &wfd);
+      cs = socket_post_select (s, &rfds, &wfds);
 
       if (cs)
         {
           /*New client connexion */
 
       if (cs)
         {
           /*New client connexion */
-          clients_new (clients, cs, c);
+          clients_new_client (clients, cs, &c);
         }
 
         }
 
-      clients_post_select (clients, c, &rfds, &wfds);
 
 
-      if (FD_ISSET (c->t->rfd, &rfds))
+      clients_post_select (clients, &c, &rfds, &wfds);
+
+      if (FD_ISSET (c.t->rfd, &rfds))
         {
           char buf[1024];
           int red;
 
         {
           char buf[1024];
           int red;
 
-          red = c->t->recv (c->t, buf, sizeof (buf));
+          red = c.t->recv (c.t, buf, sizeof (buf));
 
           if (red < 0)
             break;
 
           if (red < 0)
             break;
@@ -90,7 +96,7 @@ void main (int argc,char *argv[])
           if (red)
             {
               clients_output (clients, buf, red);
           if (red)
             {
               clients_output (clients, buf, red);
-              vt102_parse (c, buf, red);
+              vt102_parse (&c, buf, red);
             }
         }
 
             }
         }