=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.191 retrieving revision 1.193 diff -u -p -r1.191 -r1.193 --- mandoc/term.c 2011/05/15 22:29:50 1.191 +++ mandoc/term.c 2011/05/17 14:38:34 1.193 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.191 2011/05/15 22:29:50 kristaps Exp $ */ +/* $Id: term.c,v 1.193 2011/05/17 14:38:34 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -69,18 +69,6 @@ term_end(struct termp *p) (*p->end)(p); } - -struct termp * -term_alloc(enum termenc enc) -{ - struct termp *p; - - p = mandoc_calloc(1, sizeof(struct termp)); - p->enc = enc; - return(p); -} - - /* * Flush a line of text. A "line" is loosely defined as being something * that should be followed by a newline, regardless of whether it's @@ -451,6 +439,9 @@ term_word(struct termp *p, const char *word) break; switch (esc) { + case (ESCAPE_UNICODE): + encode(p, "?", 1); + break; case (ESCAPE_NUMBERED): if ('\0' != (c = mchars_num2char(seq, sz))) encode(p, &c, 1); @@ -584,6 +575,7 @@ term_strlen(const struct termp *p, const char *cp) for (i = 0; i < rsz; i++) sz += (*p->width)(p, *cp++); + c = 0; switch (*cp) { case ('\\'): cp++; @@ -591,8 +583,12 @@ term_strlen(const struct termp *p, const char *cp) switch (mandoc_escape(&cp, &seq, &ssz)) { case (ESCAPE_ERROR): return(sz); + case (ESCAPE_UNICODE): + c = '?'; + /* FALLTHROUGH */ case (ESCAPE_NUMBERED): - c = mchars_num2char(seq, ssz); + if ('\0' != c) + c = mchars_num2char(seq, ssz); if ('\0' != c) sz += (*p->width)(p, c); break;