summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_strings.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2010-05-15 12:30:59 +0000
committerschwarze <schwarze@openbsd.org>2010-05-15 12:30:59 +0000
commit73e41f78d22fc5d9d3e42f552b957fa9e8c583cc (patch)
tree477b814f6cafa1707ef7aaeea739f20a1527ce6e /usr.bin/mandoc/mdoc_strings.c
parentnormalize() cannot be inline and extern at the same time; prompted by (diff)
downloadwireguard-openbsd-73e41f78d22fc5d9d3e42f552b957fa9e8c583cc.tar.xz
wireguard-openbsd-73e41f78d22fc5d9d3e42f552b957fa9e8c583cc.zip
Distinguish OPEN, MIDDLE and CLOSE delimiters (using an enum).
Only OPEN are drawn before the beginning of a macro; this is new, before this, MIDDLE ('|') were drawn in front, too. Only CLOSE are pushed after the end of a macro (as before). ok kristaps@ This allows us to finally enable handling of leading punctuation without regressions.
Diffstat (limited to 'usr.bin/mandoc/mdoc_strings.c')
-rw-r--r--usr.bin/mandoc/mdoc_strings.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/mandoc/mdoc_strings.c b/usr.bin/mandoc/mdoc_strings.c
index 193e865bfa4..a491988b547 100644
--- a/usr.bin/mandoc/mdoc_strings.c
+++ b/usr.bin/mandoc/mdoc_strings.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_strings.c,v 1.15 2010/05/14 14:47:44 schwarze Exp $ */
+/* $Id: mdoc_strings.c,v 1.16 2010/05/15 12:30:59 schwarze Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -53,17 +53,17 @@ static const char * const secnames[SEC__MAX] = {
* FIXME: this is repeated in print_text() (html.c) and term_word()
* (term.c).
*/
-int
+enum mdelim
mdoc_iscdelim(char p)
{
switch (p) {
- case('|'):
- /* FALLTHROUGH */
case('('):
/* FALLTHROUGH */
case('['):
- return(1);
+ return(DELIM_OPEN);
+ case('|'):
+ return(DELIM_MIDDLE);
case('.'):
/* FALLTHROUGH */
case(','):
@@ -79,16 +79,16 @@ mdoc_iscdelim(char p)
case(')'):
/* FALLTHROUGH */
case(']'):
- return(2);
+ return(DELIM_CLOSE);
default:
break;
}
- return(0);
+ return(DELIM_NONE);
}
-int
+enum mdelim
mdoc_isdelim(const char *p)
{
@@ -102,7 +102,7 @@ mdoc_isdelim(const char *p)
* is treated in exactly the same way as the vertical bar. This
* is the only function that checks for this.
*/
- return(0 == strcmp(p, "\\*(Ba"));
+ return(strcmp(p, "\\*(Ba") ? DELIM_NONE : DELIM_MIDDLE);
}