aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-04-19 16:38:48 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-04-19 16:38:48 +0000
commit33c39adb2b4cab7469a2d975f4437c5ea1906a51 (patch)
treee74241a62d295a3c5737e4ec93a01c546460a1a0 /mandoc.c
parent9401becf4a6af1e874c79bccb992847aad44da62 (diff)
downloadmandoc-33c39adb2b4cab7469a2d975f4437c5ea1906a51.tar.gz
mandoc-33c39adb2b4cab7469a2d975f4437c5ea1906a51.tar.zst
mandoc-33c39adb2b4cab7469a2d975f4437c5ea1906a51.zip
Clean up parsing of delimiters in -mdoc. First, remove the "dowarn"
variable from mandoc_getarg() so that it prints the warning every time. Then, remove the warning from args_checkpunct(). This way, warnings are being posted at the correct time. This makes the flag argument to mdoc_zargs() superfluous, so make it be zero when it's invoked. Finally, move the args() flags into mdoc_argv.c and make them enums.
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/mandoc.c b/mandoc.c
index ca73afd7..2d325aaf 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.47 2011/04/17 09:08:19 kristaps Exp $ */
+/* $Id: mandoc.c,v 1.48 2011/04/19 16:38:48 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -95,15 +95,6 @@ numescape(const char *start)
return(++i);
}
-/*
- * Handle an escaped sequeence. This should be called with any
- * string subsequent a `\'. Pass a pointer to this substring as "end";
- * it will be set to the supremum of the parsed escape sequence. If
- * this returns ESCAPE_ERROR, the string is bogus and should be thrown
- * away. If not ESCAPE_ERROR or ESCAPE_IGNORE, "start" is set to the
- * first relevant character of the substring (font, glyph, whatever) of
- * length sz. Both "start" and "sz" may be NULL.
- */
enum mandoc_esc
mandoc_escape(const char **end, const char **start, int *sz)
{
@@ -460,8 +451,7 @@ 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 dowarn, int *pos)
+mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
{
char *start, *cp;
int quoted, pairs, white;
@@ -508,7 +498,7 @@ mandoc_getarg(struct mparse *parse,
}
/* Quoted argument without a closing quote. */
- if (dowarn && 1 == quoted)
+ if (1 == quoted)
mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL);
/* Null-terminate this argument and move to the next one. */
@@ -522,7 +512,7 @@ mandoc_getarg(struct mparse *parse,
*pos += (int)(cp - start) + (quoted ? 1 : 0);
*cpp = cp;
- if (dowarn && '\0' == *cp && (white || ' ' == cp[-1]))
+ if ('\0' == *cp && (white || ' ' == cp[-1]))
mandoc_msg(MANDOCERR_EOLNSPACE, parse, ln, *pos, NULL);
return(start);