diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-03-20 16:02:05 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-03-20 16:02:05 +0000 |
commit | 80339b751a1833d9bbbf9856e7f48f56d91ba1d3 (patch) | |
tree | 4e59124e25202b7fa3543b670ae8434c1256cd45 /mandoc.c | |
parent | 7ff718a5d9d20e97b6431bb61dc4cb34a1f431c7 (diff) | |
download | mandoc-80339b751a1833d9bbbf9856e7f48f56d91ba1d3.tar.gz |
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 | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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; |