summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-01-07 10:05:24 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-01-07 10:05:24 +0000
commit65a5d430e92f93dd778bf5b4aaabe7e52238d532 (patch)
treeef72c3239f8d4c5017aa9731624e7aa97a24687b /man.c
parent3f65854b86de1e14f4d8edce45fb7c76103bb592 (diff)
downloadmandoc-65a5d430e92f93dd778bf5b4aaabe7e52238d532.tar.gz
Check for white-space at end of stand-alone macro line.
Diffstat (limited to 'man.c')
-rw-r--r--man.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/man.c b/man.c
index 1bcf7d5b..71ae2c42 100644
--- a/man.c
+++ b/man.c
@@ -378,6 +378,7 @@ man_ptext(struct man *m, int line, char *buf)
for (i = 0; ' ' == buf[i]; i++)
/* Skip leading whitespace. */ ;
+
if (0 == buf[i]) {
if ( ! pstring(m, line, 0, &buf[i], 0))
return(0);
@@ -463,7 +464,7 @@ man_pmacro(struct man *m, int ln, char *buf)
i++;
while (buf[i] && ' ' == buf[i])
i++;
- if (0 == buf[i])
+ if ('\0' == buf[i])
goto out;
}
@@ -472,7 +473,7 @@ man_pmacro(struct man *m, int ln, char *buf)
/* Copy the first word into a nil-terminated buffer. */
for (j = 0; j < 4; j++, i++) {
- if (0 == (mac[j] = buf[i]))
+ if ('\0' == (mac[j] = buf[i]))
break;
else if (' ' == buf[i])
break;
@@ -507,6 +508,12 @@ man_pmacro(struct man *m, int ln, char *buf)
while (buf[i] && ' ' == buf[i])
i++;
+ /* Trailing whitespace? */
+
+ if ('\0' == buf[i] && ' ' == buf[i - 1])
+ if ( ! man_pwarn(m, ln, i - 1, WTSPACE))
+ goto err;
+
/* Remove prior ELINE macro, if applicable. */
if (m->flags & MAN_ELINE) {