summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-27 14:19:26 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-27 14:19:26 +0000
commitb48d1093b6bfb6d254e9d96a70319ef2563f49f7 (patch)
tree80ac410873e4c61b1d3f960a2e41339a3419b263
parenta246292f836147375dc6f624f58cc10c9f0d4f39 (diff)
downloadmandoc-b48d1093b6bfb6d254e9d96a70319ef2563f49f7.tar.gz
Fix hyphen-replacement loop.
-rw-r--r--roff.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/roff.c b/roff.c
index d4123375..e1dd67c4 100644
--- a/roff.c
+++ b/roff.c
@@ -530,6 +530,9 @@ roff_parsetext(char *p)
sz = strcspn(p, "-\\");
p += sz;
+ if ('\0' == *p)
+ break;
+
if ('\\' == *p) {
/* Skip over escapes. */
p++;
@@ -538,20 +541,19 @@ roff_parsetext(char *p)
if (ESCAPE_ERROR == esc)
break;
continue;
- } else if ('-' != *p || p == start) {
+ } else if (p == start) {
p++;
continue;
}
l = *(p - 1);
r = *(p + 1);
-
if ('\\' != l &&
'\t' != r && '\t' != l &&
' ' != r && ' ' != l &&
'-' != r && '-' != l &&
! isdigit((unsigned char)l) &&
- ! isdigit((unsigned char)r))
+ ! isdigit((unsigned char)r))
*p = ASCII_HYPH;
p++;
}