chiark / gitweb /
*** empty log message ***
authorstaffcvs <staffcvs>
Wed, 20 Feb 2008 22:54:22 +0000 (22:54 +0000)
committerstaffcvs <staffcvs>
Wed, 20 Feb 2008 22:54:22 +0000 (22:54 +0000)
src/ansi.c
src/html.c
src/symsocket.c

index 905866b39643485dac74cbbd36fe96b35de8a7bc..d2efc467db94738ee091cfc2669754fa6a184349 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.27  2008/02/20 22:54:22  staffcvs
+ * *** empty log message ***
+ *
  * Revision 1.26  2008/02/20 20:16:07  james
  * *** empty log message ***
  *
@@ -859,30 +862,32 @@ ansi_update (ANSI * a, Context * c)
   ansi_draw (a, &c->v->crt);
 }
 
-static void ansi_free(ANSI *a)
+static void
+ansi_free (ANSI * a)
 {
-      a->terminal_reset(a);
-      if (a->terminal) 
-       a->terminal->close(a->terminal);
+  a->terminal_reset (a);
+  if (a->terminal)
+    a->terminal->close (a->terminal);
 
-       free(a);
+  free (a);
 
 }
 
-ANSI *ansi_new_from_terminal(TTY *t)
+ANSI *
+ansi_new_from_terminal (TTY * t)
 {
-ANSI *ret;
+  ANSI *ret;
 
-ret=malloc(sizeof(ANSI));
-memset(ret,0,sizeof(ANSI));
+  ret = malloc (sizeof (ANSI));
+  memset (ret, 0, sizeof (ANSI));
 
-ret->terminal=t;
+  ret->terminal = t;
 
-ret->update=ansi_update;
-ret->reset=ansi_reset;
-ret->terminal_reset=ansi_terminal_reset;
-ret->close=ansi_free;
-ret->dispatch=ansi_dispatch;
+  ret->update = ansi_update;
+  ret->reset = ansi_reset;
+  ret->terminal_reset = ansi_terminal_reset;
+  ret->close = ansi_free;
+  ret->dispatch = ansi_dispatch;
 
-return ret;
+  return ret;
 }
index 6aefce3f300dea2b9213a210e067299e3528aa30..b1d6ce953da599b0b9d83e92ab2cf3609c5bfde6 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.4  2008/02/20 22:54:22  staffcvs
+ * *** empty log message ***
+ *
  * Revision 1.3  2008/02/20 20:16:07  james
  * *** empty log message ***
  *
@@ -27,24 +30,23 @@ static char rcsid[] = "$Id$";
 #define V(i) (((i)==0)?0x80:(((i)==1)?0xc0:0xff))
 #define COLOR(r,g,b,i) ((((r)?(V(i)):0) << 0)| (((g)?(V(i)):0) << 8)| (((b)?(V(i)):0) << 16))
 
