-/* $Id: html.c,v 1.59 2009/10/07 14:39:00 kristaps Exp $ */
+/* $Id: html.c,v 1.64 2009/10/13 10:57:25 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
#include <err.h>
#include <stdio.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#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)
html_alloc(char *outopts)
{
struct html *h;
- char *toks[4], *v;
+ const char *toks[4];
+ char *v;
toks[0] = "style";
toks[1] = "man";
}
while (outopts && *outopts)
- switch (getsubopt(&outopts, toks, &v)) {
+ switch (getsubopt(&outopts, UNCONST(toks), &v)) {
case (0):
h->style = v;
break;
const char *p, *pp;
pp = h->base_includes;
- while ((p = strchr(pp, '%'))) {
+
+ while (NULL != (p = strchr(pp, '%'))) {
bufncat(h, pp, (size_t)(p - pp));
switch (*(p + 1)) {
case('I'):
const char *p, *pp;
pp = h->base_man;
- while ((p = strchr(pp, '%'))) {
+
+ /* LINTED */
+ while (NULL != (p = strchr(pp, '%'))) {
bufncat(h, pp, (size_t)(p - pp));
switch (*(p + 1)) {
case('S'):
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;
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);
}