chiark / gitweb /
*** empty log message ***
authorjames <james>
Thu, 14 Feb 2008 02:46:44 +0000 (02:46 +0000)
committerjames <james>
Thu, 14 Feb 2008 02:46:44 +0000 (02:46 +0000)
18 files changed:
apps/Makefile.am
apps/client.c
apps/client.h
apps/clients.c
apps/clients.h
apps/sympathy.c
apps/sympathyd.c
src/Makefile.am
src/ansi.c
src/context.h
src/keydis.c [new file with mode: 0644]
src/keydis.h [new file with mode: 0644]
src/prototypes.h
src/slide.c
src/symsocket.c
src/term.c [deleted file]
src/term.h [deleted file]
src/vt102.c

index f0f5881b72ba637e328e64efb5af26b2ad2e576e..b14601cd344314e19b58cfbbbfea0cfc657918f1 100644 (file)
@@ -7,6 +7,9 @@
 # $Id$
 #
 # $Log$
+# Revision 1.5  2008/02/14 02:46:44  james
+# *** empty log message ***
+#
 # Revision 1.4  2008/02/14 00:57:58  james
 # *** empty log message ***
 #
@@ -34,6 +37,6 @@ sympathy_LDADD = ../src/libsympathy.a  -lutil
 sympathyd_SOURCES = sympathyd.c clients.c client.c
 sympathyd_LDADD = ../src/libsympathy.la  -lutil
 
-AM_CFLAGS=-g
+AM_CFLAGS=-g -Werror
 
 
index 54f4c337ba57e9183cb653837d6e11e13c8843a7..90bcf609bd2528e7000db6295082d92137b9eca6 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
@@ -21,21 +24,44 @@ static char rcsid[] = "$Id$";
 #include <sympathy.h>
 #include "client.h"
 
-static void client_msg(s)
+static void
+server_msg (IPC_Msg * m, Context * c)
 {
-          printf ("%p [%d] %s\n", s->msg, s->msg->hdr.size , s->msg->debug.msg );
-
-
+  switch (m->hdr.type)
+    {
 
+    case IPC_MSG_TYPE_NOOP:
+      break;
+    case IPC_MSG_TYPE_DEBUG:
+//          fprintf (stderr,"%p [%d] %s\n", m, m->hdr.size , m->debug.msg );
+      break;
+    case IPC_MSG_TYPE_HISTORY:
+      history_add (c->h, m->history.history.line);
+      break;
+    case IPC_MSG_TYPE_VT102:
+      if (sizeof (VT102) != m->vt102.len)
+        abort ();
+
+      *(c->v) = m->vt102.vt102;
+      break;
+    case IPC_MSG_TYPE_TERM:
+      vt102_parse (c, m->term.term, m->term.len);
+      break;
+    default:
+      fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
+    }
 }
+
 void
 client (void)
 {
   Socket *s;
   fd_set rfds, wfds;
 
-  s = socket_connect ("socket");
+  ANSI a = { 0 };
+  Context c;
 
+  s = socket_connect ("socket");
 
   if (!s)
     {
@@ -43,25 +69,47 @@ client (void)
       return;
     }
 
+  c.t = NULL;
+  c.v = vt102_new ();
+  c.h = history_new (200);
+  c.l = NULL;
+  c.k = keydis_ipc_new (s);
+
+  terminal_register_handlers ();
+  a.terminal = terminal_open (0, 1);
+
+  ansi_reset (&a, NULL);
+
   for (;;)
     {
       struct timeval tv = { 0, 100000 };
 
-
       FD_ZERO (&rfds);
       FD_ZERO (&wfds);
 
       socket_pre_select (s, &rfds, &wfds);
+      tty_pre_select (a.terminal, &rfds, &wfds);
 
       select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
 
-      socket_post_select (s, &rfds, &wfds);
+      if (socket_post_select (s, &rfds, &wfds))
+        break;
 
       while (s->msg)
         {
-         client_msg(s);
+          server_msg (s->msg, &c);
           socket_consume_msg (s);
         }
+
+      if (ansi_dispatch (&a, &c))
+        break;
+
+      ansi_update (&a, &c);
+
     }
+  ansi_terminal_reset (&a);
+  terminal_atexit ();
+  printf ("QUAT\n");
+
 
 }
index 1f4678174ac5b9e77bd433f891a2443919bbfa6b..d3b650dd39f4922b6e94ce0462a94b0e163bbe63 100644 (file)
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
@@ -23,7 +26,7 @@
 #ifndef __CLIENT_H__
 #define __CLIENT_H__
 
