summaryrefslogtreecommitdiffstats
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
commit28f9fee25bc0d8859b0400d14433644687182bfb (patch)
tree5dc36e4ffc02fad26843da2c5000a69caab6f42f /mandoc.c
parent0d4d66664cc5e466a53a90e48693b01d4f071cbc (diff)
downloadmandoc-28f9fee25bc0d8859b0400d14433644687182bfb.tar.gz
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.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/mandoc.c b/mandoc.c
index 6ca21577..86000415 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -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);