summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/term_ascii.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-26 18:06:29 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-10-26 18:06:29 +0000
commitc4add23523d6596e46b1b8e4c031c0e8f4afd91f (patch)
tree95d06ad833fa2bb485ced027b80976aef36adb76 /usr.bin/mandoc/term_ascii.c
parente6fa5a2466ead855b3e736a587c3b15695d84850 (diff)
In -Tascii mode, provide approximations even for some Unicode escape
sequences above codepoint 512 by doing a reverse lookup in the existing mandoc_char(7) character table. Again, groff isn't smart enough to do this and silently discards such escape sequences without printing anything.
Diffstat (limited to 'usr.bin/mandoc/term_ascii.c')
-rw-r--r--usr.bin/mandoc/term_ascii.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index 8fbb398d1ee..333bb2c1ac9 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.22 2014/10/26 17:11:18 schwarze Exp $ */
+/* $OpenBSD: term_ascii.c,v 1.23 2014/10/26 18:06:28 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -325,9 +325,11 @@ ascii_uc2str(int uc)
"j", "DZ", "D", "dz", "G", "g", "HV", "W",
"N", "n", "A", "a", "AE", "ae", "O", "o"};
- if (uc < 0 || (size_t)uc >= sizeof(tab)/sizeof(tab[0]))
+ if (uc < 0)
return("<?>");
- return(tab[uc]);
+ if ((size_t)uc < sizeof(tab)/sizeof(tab[0]))
+ return(tab[uc]);
+ return(mchars_uc2str(uc));
}
static size_t