]> git.cameronkatri.com Git - mandoc.git/blobdiff - argv.c
-diag fixed (allows quoted parameters)
[mandoc.git] / argv.c
diff --git a/argv.c b/argv.c
index 85afbb9e03070c2dd1ac54469dc711e379a8d11f..413f5deeb14e9df0304296849ac59e26be7c6daf 100644 (file)
--- a/argv.c
+++ b/argv.c
@@ -1,4 +1,4 @@
-/* $Id: argv.c,v 1.32 2009/02/26 14:56:27 kristaps Exp $ */
+/* $Id: argv.c,v 1.35 2009/03/03 22:28:21 kristaps Exp $ */
 /*
  * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
  *
 /*
  * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -251,11 +251,19 @@ mdoc_args(struct mdoc *mdoc, int line,
 
                /* LINTED */
                for (i = 0; i < c; i++) {
 
                /* LINTED */
                for (i = 0; i < c; i++) {
-                       if (MDOC_Column != n->data.block.argv[i].arg)
-                               continue;
-                       fl |= ARGS_TABSEP;
-                       fl &= ~ARGS_DELIM;
-                       break;
+                       switch (n->data.block.argv[i].arg) {
+                       case (MDOC_Column):
+                               fl |= ARGS_TABSEP;
+                               fl &= ~ARGS_DELIM;
+                               i = c;
+                               break;
+                       case (MDOC_Diag):
+                               fl |= ARGS_QUOTED;
+                               i = c;
+                               break;
+                       default:
+                               break;
+                       }
                }
        }
 
                }
        }
 
@@ -294,6 +302,10 @@ args(struct mdoc *mdoc, int line,
                        if ( ! mdoc_iscdelim(buf[i]))
                                break;
                        i++;
                        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++;
                }
                        while (buf[i] && isspace((int)buf[i]))
                                i++;
                }
@@ -372,7 +384,7 @@ args(struct mdoc *mdoc, int line,
                                        p++;
                                if (0 != *p)
                                        *(p - 1) = 0;
                                        p++;
                                if (0 != *p)
                                        *(p - 1) = 0;
-                               *pos += p - *v;
+                               *pos += (int)(p - *v);
                        } 
 
                        if (p && 0 == *p)
                        } 
 
                        if (p && 0 == *p)
@@ -393,7 +405,7 @@ args(struct mdoc *mdoc, int line,
                        if (p > *v && ' ' == *(p - 1))
                                if ( ! pwarn(mdoc, line, *pos, WTAILWS))
                                        return(0);
                        if (p > *v && ' ' == *(p - 1))
                                if ( ! pwarn(mdoc, line, *pos, WTAILWS))
                                        return(0);
-                       *pos += p - *v;
+                       *pos += (int)(p - *v);
 
                        return(ARGS_WORD);
                } 
 
                        return(ARGS_WORD);
                } 
@@ -647,7 +659,7 @@ argv_multi(struct mdoc *mdoc, int line,
                        return(0);
                } else if (ARGS_EOLN == c)
                        break;
                        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)
        }
 
        if (0 < v->sz && v->sz < MDOC_LINEARG_MAX)