=================================================================== RCS file: /cvs/mandoc/mdoc_argv.c,v retrieving revision 1.41 retrieving revision 1.43 diff -u -p -r1.41 -r1.43 --- mandoc/mdoc_argv.c 2010/05/07 06:05:38 1.41 +++ mandoc/mdoc_argv.c 2010/05/08 07:30:19 1.43 @@ -1,4 +1,4 @@ -/* $Id: mdoc_argv.c,v 1.41 2010/05/07 06:05:38 kristaps Exp $ */ +/* $Id: mdoc_argv.c,v 1.43 2010/05/08 07:30:19 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -398,7 +398,7 @@ args(struct mdoc *m, int line, int *pos, assert(*pos); assert(' ' != buf[*pos]); - if (0 == buf[*pos]) + if ('\0' == buf[*pos]) return(ARGS_EOLN); /* @@ -441,7 +441,6 @@ args(struct mdoc *m, int line, int *pos, */ if (ARGS_TABSEP & fl) { - rc = ARGS_PHRASE; /* Scan ahead to tab (can't be escaped). */ p = strchr(*v, '\t'); @@ -455,14 +454,19 @@ args(struct mdoc *m, int line, int *pos, break; } + /* By default, assume a phrase. */ + rc = ARGS_PHRASE; + /* * Adjust new-buffer position to be beyond delimiter * mark (e.g., Ta -> end + 2). */ if (p && pp) { *pos += pp < p ? 2 : 1; + rc = pp < p ? ARGS_PHRASE : ARGS_PPHRASE; p = pp < p ? pp : p; } else if (p && ! pp) { + rc = ARGS_PPHRASE; *pos += 1; } else if (pp && ! p) { p = pp; @@ -662,16 +666,16 @@ static int argv_multi(struct mdoc *m, int line, struct mdoc_argv *v, int *pos, char *buf) { - int c; + enum margserr ac; char *p; for (v->sz = 0; ; v->sz++) { if ('-' == buf[*pos]) break; - c = args(m, line, pos, buf, 0, &p); - if (ARGS_ERROR == c) + ac = args(m, line, pos, buf, 0, &p); + if (ARGS_ERROR == ac) return(0); - else if (ARGS_EOLN == c) + else if (ARGS_EOLN == ac) break; if (0 == v->sz % MULTI_STEP) @@ -689,16 +693,16 @@ static int argv_opt_single(struct mdoc *m, int line, struct mdoc_argv *v, int *pos, char *buf) { - int c; + enum margserr ac; char *p; if ('-' == buf[*pos]) return(1); - c = args(m, line, pos, buf, 0, &p); - if (ARGS_ERROR == c) + ac = args(m, line, pos, buf, 0, &p); + if (ARGS_ERROR == ac) return(0); - if (ARGS_EOLN == c) + if (ARGS_EOLN == ac) return(1); v->sz = 1; @@ -716,15 +720,16 @@ static int argv_single(struct mdoc *m, int line, struct mdoc_argv *v, int *pos, char *buf) { - int c, ppos; + int ppos; + enum margserr ac; char *p; ppos = *pos; - c = args(m, line, pos, buf, 0, &p); - if (ARGS_ERROR == c) + ac = args(m, line, pos, buf, 0, &p); + if (ARGS_ERROR == ac) return(0); - if (ARGS_EOLN == c) + if (ARGS_EOLN == ac) return(mdoc_perr(m, line, ppos, EARGVAL)); v->sz = 1;