summaryrefslogtreecommitdiffstats
path: root/argv.c
diff options
context:
space:
mode:
Diffstat (limited to 'argv.c')
-rw-r--r--argv.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/argv.c b/argv.c
index 1fa3ca34..9c37bf2c 100644
--- a/argv.c
+++ b/argv.c
@@ -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;