-void client(void);
+void client (void);
 
 
 #endif /* __CLIENT_H__ */
index 6c70e9d5452a502dbcfed300e77c7189bda426e8..b5bafcdabd42e146565beb74f61074b2245edc73 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
@@ -21,6 +24,24 @@ static char rcsid[] = "$Id$";
 #include <sympathy.h>
 #include "clients.h"
 
+static void
+client_msg (IPC_Msg * m, Context * c)
+{
+  switch (m->hdr.type)
+    {
+
+    case IPC_MSG_TYPE_NOOP:
+      break;
+    case IPC_MSG_TYPE_DEBUG:
+      fprintf (stderr, "%p [%d] %s\n", m, m->hdr.size, m->debug.msg);
+      break;
+    case IPC_MSG_TYPE_KEY:
+      vt102_send (c, m->key.key);
+      break;
+    default:
+      fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
+    }
+}
 
 void
 client_free (Client * c)
@@ -29,7 +50,7 @@ client_free (Client * c)
     socket_free (c->s);
 
   free (c);
-  fprintf(stderr,"Client at %p freed\n",c);
+  fprintf (stderr, "Client at %p freed\n", c);
 }
 
 Client *
@@ -46,11 +67,11 @@ clients_new_client (Clients * cs, Socket * s, Context * ctx)
   cs->head = c;
   cs->n++;
 
-  fprintf(stderr,"Client at %p created\n",c);
+  fprintf (stderr, "Client at %p created\n", c);
 
 
-  if (ipc_msg_send_debug (s, "new_client")) 
-       c->dead++;
+  if (ipc_msg_send_debug (s, "new_client"))
+    c->dead++;
 
   return c;
 }
@@ -69,7 +90,7 @@ clients_reap (Clients * cs)
         {
           *p = c->next;
           client_free (c);
-         cs->n--;
+          cs->n--;
         }
       else
         {
@@ -114,41 +135,46 @@ clients_post_select (Clients * cs, Context * ctx, fd_set * rfds,
           c->dead++;
           deaded++;
         }
+
+      if (c->s->msg)
+        {
+          client_msg (c->s->msg, ctx);
+          socket_consume_msg (c->s);
+        }
+
     }
 
   if (deaded)
     clients_reap (cs);
 }
 
-void
-clients_output (Clients * cs, void *_buf, int len)
+int
+clients_output (Clients * cs, void *buf, int len)
 {
-uint8_t *buf=(uint8_t *) _buf;
-Client *c;
-
-#define DEBUG_MSG_LEN 128
+  char mbuf[IPC_MAX_BUF + sizeof (IPC_Msg_term)];
+  IPC_Msg_term *m = (IPC_Msg_term *) mbuf;
 
-  char mbuf[sizeof (IPC_Msg_hdr) + DEBUG_MSG_LEN];
-  IPC_Msg *m;
-int i;
-
-if (!len) return;
-
-  m = (IPC_Msg *) mbuf;
-  m->debug.type = IPC_MSG_TYPE_DEBUG;
-  i=sprintf(m->debug.msg,"buf[0]=%d len=%d",buf[0],len);
-  m->debug.size = sizeof (IPC_Msg_hdr) + i + 1;
+  Client *c;
 
+  if (!len)
+    return;
+  if (len > IPC_MAX_BUF)
+    len = IPC_MAX_BUF;
 
+  m->size = len + sizeof (IPC_Msg_term);
+  m->type = IPC_MSG_TYPE_TERM;
+  m->len = len;
+  memcpy (m->term, buf, len);
 
   for (c = cs->head; c; c = c->next)
     {
-       if (!c->dead) 
-       if (ipc_msg_send(c->s,m)) 
-               c->dead++;
+      if (!c->dead)
+        if (ipc_msg_send (c->s, (IPC_Msg *) m))
+          c->dead++;
     }
 
 
+  return len;
 }
 
 void
index da5fd018de96f3391c14372158e049e630d7b7ff..c59a521c49fac7e689de69338e00fba5d2926b3d 100644 (file)
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
 #ifndef __CLIENTS_H__
 #define __CLIENTS_H__
 
