aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-09 21:06:50 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-09 21:06:50 +0000
commitbd5d3f5fd99118e223a09bf7792543bd79040d94 (patch)
tree0c3f35649b4d585deaca35dbefbf3c7e75244f80
parent51498304d771a59375a440a6288a260e9848f18f (diff)
downloadmandoc-bd5d3f5fd99118e223a09bf7792543bd79040d94.tar.gz
mandoc-bd5d3f5fd99118e223a09bf7792543bd79040d94.tar.zst
mandoc-bd5d3f5fd99118e223a09bf7792543bd79040d94.zip
Explicitly account for \*(Ba when checking for delims. Noted by Jason McIntyre via Ingo Schwarze.
-rw-r--r--mdoc_argv.c13
-rw-r--r--mdoc_strings.c18
2 files changed, 19 insertions, 12 deletions
diff --git a/mdoc_argv.c b/mdoc_argv.c
index ce67d6e9..96ccef17 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.44 2010/05/09 10:17:02 kristaps Exp $ */
+/* $Id: mdoc_argv.c,v 1.45 2010/05/09 21:06:50 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -402,9 +402,10 @@ args(struct mdoc *m, int line, int *pos,
return(ARGS_EOLN);
/*
- * If the first character is a delimiter and we're to look for
- * delimited strings, then pass down the buffer seeing if it
- * follows the pattern of [[::delim::][ ]+]+.
+ * If the first character is a closing delimiter and we're to
+ * look for delimited strings, then pass down the buffer seeing
+ * if it follows the pattern of [[::delim::][ ]+]+. Note that
+ * we ONLY care about closing delimiters.
*/
if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos]) > 1) {
@@ -412,14 +413,14 @@ args(struct mdoc *m, int line, int *pos,
if ( mdoc_iscdelim(buf[i]) < 2)
break;
i++;
- if (0 == buf[i] || ' ' != buf[i])
+ if ('\0' == buf[i] || ' ' != buf[i])
break;
i++;
while (buf[i] && ' ' == buf[i])
i++;
}
- if (0 == buf[i]) {
+ if ('\0' == buf[i]) {
*v = &buf[*pos];
if (' ' != buf[i - 1])
return(ARGS_PUNCT);
diff --git a/mdoc_strings.c b/mdoc_strings.c
index bfe4c652..33f5da15 100644
--- a/mdoc_strings.c
+++ b/mdoc_strings.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_strings.c,v 1.17 2010/05/08 07:30:19 kristaps Exp $ */
+/* $Id: mdoc_strings.c,v 1.18 2010/05/09 21:06:50 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -70,7 +70,7 @@ mdoc_iscdelim(char p)
{
switch (p) {
- case('|'): /* FIXME! */
+ case('|'):
/* FALLTHROUGH */
case('('):
/* FALLTHROUGH */
@@ -104,11 +104,17 @@ int
mdoc_isdelim(const char *p)
{
- if (0 == *p)
+ if ('\0' == p[0])
return(0);
- if (0 != *(p + 1))
- return(0);
- return(mdoc_iscdelim(*p));
+ if ('\0' == p[1])
+ return(mdoc_iscdelim(p[0]));
+
+ /*
+ * XXX; account for groff bubu where the \*(Ba reserved string
+ * 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"));
}