]> git.cameronkatri.com Git - mandoc.git/blobdiff - argv.c
Removed unnecessary test cases (most were for visual).
[mandoc.git] / argv.c
diff --git a/argv.c b/argv.c
index fd32241d905852d6114d926e095efeb8b7e6dd03..a2d6260803baadb73037418efe626adc2547d8b8 100644 (file)
--- a/argv.c
+++ b/argv.c
@@ -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>
  *
 /*
  * 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. */
 
 
        /* 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. */
                *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)++;
                        }
                                }
                                (*pos)++;
                        }
-               else
-                       while (buf[*pos] && ! isspace(buf[*pos]))
+               else {
+                       while (buf[*pos]) {
+                               if (isspace(buf[*pos]))
+                                       if ('\\' != buf[*pos - 1])
+                                               break;
                                (*pos)++;
                                (*pos)++;
+                       }
+               }
 
                if (0 == buf[*pos])
                        return(ARGS_WORD);
 
                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;
 
        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)++;
                (*pos)++;
+       }
 
        if (buf[*pos])
                buf[(*pos)++] = 0;
 
        if (buf[*pos])
                buf[(*pos)++] = 0;