diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-19 17:02:58 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-01-19 17:02:58 +0000 |
commit | 4d0e00fc396f69ea4575cca04855817cbf289670 (patch) | |
tree | e722af6824f2dd2609f6df0ee9b5b3da4f0ad6be /argv.c | |
parent | efab70236b25559a1c5375d7071cbd2c4f4a5bd1 (diff) | |
download | mandoc-4d0e00fc396f69ea4575cca04855817cbf289670.tar.gz mandoc-4d0e00fc396f69ea4575cca04855817cbf289670.tar.zst mandoc-4d0e00fc396f69ea4575cca04855817cbf289670.zip |
Removed unnecessary test cases (most were for visual).
Finally fixed scope-rewinding (MDOC_VALID).
Diffstat (limited to 'argv.c')
-rw-r--r-- | argv.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: argv.c,v 1.16 2009/01/17 20:10:36 kristaps Exp $ */ +/* $Id: argv.c,v 1.17 2009/01/19 17:02:58 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se> * @@ -78,7 +78,8 @@ mdoc_args(struct mdoc *mdoc, int line, int *pos, char *buf, int fl, char **v) /* Parse routine for non-quoted string. */ - if ('\"' != buf[*pos]) { + assert(*pos > 0); + if ('\"' != buf[*pos] || ! (ARGS_QUOTED & fl)) { *v = &buf[*pos]; /* FIXME: UGLY tab-sep processing. */ @@ -98,9 +99,14 @@ mdoc_args(struct mdoc *mdoc, int line, int *pos, char *buf, int fl, char **v) } (*pos)++; } - else - while (buf[*pos] && ! isspace(buf[*pos])) + else { + while (buf[*pos]) { + if (isspace(buf[*pos])) + if ('\\' != buf[*pos - 1]) + break; (*pos)++; + } + } if (0 == buf[*pos]) return(ARGS_WORD); @@ -451,8 +457,13 @@ mdoc_argv(struct mdoc *mdoc, int line, int tok, v->line = line; v->pos = *pos; - while (buf[*pos] && ! isspace(buf[*pos])) + assert(*pos > 0); + while (buf[*pos]) { + if (isspace(buf[*pos])) + if ('\\' != buf[*pos - 1]) + break; (*pos)++; + } if (buf[*pos]) buf[(*pos)++] = 0; |