]> git.cameronkatri.com Git - mandoc.git/blobdiff - argv.c
Fixed delimiter end-of-line parsing.
[mandoc.git] / argv.c
diff --git a/argv.c b/argv.c
index 663d5d5e3220056bebac506b29f1e433eef605f1..8ad5d662ff223b4d3e4b395cbfdcd3be45bec86c 100644 (file)
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.31 2009/02/24 13:46:54 kristaps Exp $ */
+/* $Id: argv.c,v 1.34 2009/02/28 12:16:02 kristaps Exp $ */
 /*
  * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -74,7 +74,7 @@ static        int mdoc_argflags[MDOC_MAX] = {
        0, /* Ed */
        0, /* Bl */
        0, /* El */
-       ARGS_DELIM, /* It */
+       0, /* It */
        ARGS_DELIM, /* Ad */ 
        ARGS_DELIM, /* An */
        ARGS_DELIM, /* Ar */
@@ -294,6 +294,10 @@ args(struct mdoc *mdoc, int line,
                        if ( ! mdoc_iscdelim(buf[i]))
                                break;
                        i++;
+                       /* There must be at least one space... */
+                       if (0 == buf[i] || ! isspace((int)buf[i]))
+                               break;
+                       i++;
                        while (buf[i] && isspace((int)buf[i]))
                                i++;
                }
@@ -372,7 +376,7 @@ args(struct mdoc *mdoc, int line,
                                        p++;
                                if (0 != *p)
                                        *(p - 1) = 0;
-                               *pos += p - *v;
+                               *pos += (int)(p - *v);
                        } 
 
                        if (p && 0 == *p)
@@ -393,7 +397,7 @@ args(struct mdoc *mdoc, int line,
                        if (p > *v && ' ' == *(p - 1))
                                if ( ! pwarn(mdoc, line, *pos, WTAILWS))
                                        return(0);
-                       *pos += p - *v;
+                       *pos += (int)(p - *v);
 
                        return(ARGS_WORD);
                } 
@@ -647,7 +651,7 @@ argv_multi(struct mdoc *mdoc, int line,
                        return(0);
                } else if (ARGS_EOLN == c)
                        break;
-               v->value[v->sz] = p;
+               v->value[(int)v->sz] = p;
        }
 
        if (0 < v->sz && v->sz < MDOC_LINEARG_MAX)