-typedef struct Client_struct {
-       struct Client_struct *next;
-       Socket *s;
-       int dead;
+typedef struct Client_struct
+{
+  struct Client_struct *next;
+  Socket *s;
+  int dead;
 } Client;
 
-typedef struct {
-       Client *head;
-       int n;
+typedef struct
+{
+  Client *head;
+  int n;
 } Clients;
 
 
-extern Clients *clients_new(void);
+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);
+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 int clients_output (Clients *, void *, int);
 
 #endif /* __CLIENTS_H__ */
index a9140f889bf22e1a1a71f80d70abf81474d70e2e..e11df1e61db521b3585860ddf23e81de66c3ef13 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
@@ -21,8 +24,9 @@ static char rcsid[] = "$Id$";
 #include <sympathy.h>
 #include "client.h"
 
-int main(int argc,char *argv[])
+int
+main (int argc, char *argv[])
 {
 
-client();
+  client ();
 }
index 6480713e0dde94ae52868c601e458576eb2bd4bf..8f45ca58ba557969499ae34fc9a24abbbcf6f76c 100644 (file)
@@ -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");
 }
index f648e7a09c78f421afcdbb8ca8f66f3fe96fbca1..92a0e88a76ebccb891428a7aefdcf3c60217b118 100644 (file)
@@ -8,6 +8,9 @@
 # $Id$
 #
 # $Log$
+# Revision 1.12  2008/02/14 02:46:44  james
+# *** empty log message ***
+#
 # Revision 1.11  2008/02/14 01:55:57  james
 # *** empty log message ***
 #
 
 INCLUDES=
 
-PROJECTHDRS= crt.h tty.h ansi.h vt102.h keys.h history.h ring.h slide.h log.h ipc.h symsocket.h term.h context.h  prototypes.h
+PROJECTHDRS= crt.h tty.h ansi.h vt102.h keys.h history.h ring.h slide.h log.h ipc.h symsocket.h keydis.h context.h  prototypes.h
 
 HDRS=project.h 
 
-SRCS=ansi.c crt.c html.c libsympathy.c render.c  version.c vt102.c tty.c term.c \
+SRCS=ansi.c crt.c html.c libsympathy.c render.c  version.c vt102.c tty.c keydis.c \
        history.c ring.c ptty.c terminal.c util.c log.c ipc.c slide.c symsocket.c
 
 CPROTO=cproto
index 7ec9abd160dd9e83cda8ef3fce2003567baadbe6..6253f953ab8c5e1ca8cefda5ea0a309928e5e3d7 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.21  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.20  2008/02/14 01:55:57  james
  * *** empty log message ***
  *
@@ -624,7 +627,7 @@ ansi_flush_escape (ANSI * a, Context * c)
 
   for (i = 0; i < p->escape_ptr; ++i)
     {
-      term_send (c, p->escape_buf[i]);
+      c->k->key (c->k, p->escape_buf[i]);
     }
 
   p->escape_ptr = 0;
@@ -643,11 +646,11 @@ ansi_parse_deckey (ANSI * a, Context * c)
 
   if ((p->escape_buf[2] >= 'A') || (p->escape_buf[2] <= 'Z'))
     {
-      term_send (c, KEY_UP + (p->escape_buf[2] - 'A'));
+      c->k->key (c->k, KEY_UP + (p->escape_buf[2] - 'A'));
     }
   else if ((p->escape_buf[2] >= 'a') || (p->escape_buf[2] <= 'z'))
     {
-      term_send (c, KEY_154 + (p->escape_buf[2] - 'a'));
+      c->k->key (c->k, KEY_154 + (p->escape_buf[2] - 'a'));
     }
   else
     {
@@ -670,7 +673,7 @@ ansi_parse_ansikey (ANSI * a, Context * c)
     }
   if ((p->escape_buf[2] >= '0') || (p->escape_buf[2] <= '9'))
     {
-      term_send (c, KEY_180 + (p->escape_buf[2] - '0'));
+      c->k->key (c->k, KEY_180 + (p->escape_buf[2] - '0'));
     }
   else
     {
@@ -783,7 +786,7 @@ ansi_parse_char (ANSI * a, Context * c, int ch)
     }
   else
     {
-      term_send (c, ch);
+      c->k->key (c->k, ch);
     }
 
 }
@@ -817,16 +820,13 @@ ansi_dispatch (ANSI * a, Context * c)
 #endif
 
 #if 1
-  if (*buf == 1)
-    {
-      ansi_reset (a, NULL);
-      return 0;
-    }
   if (*buf == 2)
     {
+#if  0
       a->history_ptr = c->h->wptr;
       HISTORY_INC (c->h, a->history_ptr);
-      return 0;
+#endif
+      return -1;
     }
 #endif
 
index a0edf33f42e7d19963e222fe8717084fcfc81196..e746ad1cea8fd63b896c651f3148b0b4397c3402 100644 (file)
@@ -12,6 +12,9 @@
 
 /*
  * $Log$
+ * Revision 1.5  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.4  2008/02/14 01:55:57  james
  * *** empty log message ***
  *
@@ -35,7 +38,7 @@ typedef struct
   TTY *t;
   History *h;
   Log *l;
-  Term *r;
+  KeyDis *k;
 } Context;
 
 #endif /* __CONTEXT_H__ */