-static int colormap[]=
-{
-[CRT_COLOR_BLACK]=COLOR(0,0,0,0),
-[CRT_COLOR_RED]=COLOR(0,0,1,0),
-[CRT_COLOR_GREEN]=COLOR(0,1,0,0),
-[CRT_COLOR_YELLOW]=COLOR(0,1,1,0),
-[CRT_COLOR_BLUE]=COLOR(1,0,0,0),
-[CRT_COLOR_MAGENTA]=COLOR(1,0,1,0),
-[CRT_COLOR_CYAN]=COLOR(1,1,0,0),
-[CRT_COLOR_WHITE]=COLOR(1,1,1,1),
-[CRT_COLOR_BLACK|CRT_COLOR_INTENSITY]=COLOR(1,1,1,0),
-[CRT_COLOR_RED|CRT_COLOR_INTENSITY]=COLOR(0,0,1,2),
-[CRT_COLOR_GREEN|CRT_COLOR_INTENSITY]=COLOR(0,1,0,2),
-[CRT_COLOR_YELLOW|CRT_COLOR_INTENSITY]=COLOR(0,1,1,2),
-[CRT_COLOR_BLUE|CRT_COLOR_INTENSITY]=COLOR(1,0,0,2),
-[CRT_COLOR_MAGENTA|CRT_COLOR_INTENSITY]=COLOR(1,0,1,2),
-[CRT_COLOR_CYAN|CRT_COLOR_INTENSITY]=COLOR(1,1,0,2),
-[CRT_COLOR_WHITE|CRT_COLOR_INTENSITY]=COLOR(1,1,1,2),
+static int colormap[] = {
+  [CRT_COLOR_BLACK] = COLOR (0, 0, 0, 0),
+  [CRT_COLOR_RED] = COLOR (0, 0, 1, 0),
+  [CRT_COLOR_GREEN] = COLOR (0, 1, 0, 0),
+  [CRT_COLOR_YELLOW] = COLOR (0, 1, 1, 0),
+  [CRT_COLOR_BLUE] = COLOR (1, 0, 0, 0),
+  [CRT_COLOR_MAGENTA] = COLOR (1, 0, 1, 0),
+  [CRT_COLOR_CYAN] = COLOR (1, 1, 0, 0),
+  [CRT_COLOR_WHITE] = COLOR (1, 1, 1, 1),
+  [CRT_COLOR_BLACK | CRT_COLOR_INTENSITY] = COLOR (1, 1, 1, 0),
+  [CRT_COLOR_RED | CRT_COLOR_INTENSITY] = COLOR (0, 0, 1, 2),
+  [CRT_COLOR_GREEN | CRT_COLOR_INTENSITY] = COLOR (0, 1, 0, 2),
+  [CRT_COLOR_YELLOW | CRT_COLOR_INTENSITY] = COLOR (0, 1, 1, 2),
+  [CRT_COLOR_BLUE | CRT_COLOR_INTENSITY] = COLOR (1, 0, 0, 2),
+  [CRT_COLOR_MAGENTA | CRT_COLOR_INTENSITY] = COLOR (1, 0, 1, 2),
+  [CRT_COLOR_CYAN | CRT_COLOR_INTENSITY] = COLOR (1, 1, 0, 2),
+  [CRT_COLOR_WHITE | CRT_COLOR_INTENSITY] = COLOR (1, 1, 1, 2),
 };
 
 
@@ -73,21 +75,22 @@ html_entity (FILE * f, int c)
 static void
 html_render (FILE * f, CRT_CA c)
 {
-int fg,bg;
-  
+  int fg, bg;
+
   if (c.attr & CRT_ATTR_REVERSE)
     {
-      fg=CRT_COLOR_BG(c.color);
-      bg=CRT_COLOR_FG(c.color);
+      fg = CRT_COLOR_BG (c.color);
+      bg = CRT_COLOR_FG (c.color);
     }
   else
     {
-      fg=CRT_COLOR_FG(c.color);
-      bg=CRT_COLOR_BG(c.color);
-       if (c.attr & CRT_ATTR_BOLD) 
-               fg|=CRT_COLOR_INTENSITY;
+      fg = CRT_COLOR_FG (c.color);
+      bg = CRT_COLOR_BG (c.color);
+      if (c.attr & CRT_ATTR_BOLD)
+        fg |= CRT_COLOR_INTENSITY;
     }
-  fprintf (f, "<td bgcolor='#%06x'><font color='#%06x'>",colormap[bg],colormap[fg]);
+  fprintf (f, "<td bgcolor='#%06x'><font color='#%06x'>", colormap[bg],
+           colormap[fg]);
 
   if (c.attr & CRT_ATTR_UNDERLINE)
     fprintf (f, "<ul>");
@@ -133,31 +136,30 @@ html_draw (FILE * f, CRT * c)
 }
 
 
-static void html_one_shot(ANSI *a,CRT *c)
+static void
+html_one_shot (ANSI * a, CRT * c)
 {
-html_draw(a->file,c);
+  html_draw (a->file, c);
 }
 
 
-static void ansi_free(ANSI *a)
+static void
+ansi_free (ANSI * a)
 {
-free(a);
+  free (a);
 }
 
-ANSI *ansi_new_html(FILE *f)
+ANSI *
+ansi_new_html (FILE * f)
 {
-ANSI *ret;
+  ANSI *ret;
 
-ret=malloc(sizeof(ANSI));
-memset(ret,0,sizeof(ANSI));
+  ret = malloc (sizeof (ANSI));
+  memset (ret, 0, sizeof (ANSI));
 
-ret->file=f;
-ret->close=ansi_free;
-ret->one_shot=html_one_shot;
+  ret->file = f;
+  ret->close = ansi_free;
+  ret->one_shot = html_one_shot;
 
-return ret;
+  return ret;
 }
-
-
-
-
index bb8f4fff6ca42d681738cbcb74b6b380ee447aab..ee5869a23c3220c4d95f637789ac91717074a695 100644 (file)
@@ -11,6 +11,9 @@ static char rcsid[] =
 
 /*
  * $Log$
+ * Revision 1.5  2008/02/20 22:54:22  staffcvs
+ * *** empty log message ***
+ *
  * Revision 1.4  2008/02/20 18:31:53  james
  * *** empty log message ***
  *
@@ -37,7 +40,7 @@ wrap_recv (int fd, void *buf, int len)
 {
   int red;
 
-  red = recv (fd, buf, len,0);
+  red = recv (fd, buf, len, 0);
   if (!red)
     return -1;
 
@@ -54,7 +57,7 @@ wrap_send (int fd, void *buf, int len)
 
   errno = 0;
 
-  writ = send (fd, buf, len,MSG_NOSIGNAL);
+  writ = send (fd, buf, len, MSG_NOSIGNAL);
 
   if (!writ)
     return -1;
@@ -74,12 +77,13 @@ socket_free (Socket * s)
     slide_free (s->read_buf);
   if (s->write_buf)
     slide_free (s->write_buf);
-  if (s->path_to_unlink) {
-       unlink(s->path_to_unlink);
-       free(s->path_to_unlink); 
-  }
+  if (s->path_to_unlink)
+    {
+      unlink (s->path_to_unlink);
+      free (s->path_to_unlink);
+    }
   close (s->fd);
-  free(s);
+  free (s);
 }
 
 void
@@ -91,11 +95,11 @@ socket_free_parent (Socket * s)
     slide_free (s->read_buf);
   if (s->write_buf)
     slide_free (s->write_buf);
-  if (s->path_to_unlink) 
-       free(s->path_to_unlink); 
+  if (s->path_to_unlink)
+    free (s->path_to_unlink);
   close (s->fd);
 
-  free(s);
+  free (s);
 }
 
 
@@ -145,7 +149,7 @@ socket_listen (char *path)
   ret->write_buf = NULL;
 
   ret->fd = fd;
-  ret->path_to_unlink=strdup(path);
+  ret->path_to_unlink = strdup (path);
 
 
   return ret;