diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-09 21:06:50 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-09 21:06:50 +0000 |
commit | 189ba0d64a17f066dc69b5c509c0482f6c65327c (patch) | |
tree | 26a39ef73817c8729ab70c8c78dd31c2f5aa3518 | |
parent | 5ff5a51fb08323eaf55f975580b636f10b0bca6f (diff) | |
download | mandoc-189ba0d64a17f066dc69b5c509c0482f6c65327c.tar.gz |
Explicitly account for \*(Ba when checking for delims. Noted by Jason McIntyre via Ingo Schwarze.
-rw-r--r-- | mdoc_argv.c | 11 | ||||
-rw-r--r-- | mdoc_strings.c | 16 |
2 files changed, 17 insertions, 10 deletions
diff --git a/mdoc_argv.c b/mdoc_argv.c index 41d7300b..ea6f8fc4 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -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 0b1847fd..b895cbe9 100644 --- a/mdoc_strings.c +++ b/mdoc_strings.c @@ -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")); } |