void buffmt_man(struct html *h, const char *name, const char *sec) { const char *p, *pp; pp = h->base_man; /* LINTED */ while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { case('S'): bufcat(h, sec ? sec : "1"); break; case('N'): buffmt(h, name); break; default: bufncat(h, p, 2); break; } pp = p + 2; } if (pp) bufcat(h, pp); }
void bufcat_su(struct html *h, const char *p, const struct roffsu *su) { double v; const char *u; v = su->scale; switch (su->unit) { case (SCALE_CM): u = "cm"; break; case (SCALE_IN): u = "in"; break; case (SCALE_PC): u = "pc"; break; case (SCALE_PT): u = "pt"; break; case (SCALE_EM): u = "em"; break; case (SCALE_MM): if (0 == (v /= 100)) v = 1; u = "em"; break; case (SCALE_EN): u = "ex"; break; case (SCALE_BU): u = "ex"; break; case (SCALE_VS): u = "em"; break; default: u = "ex"; break; } /* * XXX: the CSS spec isn't clear as to which types accept * integer or real numbers, so we just make them all decimals. */ buffmt(h, "%s: %.2f%s;", p, v, u); }
/* ARGSUSED */ static void print_mdoc_head(MDOC_ARGS) { print_gen_head(h); bufinit(h); buffmt(h, "%s(%s)", m->title, m->msec); if (m->arch) { bufcat(h, " ("); bufcat(h, m->arch); bufcat(h, ")"); } print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); }