From 7b7996c7bb4bd66f6262f4e721b6960d6b58b801 Mon Sep 17 00:00:00 2001 From: james <> Date: Wed, 13 Feb 2008 18:05:06 +0000 Subject: *** empty log message *** --- apps/Makefile.am | 9 +++++++-- apps/client.c | 17 ++++++++++++++++ apps/client.h | 23 +++++++++++++++++++++ apps/clients.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ apps/clients.h | 43 +++++++++++++++++++++++++++++++++++++++ apps/sympathyd.c | 42 +++++++++++++++++++++----------------- 6 files changed, 175 insertions(+), 20 deletions(-) create mode 100644 apps/client.c create mode 100644 apps/client.h create mode 100644 apps/clients.c create mode 100644 apps/clients.h (limited to 'apps') diff --git a/apps/Makefile.am b/apps/Makefile.am index f2b82b4..6b4d868 100644 --- a/apps/Makefile.am +++ b/apps/Makefile.am @@ -7,6 +7,9 @@ # $Id$ # # $Log$ +# Revision 1.3 2008/02/13 18:05:06 james +# *** empty log message *** +# # Revision 1.2 2008/02/06 11:30:45 james # *** empty log message *** # @@ -20,10 +23,12 @@ INCLUDES = -I$(srcdir)/../src noinst_PROGRAMS = sympathyd sympathy -sympathy_SOURCES = sympathy.c +noinst_HEADERS=clients.h client.h + +sympathy_SOURCES = sympathy.c client.c sympathy_LDADD = ../src/libsympathy.la -lutil -sympathyd_SOURCES = sympathyd.c +sympathyd_SOURCES = sympathyd.c clients.c client.c sympathyd_LDADD = ../src/libsympathy.la -lutil AM_CFLAGS=-g diff --git a/apps/client.c b/apps/client.c new file mode 100644 index 0000000..e1b650e --- /dev/null +++ b/apps/client.c @@ -0,0 +1,17 @@ +/* + * client.c: + * + * Copyright (c) 2008 James McKenzie , + * All rights reserved. + * + */ + +static char rcsid[] = "$Id$"; + +/* + * $Log$ + * Revision 1.1 2008/02/13 18:05:06 james + * *** empty log message *** + * + */ + diff --git a/apps/client.h b/apps/client.h new file mode 100644 index 0000000..52293d1 --- /dev/null +++ b/apps/client.h @@ -0,0 +1,23 @@ +/* + * client.h: + * + * Copyright (c) 2008 James McKenzie , + * All rights reserved. + * + */ + +/* + * $Id$ + */ + +/* + * $Log$ + * Revision 1.1 2008/02/13 18:05:06 james + * *** empty log message *** + * + */ + +#ifndef __CLIENT_H__ +#define __CLIENT_H__ + +#endif /* __CLIENT_H__ */ diff --git a/apps/clients.c b/apps/clients.c new file mode 100644 index 0000000..234c0ed --- /dev/null +++ b/apps/clients.c @@ -0,0 +1,61 @@ +/* + * clients.c: + * + * Copyright (c) 2008 James McKenzie , + * All rights reserved. + * + */ + +static char rcsid[] = "$Id$"; + +/* + * $Log$ + * Revision 1.1 2008/02/13 18:05:06 james + * *** empty log message *** + * + */ + +#include +#include "clients.h" + + +void clients_output (Clients *c, void *_buf, int len) +{ + +} + +Clients *clients_new(void) +{ + + + +return NULL; +} + +void clients_pre_select (Clients *c, fd_set *rfds, fd_set *wfds) +{ + + +} + +void clients_post_select(Clients *c,Context *ctx, fd_set *rfds, fd_set *wfds) +{ + + +} + +Client * clients_new_client(Clients *c,Socket *s,Context *ctx) +{ + +ipc_msg_send_debug(s,"fishsoup"); +socket_free(s); + +return NULL; +} + +void clients_shutdown(Clients *c) +{ + + + +} diff --git a/apps/clients.h b/apps/clients.h new file mode 100644 index 0000000..78ecdc3 --- /dev/null +++ b/apps/clients.h @@ -0,0 +1,43 @@ +/* + * clients.h: + * + * Copyright (c) 2008 James McKenzie , + * All rights reserved. + * + */ + +/* + * $Id$ + */ + +/* + * $Log$ + * Revision 1.1 2008/02/13 18:05:06 james + * *** empty log message *** + * + */ + +#ifndef __CLIENTS_H__ +#define __CLIENTS_H__ + +typedef struct Client_struct { + struct Client_struct *next; + + Socket *s; + int dead; +} Client; + +typedef struct { + Client *head; + int n; +} Clients; + + +extern Clients *clients_new(void); +extern void clients_pre_select (Clients *, fd_set *, fd_set *); +extern void clients_post_select(Clients *,Context *, fd_set *, fd_set *); +extern Client *clients_new_client(Clients *,Socket *,Context *); +extern void clients_shutdown(Clients *); +extern void clients_output (Clients *, void *, int); + +#endif /* __CLIENTS_H__ */ diff --git a/apps/sympathyd.c b/apps/sympathyd.c index 820f4d9..2e45ed1 100644 --- a/apps/sympathyd.c +++ b/apps/sympathyd.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $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 *** * @@ -24,16 +27,18 @@ static char rcsid[] = "$Id$"; * */ -#include "sympathy.h" +#include -#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; - Client **clients; + Clients *clients; s = socket_listen ("socket"); @@ -55,34 +60,35 @@ void main (int argc,char *argv[]) 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 */ - 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; - red = c->t->recv (c->t, buf, sizeof (buf)); + red = c.t->recv (c.t, buf, sizeof (buf)); if (red < 0) break; @@ -90,7 +96,7 @@ void main (int argc,char *argv[]) if (red) { clients_output (clients, buf, red); - vt102_parse (c, buf, red); + vt102_parse (&c, buf, red); } } -- cgit v1.2.3