summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/chars.c4
-rw-r--r--usr.bin/mandoc/html.c11
-rw-r--r--usr.bin/mandoc/mandocdb.c4
-rw-r--r--usr.bin/mandoc/term.c12
4 files changed, 15 insertions, 16 deletions
diff --git a/usr.bin/mandoc/chars.c b/usr.bin/mandoc/chars.c
index 961769c80f0..00713a9cd30 100644
--- a/usr.bin/mandoc/chars.c
+++ b/usr.bin/mandoc/chars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chars.c,v 1.31 2014/10/26 18:06:28 schwarze Exp $ */
+/* $OpenBSD: chars.c,v 1.32 2014/10/27 13:29:30 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -102,7 +102,7 @@ mchars_spec2cp(const struct mchars *arg, const char *p, size_t sz)
const struct ln *ln;
ln = find(arg, p, sz);
- return(ln != NULL ? ln->unicode : sz == 1 ? *p : -1);
+ return(ln != NULL ? ln->unicode : sz == 1 ? *p : 0xFFFD);
}
char
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 219671ec597..47c59297012 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.c,v 1.47 2014/10/26 17:11:18 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.48 2014/10/27 13:29:30 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -455,11 +455,12 @@ print_encode(struct html *h, const char *p, int norecurse)
break;
case ESCAPE_SPECIAL:
c = mchars_spec2cp(h->symtab, seq, len);
- if (c > 0)
+ if (c <= 0)
+ break;
+ if (c < 0x20 || c > 0x7e)
printf("&#%d;", c);
- else if (-1 == c && 1 == len &&
- !print_escape(*seq))
- putchar((int)*seq);
+ else if ( ! print_escape(c))
+ putchar(c);
break;
case ESCAPE_NOSPACE:
if ('\0' == *p)
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index fb1e881826b..e4e0983ef39 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandocdb.c,v 1.121 2014/10/12 20:32:16 schwarze Exp $ */
+/* $OpenBSD: mandocdb.c,v 1.122 2014/10/27 13:29:30 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -1893,7 +1893,7 @@ render_key(struct mchars *mc, struct str *key)
*/
if (write_utf8) {
- if (0 == (u = mchars_spec2cp(mc, seq, len)))
+ if ((u = mchars_spec2cp(mc, seq, len)) <= 0)
continue;
cpp = utfbuf;
if (0 == (sz = utf8(u, utfbuf)))
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index b64b49095f3..33ed30422c4 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.c,v 1.89 2014/10/26 17:11:18 schwarze Exp $ */
+/* $OpenBSD: term.c,v 1.90 2014/10/27 13:29:30 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -466,9 +466,8 @@ term_word(struct termp *p, const char *word)
encode(p, cp, ssz);
} else {
uc = mchars_spec2cp(p->symtab, seq, sz);
- if (uc <= 0)
- uc = 0xFFFD;
- encode1(p, uc);
+ if (uc > 0)
+ encode1(p, uc);
}
break;
case ESCAPE_FONTBOLD:
@@ -703,9 +702,8 @@ term_strlen(const struct termp *p, const char *cp)
} else {
c = mchars_spec2cp(p->symtab,
seq, ssz);
- if (c <= 0)
- c = 0xFFFD;
- sz += cond_width(p, c, &skip);
+ if (c > 0)
+ sz += cond_width(p, c, &skip);
}
break;
case ESCAPE_SKIPCHAR: