From 3a57b035c09a784e5ce7ada2b1a4ce22ed7320fe Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 17 Apr 2011 09:08:19 +0000 Subject: Get mdoc_argv.c ready to use [some of] mandoc_getarg() by giving said function a parameter to suppress warnings. --- mandoc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'mandoc.c') diff --git a/mandoc.c b/mandoc.c index 4b2bd3f3..6ca21577 100644 --- a/mandoc.c +++ b/mandoc.c @@ -460,18 +460,19 @@ mandoc_strdup(const char *ptr) * or to the null byte terminating the argument line. */ char * -mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) +mandoc_getarg(struct mparse *parse, + char **cpp, int ln, int dowarn, int *pos) { char *start, *cp; int quoted, pairs, white; /* Quoting can only start with a new word. */ start = *cpp; + quoted = 0; if ('"' == *start) { quoted = 1; start++; - } else - quoted = 0; + } pairs = 0; white = 0; @@ -507,7 +508,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) } /* Quoted argument without a closing quote. */ - if (1 == quoted) + if (dowarn && 1 == quoted) mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL); /* Null-terminate this argument and move to the next one. */ @@ -521,7 +522,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) *pos += (int)(cp - start) + (quoted ? 1 : 0); *cpp = cp; - if ('\0' == *cp && (white || ' ' == cp[-1])) + if (dowarn && '\0' == *cp && (white || ' ' == cp[-1])) mandoc_msg(MANDOCERR_EOLNSPACE, parse, ln, *pos, NULL); return(start); -- cgit