summaryrefslogtreecommitdiffstats
path: root/mandoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-12 17:08:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-12 17:08:03 +0000
commit78bebdfe144e0c61d47fea953c79e7c9a79415fe (patch)
tree568377ee59d5d54dfa798dec4af9e6f3a1a1dd86 /mandoc.c
parent80adacfa690f8bc06d9b9d518080b5eaa1197e1f (diff)
downloadmandoc-78bebdfe144e0c61d47fea953c79e7c9a79415fe.tar.gz
Put the eos-checker into libmandoc.h.
Added bits in mdoc.7 and man.7 about EOS spacing.
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/mandoc.c b/mandoc.c
index dface045..6677295e 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -300,3 +300,26 @@ mandoc_a2time(int flags, const char *p)
return(0);
}
+
+int
+mandoc_eos(const char *p, size_t sz)
+{
+
+ assert(sz);
+
+ switch (p[(int)sz - 1]) {
+ case ('.'):
+ /* Escaped periods. */
+ if (sz > 1 && '\\' == p[(int)sz - 2])
+ return(0);
+ /* FALLTHROUGH */
+ case ('!'):
+ /* FALLTHROUGH */
+ case ('?'):
+ break;
+ default:
+ return(0);
+ }
+
+ return(1);
+}