summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/html.c b/html.c
index a97a62ed..13b9f516 100644
--- a/html.c
+++ b/html.c
@@ -217,28 +217,36 @@ print_gen_head(struct html *h)
static void
print_spec(struct html *h, const char *p, size_t len)
{
+ int cp;
const char *rhs;
size_t sz;
- rhs = chars_a2ascii(h->symtab, p, len, &sz);
-
- if (NULL == rhs)
+ if ((cp = chars_spec2cp(h->symtab, p, len)) > 0) {
+ printf("&#%d;", cp);
+ return;
+ } else if (-1 == cp)
return;
- fwrite(rhs, 1, sz, stdout);
+
+ if (NULL != (rhs = chars_spec2str(h->symtab, p, len, &sz)))
+ fwrite(rhs, 1, sz, stdout);
}
static void
print_res(struct html *h, const char *p, size_t len)
{
+ int cp;
const char *rhs;
size_t sz;
- rhs = chars_a2res(h->symtab, p, len, &sz);
-
- if (NULL == rhs)
+ if ((cp = chars_res2cp(h->symtab, p, len)) > 0) {
+ printf("&#%d;", cp);
+ return;
+ } else if (-1 == cp)
return;
- fwrite(rhs, 1, sz, stdout);
+
+ if (NULL != (rhs = chars_res2str(h->symtab, p, len, &sz)))
+ fwrite(rhs, 1, sz, stdout);
}