diff --git a/src/keydis.c b/src/keydis.c
new file mode 100644 (file)
index 0000000..e921f79
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * keydis.c:
+ *
+ * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
+ * All rights reserved.
+ *
+ */
+
+static char rcsid[] = "$Id$";
+
+/*
+ * $Log$
+ * Revision 1.1  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
+ * Revision 1.1  2008/02/14 01:55:57  james
+ * *** empty log message ***
+ *
+ */
+
+
+#include "project.h"
+
+typedef struct
+{
+  KEYDIS_SIGNATURE;
+  Context *c;
+} KeyDis_VT102;
+
+typedef struct
+{
+  KEYDIS_SIGNATURE;
+  Socket *s;
+} KeyDis_IPC;
+
+
+static void
+keydis_close (KeyDis * t)
+{
+  free (t);
+}
+
+
+static int
+keydis_ipc_key (KeyDis * _t, int key)
+{
+  KeyDis_IPC *t = (KeyDis_IPC *) _t;
+
+  return ipc_msg_send_key (t->s, key);
+}
+
+static int
+keydis_vt102_key (KeyDis * _t, int key)
+{
+  KeyDis_VT102 *t = (KeyDis_VT102 *) _t;
+
+  vt102_send (t->c, key);
+  return 0;
+}
+
+
+KeyDis *
+keydis_vt102_new (Context * c)
+{
+  KeyDis_VT102 *t = malloc (sizeof (KeyDis_VT102));
+  t->key = keydis_vt102_key;
+  t->close = keydis_close;
+  t->c = c;
+  return (KeyDis *) t;
+}
+
+
+KeyDis *
+keydis_ipc_new (Socket * s)
+{
+  KeyDis_IPC *t = malloc (sizeof (KeyDis_IPC));
+  t->key = keydis_ipc_key;
+  t->close = keydis_close;
+  t->s = s;
+  return (KeyDis *) t;
+}
diff --git a/src/keydis.h b/src/keydis.h
new file mode 100644 (file)
index 0000000..d0ca69a
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * keydis.h:
+ *
+ * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
+ * All rights reserved.
+ *
+ */
+
+/*
+ * $Id$
+ */
+
+/*
+ * $Log$
+ * Revision 1.1  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
+ * Revision 1.1  2008/02/14 01:55:57  james
+ * *** empty log message ***
+ *
+ */
+
+#ifndef __KEYDIS_H__
+#define __KEYDIS_H__
+
+
+#define KEYDIS_SIGNATURE \
+       void (*close)(struct KeyDis_struct *); \
+       int (*key)(struct KeyDis_struct *,int key)
+
+typedef struct KeyDis_struct
+{
+  KEYDIS_SIGNATURE;
+} KeyDis;
+
+
+#endif /* __KEYDIS_H__ */
index dc88c14dd0f077a01abdf0eb8f30915e1a499f44..28cffacb1e6c6394b9b96e0baea680ba8d1f0386 100644 (file)
@@ -73,6 +73,9 @@ extern VT102 *vt102_new(void);
 extern void vt102_free(VT102 *v);
 /* tty.c */
 extern void tty_pre_select(TTY *t, fd_set *rfds, fd_set *wfds);
+/* keydis.c */
+extern KeyDis *keydis_vt102_new(Context *c);
+extern KeyDis *keydis_ipc_new(Socket *s);
 /* history.c */
 extern History *history_new(int n);
 extern void history_free(History *h);
@@ -107,6 +110,9 @@ extern void ipc_consume_message_in_slide(Slide *s);
 extern int ipc_msg_send(Socket *s, IPC_Msg *m);
 extern int ipc_msg_send_debug(Socket *s, char *msg);
 extern int ipc_msg_send_history(Socket *s, History_ent *l);
+extern int ipc_msg_send_vt102(Socket *s, VT102 *v);
+extern int ipc_msg_send_key(Socket *s, int key);
+extern int ipc_msg_send_term(Socket *s, void *buf, int len);
 /* slide.c */
 extern void slide_free(Slide *s);
 extern void slide_consume(Slide *s, int n);
