diff options
author | james <> | 2008-03-02 10:37:56 +0000 |
---|---|---|
committer | james <> | 2008-03-02 10:37:56 +0000 |
commit | f23e17f2eac3f506afe9a1e44302112cc363b59f (patch) | |
tree | 2c8ced74467ecd189daee8e9b38238f7a0894de4 /src/html.c | |
parent | 77b31c3e51edfefc9b82b7ba31944c4161997ef4 (diff) | |
download | sympathy-f23e17f2eac3f506afe9a1e44302112cc363b59f.tar.gz sympathy-f23e17f2eac3f506afe9a1e44302112cc363b59f.tar.bz2 sympathy-f23e17f2eac3f506afe9a1e44302112cc363b59f.zip |
*** empty log message ***
Diffstat (limited to 'src/html.c')
-rw-r--r-- | src/html.c | 101 |
1 files changed, 46 insertions, 55 deletions
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.10 2008/03/02 10:37:56 james + * *** empty log message *** + * * Revision 1.9 2008/02/27 09:42:22 james * *** empty log message *** * @@ -68,35 +71,29 @@ static int colormap[] = { static void html_entity (FILE * f, int c) { - switch (c) - { - case 32: - fprintf (f, " "); - break; - case 38: - fprintf (f, "&"); - break; - case 60: - fprintf (f, "<"); - break; - case 62: - fprintf (f, ">"); - break; - default: - - if ((c >= 32) && (c < 127)) - { - fputc (c, f); - } - else if (c > 127) - { - fprintf (f, "&#x%04x;", c); - } - else - { - fputc (' ', f); - } + switch (c) { + case 32: + fprintf (f, " "); + break; + case 38: + fprintf (f, "&"); + break; + case 60: + fprintf (f, "<"); + break; + case 62: + fprintf (f, ">"); + break; + default: + + if ((c >= 32) && (c < 127)) { + fputc (c, f); + } else if (c > 127) { + fprintf (f, "&#x%04x;", c); + } else { + fputc (' ', f); } + } } static void @@ -104,18 +101,15 @@ html_render (FILE * f, CRT_CA c) { int fg, bg; - if (c.attr & CRT_ATTR_REVERSE) - { - 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; - } + if (c.attr & CRT_ATTR_REVERSE) { + 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; + } #ifdef CSS fprintf (f, "<span style='color: #%06x; background-color: #%06x'>", colormap[fg], colormap[bg]); @@ -136,10 +130,9 @@ html_render (FILE * f, CRT_CA c) fprintf (f, "</b>"); if (c.attr & CRT_ATTR_UNDERLINE) fprintf (f, "</ul>"); - if (c.attr & CRT_ATTR_REVERSE) - { - fprintf (f, "</font>"); - } + if (c.attr & CRT_ATTR_REVERSE) { + fprintf (f, "</font>"); + } #ifdef CSS fprintf (f, "</span>"); #else @@ -159,22 +152,20 @@ html_draw (FILE * f, CRT * c) #else fprintf (f, "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); #endif - for (p.y = 0; p.y < c->size.y; ++p.y) - { - o = CRT_ADDR (p.y, 0); + for (p.y = 0; p.y < c->size.y; ++p.y) { + o = CRT_ADDR (p.y, 0); #ifndef CSS - fprintf (f, "<tr>"); + fprintf (f, "<tr>"); #endif - for (p.x = 0; p.x < c->size.x; ++p.x, ++o) - { - html_render (f, c->screen[o]); - } + for (p.x = 0; p.x < c->size.x; ++p.x, ++o) { + html_render (f, c->screen[o]); + } #ifdef CSS - fprintf (f, "\n"); + fprintf (f, "\n"); #else - fprintf (f, "</tr>\n"); + fprintf (f, "</tr>\n"); #endif - } + } #ifdef CSS fprintf (f, "</pre>\n"); #else |