diff options
author | 2011-03-20 16:02:05 +0000 | |
---|---|---|
committer | 2011-03-20 16:02:05 +0000 | |
commit | 71ddcd873082a3c68ed2be7b7661075fb09d5849 (patch) | |
tree | 7eb75a067079e8a591b76791b56f0b7673b109d5 /mandoc.c | |
parent | 58ca7d3112e5d39b93ab732cf103b4b0b834b106 (diff) | |
download | mandoc-71ddcd873082a3c68ed2be7b7661075fb09d5849.tar.gz mandoc-71ddcd873082a3c68ed2be7b7661075fb09d5849.tar.zst mandoc-71ddcd873082a3c68ed2be7b7661075fb09d5849.zip |
Consolidate messages. Have all parse-time messages (in libmdoc,
libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the
time being in libmandoc.h. This requires struct mparse to be passed
into the allocation routines instead of mandocmsg and a void pointer.
Then, move some of the functionality of the old mmsg() into read.c's
mparse_mmsg() (check against wlevel and setting of file_status) and use
main.c's mmsg() as simply a printing tool.
Diffstat (limited to 'mandoc.c')
-rw-r--r-- | mandoc.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.41 2011/03/17 09:18:12 kristaps Exp $ */ +/* $Id: mandoc.c,v 1.42 2011/03/20 16:02:05 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -296,7 +296,7 @@ mandoc_strdup(const char *ptr) * or to the null byte terminating the argument line. */ char * -mandoc_getarg(char **cpp, mandocmsg msg, void *data, int ln, int *pos) +mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) { char *start, *cp; int quoted, pairs, white; @@ -343,8 +343,8 @@ mandoc_getarg(char **cpp, mandocmsg msg, void *data, int ln, int *pos) } /* Quoted argument without a closing quote. */ - if (1 == quoted && msg) - (*msg)(MANDOCERR_BADQUOTE, data, ln, *pos, NULL); + if (1 == quoted) + mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL); /* Null-terminate this argument and move to the next one. */ if (pairs) @@ -357,8 +357,8 @@ mandoc_getarg(char **cpp, mandocmsg msg, void *data, int ln, int *pos) *pos += (int)(cp - start) + (quoted ? 1 : 0); *cpp = cp; - if ('\0' == *cp && msg && (white || ' ' == cp[-1])) - (*msg)(MANDOCERR_EOLNSPACE, data, ln, *pos, NULL); + if ('\0' == *cp && (white || ' ' == cp[-1])) + mandoc_msg(MANDOCERR_EOLNSPACE, parse, ln, *pos, NULL); return(start); } @@ -416,20 +416,20 @@ fail: } char * -mandoc_normdate(char *in, mandocmsg msg, void *data, int ln, int pos) +mandoc_normdate(struct mparse *parse, char *in, int ln, int pos) { char *out; time_t t; if (NULL == in || '\0' == *in || 0 == strcmp(in, "$" "Mdocdate$")) { - (*msg)(MANDOCERR_NODATE, data, ln, pos, NULL); + mandoc_msg(MANDOCERR_NODATE, parse, ln, pos, NULL); time(&t); } else if (!a2time(&t, "$" "Mdocdate: %b %d %Y $", in) && !a2time(&t, "%b %d, %Y", in) && !a2time(&t, "%Y-%m-%d", in)) { - (*msg)(MANDOCERR_BADDATE, data, ln, pos, NULL); + mandoc_msg(MANDOCERR_BADDATE, parse, ln, pos, NULL); t = 0; } out = t ? time2a(t) : NULL; |