diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-10-28 18:48:57 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2014-10-28 18:48:57 +0000 |
commit | 4b49f36c0b6ae86b74ff3aefc273807c105cfa7c (patch) | |
tree | b9c633cbeaf4ca6b21412a81de6a0b6834543a92 | |
parent | e65351f6a3dd637d14b3fcf8be0e8367a1aacc0d (diff) |
In -Tascii mode, print "<?>" only for Unicode escapes of unknown
representation, not for character escapes with unknown names.
According to groff, the latter produce no output, and we now warn
about them.
-rw-r--r-- | usr.bin/mandoc/term.c | 14 | ||||
-rw-r--r-- | usr.bin/mandoc/term_ascii.c | 6 |
2 files changed, 7 insertions, 13 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index 53da8ff403b..31a54be5287 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term.c,v 1.91 2014/10/28 17:35:42 schwarze Exp $ */ +/* $OpenBSD: term.c,v 1.92 2014/10/28 18:48:56 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org> @@ -456,9 +456,7 @@ term_word(struct termp *p, const char *word) if (p->enc == TERMENC_ASCII) { cp = mchars_spec2str(p->symtab, seq, sz, &ssz); - if (cp == NULL) - encode(p, "<?>", 3); - else + if (cp != NULL) encode(p, cp, ssz); } else { uc = mchars_spec2cp(p->symtab, seq, sz); @@ -688,14 +686,10 @@ term_strlen(const struct termp *p, const char *cp) sz += cond_width(p, c, &skip); break; case ESCAPE_SPECIAL: - if (p->enc == TERMENC_ASCII) { + if (p->enc == TERMENC_ASCII) rhs = mchars_spec2str(p->symtab, seq, ssz, &rsz); - if (rhs == NULL) { - rhs = "<?>"; - rsz = 3; - } - } else { + else { c = mchars_spec2cp(p->symtab, seq, ssz); if (c > 0) diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c index db246938ef4..1c995148c90 100644 --- a/usr.bin/mandoc/term_ascii.c +++ b/usr.bin/mandoc/term_ascii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term_ascii.c,v 1.25 2014/10/28 17:35:42 schwarze Exp $ */ +/* $OpenBSD: term_ascii.c,v 1.26 2014/10/28 18:48:56 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -17,6 +17,7 @@ */ #include <sys/types.h> +#include <assert.h> #include <locale.h> #include <stdint.h> #include <stdio.h> @@ -327,8 +328,7 @@ ascii_uc2str(int uc) "j", "DZ", "Dz", "dz", "'\bG", "'\bg", "HV", "W", "`\bN", "`\bn", "A", "a", "'\bAE","'\bae","O", "o"}; - if (uc < 0) - return("<?>"); + assert(uc >= 0); if ((size_t)uc < sizeof(tab)/sizeof(tab[0])) return(tab[uc]); return(mchars_uc2str(uc)); |