index d032421e713085e02b9313d57cf3707ba1e46d7b..06c77689cb30f3d145fabae2c98ebfbf71281a88 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
@@ -41,8 +44,8 @@ slide_consume (Slide * s, int n)
 {
   s->nbytes -= n;
 
-  if (s->nbytes<0) 
-       abort();
+  if (s->nbytes < 0)
+    abort ();
 
   memmove (s->slide, s->slide + n, s->nbytes);
 
index 25657db7c8a4bc2fd39b4dcc7a68db3c363bcabe..061ff6d3f7329376fdef4d08b73079db5be4490c 100644 (file)
@@ -11,6 +11,9 @@ static char rcsid[] =
 
 /*
  * $Log$
+ * Revision 1.3  2008/02/14 02:46:44  james
+ * *** empty log message ***
+ *
  * Revision 1.2  2008/02/14 00:57:58  james
  * *** empty log message ***
  *
@@ -164,6 +167,7 @@ socket_connect (char *path)
 
   return ret;
 }
+
 void
 socket_consume_msg (Socket * s)
 {
@@ -172,7 +176,7 @@ socket_consume_msg (Socket * s)
   if (!s->msg)
     return;
 
-  ipc_consume_message_in_slide(s->read_buf);
+  ipc_consume_message_in_slide (s->read_buf);
   s->msg = ipc_check_for_message_in_slide (s->read_buf);
 
 }
@@ -203,7 +207,7 @@ socket_post_select (Socket * s, fd_set * rfds, fd_set * wfds)
 {
   char buf[1024];
   int n;
-  int error=0;
+  int error = 0;
 
 
   if ((!SLIDE_EMPTY (s->write_buf)) && FD_ISSET (s->fd, wfds))
@@ -214,7 +218,8 @@ socket_post_select (Socket * s, fd_set * rfds, fd_set * wfds)
       n = wrap_write (s->fd, SLIDE_RPTR (s->write_buf), n);
       if (n > 0)
         slide_consume (s->write_buf, n);
-     if (n<0) error=-1;
+      if (n < 0)
+        error = -1;
     }
 
   if (!SLIDE_FULL (s->read_buf) && FD_ISSET (s->fd, rfds))
@@ -225,7 +230,8 @@ socket_post_select (Socket * s, fd_set * rfds, fd_set * wfds)
       n = wrap_read (s->fd, SLIDE_WPTR (s->read_buf), n);
       if (n > 0)
         slide_added (s->read_buf, n);
-     if (n<0) error=-1;
+      if (n < 0)
+        error = -1;
     }
 
   s->msg = ipc_check_for_message_in_slide (s->read_buf);
@@ -248,14 +254,15 @@ socket_write (Socket * s, void *buf, int len)
     (SLIDE_BYTES (s->write_buf) >
      MAX_TXN) ? MAX_TXN : SLIDE_BYTES (s->write_buf);
   n = wrap_write (s->fd, SLIDE_RPTR (s->write_buf), n);
-   {
-       uint8_t *c=SLIDE_RPTR(s->write_buf);
+  {
+    uint8_t *c = SLIDE_RPTR (s->write_buf);
   }
 
   if (n > 0)
     slide_consume (s->write_buf, n);
-  
-  if (n<0) return -1;
+
+  if (n < 0)
+    return -1;
 
   return len;
 }
diff --git a/src/term.c b/src/term.c
deleted file mode 100644 (file)
index 8c4f427..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * term.c:
- *
- * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
- * All rights reserved.
- *
- */
-
-static char rcsid[] = "$Id$";
-
-/*
- * $Log$
- * Revision 1.1  2008/02/14 01:55:57  james
- * *** empty log message ***
- *
- */
-
diff --git a/src/term.h b/src/term.h
deleted file mode 100644 (file)
index 3190ef3..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * term.h:
- *
- * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
- * All rights reserved.
- *
- */
-
-/*
- * $Id$
- */
-
-/*
- * $Log$
- * Revision 1.1  2008/02/14 01:55:57  james
- * *** empty log message ***
- *
- */
-
-#ifndef __TERM_H__
-#define __TERM_H__
-
-#endif /* __TERM_H__ */
index 33d2d67044617261353c461cce1de19202ccf12d..d33d3092d33369156ef424075c9a030b86cf8dc1 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.27  2008/02/14 02:46:45  james
+ * *** empty log message ***
+ *
  * Revision 1.26  2008/02/14 01:55:57  james
  * *** empty log message ***
  *
@@ -1209,7 +1212,8 @@ vt102_send (Context * c, uint8_t key)
 {
   uint8_t ch;
 
-  if (!c->t) return;
+  if (!c->t)
+    return;
 
 #if 0
   fprintf (stderr, "vts: %d(%c)\n", key, (key > 31) ? key : ' ');