version 1.86, 2012/11/18 00:05:35 |
version 1.87, 2013/12/15 23:56:42 |
Line 447 args(struct mdoc *mdoc, int line, int *pos, |
|
Line 447 args(struct mdoc *mdoc, int line, int *pos, |
|
char *buf, enum argsflag fl, char **v) |
char *buf, enum argsflag fl, char **v) |
{ |
{ |
char *p, *pp; |
char *p, *pp; |
|
int pairs; |
enum margserr rc; |
enum margserr rc; |
|
|
if ('\0' == buf[*pos]) { |
if ('\0' == buf[*pos]) { |
Line 540 args(struct mdoc *mdoc, int line, int *pos, |
|
Line 541 args(struct mdoc *mdoc, int line, int *pos, |
|
/* |
/* |
* Process a quoted literal. A quote begins with a double-quote |
* Process a quoted literal. A quote begins with a double-quote |
* and ends with a double-quote NOT preceded by a double-quote. |
* and ends with a double-quote NOT preceded by a double-quote. |
|
* Null-terminate the literal in place. |
|
* Collapse pairs of quotes inside quoted literals. |
* Whitespace is NOT involved in literal termination. |
* Whitespace is NOT involved in literal termination. |
*/ |
*/ |
|
|
Line 550 args(struct mdoc *mdoc, int line, int *pos, |
|
Line 553 args(struct mdoc *mdoc, int line, int *pos, |
|
if (MDOC_PPHRASE & mdoc->flags) |
if (MDOC_PPHRASE & mdoc->flags) |
mdoc->flags |= MDOC_PHRASELIT; |
mdoc->flags |= MDOC_PHRASELIT; |
|
|
|
pairs = 0; |
for ( ; buf[*pos]; (*pos)++) { |
for ( ; buf[*pos]; (*pos)++) { |
|
/* Move following text left after quoted quotes. */ |
|
if (pairs) |
|
buf[*pos - pairs] = buf[*pos]; |
if ('\"' != buf[*pos]) |
if ('\"' != buf[*pos]) |
continue; |
continue; |
|
/* Unquoted quotes end quoted args. */ |
if ('\"' != buf[*pos + 1]) |
if ('\"' != buf[*pos + 1]) |
break; |
break; |
|
/* Quoted quotes collapse. */ |
|
pairs++; |
(*pos)++; |
(*pos)++; |
} |
} |
|
if (pairs) |
|
buf[*pos - pairs] = '\0'; |
|
|
if ('\0' == buf[*pos]) { |
if ('\0' == buf[*pos]) { |
if (MDOC_PPHRASE & mdoc->flags) |
if (MDOC_PPHRASE & mdoc->flags) |