=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.60 retrieving revision 1.65 diff -u -p -r1.60 -r1.65 --- mandoc/html.c 2009/10/07 15:06:03 1.60 +++ mandoc/html.c 2009/10/20 05:45:21 1.65 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.60 2009/10/07 15:06:03 kristaps Exp $ */ +/* $Id: html.c,v 1.65 2009/10/20 05:45:21 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -28,12 +29,15 @@ #include "out.h" #include "chars.h" #include "html.h" +#include "main.h" +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) + #define DOCTYPE "-//W3C//DTD HTML 4.01//EN" #define DTD "http://www.w3.org/TR/html4/strict.dtd" struct htmldata { - char *name; + const char *name; int flags; #define HTML_CLRLINE (1 << 0) #define HTML_NOSTACK (1 << 1) @@ -87,7 +91,8 @@ void * html_alloc(char *outopts) { struct html *h; - char *toks[4], *v; + const char *toks[4]; + char *v; toks[0] = "style"; toks[1] = "man"; @@ -106,7 +111,7 @@ html_alloc(char *outopts) } while (outopts && *outopts) - switch (getsubopt(&outopts, toks, &v)) { + switch (getsubopt(&outopts, UNCONST(toks), &v)) { case (0): h->style = v; break; @@ -549,8 +554,8 @@ buffmt_includes(struct html *h, const char *name) const char *p, *pp; pp = h->base_includes; - p = strchr(pp, '%'); - while (NULL != p) { + + while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { case('I'): @@ -574,8 +579,9 @@ buffmt_man(struct html *h, const char *p, *pp; pp = h->base_man; - p = strchr(pp, '%'); - while (NULL != p) { + + /* LINTED */ + while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { case('S'): @@ -598,8 +604,8 @@ buffmt_man(struct html *h, void bufcat_su(struct html *h, const char *p, const struct roffsu *su) { - int v; - char *u; + double v; + const char *u; v = su->scale; @@ -638,5 +644,10 @@ bufcat_su(struct html *h, const char *p, const struct break; } - buffmt(h, "%s: %d%s;", p, v, u); + if (su->pt) + buffmt(h, "%s: %f%s;", p, v, u); + else + /* LINTED */ + buffmt(h, "%s: %d%s;", p, (int)v, u); } +