aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-07 20:58:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-07 20:58:49 +0000
commite9e73c8b92db397bbb28dded51ebbb85b3378f59 (patch)
treea8812e92e1bf7e29009dc9a7f54d080d332fd8d8 /mdoc.c
parent9d0aa71fc423408e9d933f17f51c1ef0f9ea041b (diff)
downloadmandoc-e9e73c8b92db397bbb28dded51ebbb85b3378f59.tar.gz
mandoc-e9e73c8b92db397bbb28dded51ebbb85b3378f59.tar.zst
mandoc-e9e73c8b92db397bbb28dded51ebbb85b3378f59.zip
Also catch "new sentence, new line" if there are three blanks
between the sentences. Thomas Klausner says he has seen some of these, and i don't see any false positives.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mdoc.c b/mdoc.c
index 7ad087e0..d08a8525 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.265 2017/06/07 20:30:40 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.266 2017/06/07 20:58:49 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -280,12 +280,18 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
continue;
if (end - c < 3)
break;
- if (isalpha((unsigned char)c[-2]) &&
- isalpha((unsigned char)c[-1]) &&
- c[1] == ' ' &&
- isupper((unsigned char)(c[2] == ' ' ? c[3] : c[2])) &&
- (c[-2] != 'n' || c[-1] != 'c') &&
- (c[-2] != 'v' || c[-1] != 's'))
+ if (c[1] != ' ' ||
+ isalpha((unsigned char)c[-2]) == 0 ||
+ isalpha((unsigned char)c[-1]) == 0 ||
+ (c[-2] == 'n' && c[-1] == 'c') ||
+ (c[-2] == 'v' && c[-1] == 's'))
+ continue;
+ c += 2;
+ if (*c == ' ')
+ c++;
+ if (*c == ' ')
+ c++;
+ if (isupper((unsigned char)(*c)))
mandoc_msg(MANDOCERR_EOS, mdoc->parse,
line, (int)(c - buf), NULL);
}