=================================================================== RCS file: /cvs/mandoc/mdoc_argv.c,v retrieving revision 1.98 retrieving revision 1.101 diff -u -p -r1.98 -r1.101 --- mandoc/mdoc_argv.c 2014/11/28 23:21:32 1.98 +++ mandoc/mdoc_argv.c 2015/04/02 21:36:50 1.101 @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_argv.c,v 1.98 2014/11/28 23:21:32 schwarze Exp $ */ +/* $Id: mdoc_argv.c,v 1.101 2015/04/02 21:36:50 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2012, 2014 Ingo Schwarze @@ -7,9 +7,9 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF @@ -24,11 +24,12 @@ #include #include -#include "mdoc.h" -#include "mandoc.h" #include "mandoc_aux.h" -#include "libmdoc.h" +#include "mandoc.h" +#include "roff.h" +#include "mdoc.h" #include "libmandoc.h" +#include "libmdoc.h" #define MULTI_STEP 5 /* pre-allocate argument values */ #define DELIMSZ 6 /* max possible size of a delimiter */ @@ -339,7 +340,7 @@ mdoc_argv(struct mdoc *mdoc, int line, enum mdoct tok, /* Parse the arguments of the flag. */ tmpv.line = line; - tmpv.pos = ipos; + tmpv.pos = *pos; tmpv.sz = 0; tmpv.value = NULL; @@ -412,22 +413,17 @@ argn_free(struct mdoc_arg *p, int iarg) } enum margserr -mdoc_zargs(struct mdoc *mdoc, int line, int *pos, char *buf, char **v) -{ - - return(args(mdoc, line, pos, buf, ARGSFL_NONE, v)); -} - -enum margserr mdoc_args(struct mdoc *mdoc, int line, int *pos, char *buf, enum mdoct tok, char **v) { - enum argsflag fl; struct mdoc_node *n; + char *v_local; + enum argsflag fl; - fl = mdocargs[tok].flags; - - if (MDOC_It != tok) + if (v == NULL) + v = &v_local; + fl = tok == MDOC_MAX ? ARGSFL_NONE : mdocargs[tok].flags; + if (tok != MDOC_It) return(args(mdoc, line, pos, buf, fl, v)); /*