=================================================================== RCS file: /cvs/mandoc/html.c,v retrieving revision 1.72 retrieving revision 1.76 diff -u -p -r1.72 -r1.76 --- mandoc/html.c 2009/10/30 18:43:24 1.72 +++ mandoc/html.c 2009/11/01 07:44:32 1.76 @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.72 2009/10/30 18:43:24 kristaps Exp $ */ +/* $Id: html.c,v 1.76 2009/11/01 07:44:32 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -18,9 +18,8 @@ #include #include -#include -#include #include +#include #include #include #include @@ -102,7 +101,7 @@ html_alloc(char *outopts) h = calloc(1, sizeof(struct html)); if (NULL == h) { - fprintf(stderr, "memory exhausted\n"); + perror(NULL); exit(EXIT_FAILURE); } @@ -190,15 +189,13 @@ static void print_spec(struct html *h, const char *p, int len) { const char *rhs; - int i; size_t sz; rhs = chars_a2ascii(h->symtab, p, (size_t)len, &sz); if (NULL == rhs) return; - for (i = 0; i < (int)sz; i++) - putchar(rhs[i]); + fwrite(rhs, 1, sz, stdout); } @@ -206,15 +203,13 @@ static void print_res(struct html *h, const char *p, int len) { const char *rhs; - int i; size_t sz; rhs = chars_a2res(h->symtab, p, (size_t)len, &sz); if (NULL == rhs) return; - for (i = 0; i < (int)sz; i++) - putchar(rhs[i]); + fwrite(rhs, 1, sz, stdout); } @@ -355,7 +350,7 @@ print_otag(struct html *h, enum htmltag tag, if ( ! (HTML_NOSTACK & htmltags[tag].flags)) { t = malloc(sizeof(struct tag)); if (NULL == t) { - fprintf(stderr, "memory exhausted\n"); + perror(NULL); exit(EXIT_FAILURE); } t->tag = tag; @@ -673,7 +668,7 @@ html_idcat(char *dst, const char *src, int sz) sz--; for ( ; *src != '\0' && sz > 1; src++) { - ssz = snprintf(dst, sz, "%.2x", *src); + ssz = snprintf(dst, (size_t)sz, "%.2x", *src); sz -= ssz; dst += ssz; }