=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/read.c,v retrieving revision 1.150 retrieving revision 1.151 diff -u -r1.150 -r1.151 --- src/usr.bin/mandoc/read.c 2017/06/17 23:06:43 1.150 +++ src/usr.bin/mandoc/read.c 2017/06/24 14:38:28 1.151 @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.150 2017/06/17 23:06:43 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.151 2017/06/24 14:38:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -49,10 +49,10 @@ const char *file; /* filename of current input file */ struct buf *primary; /* buffer currently being parsed */ struct buf *secondary; /* preprocessed copy of input */ - const char *defos; /* default operating system */ + const char *os_s; /* default operating system */ mandocmsg mmsg; /* warning/error message handler */ enum mandoclevel file_status; /* status of current parse */ - enum mandoclevel wlevel; /* ignore messages below this */ + enum mandocerr mmin; /* ignore messages below this */ int options; /* parser options */ int gzip; /* current input file is gzipped */ int filenc; /* encoding of the current file */ @@ -82,12 +82,15 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "ok", - "generic style suggestion", + "base system convention", "Mdocdate found", "Mdocdate missing", - "legacy man(7) date format", "RCS id missing", + + "generic style suggestion", + + "legacy man(7) date format", "duplicate RCS id", "useless macro", "consider using OS macro", @@ -738,20 +741,20 @@ } struct mparse * -mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg, - const char *defos) +mparse_alloc(int options, enum mandocerr mmin, mandocmsg mmsg, + enum mandoc_os os_e, const char *os_s) { struct mparse *curp; curp = mandoc_calloc(1, sizeof(struct mparse)); curp->options = options; - curp->wlevel = wlevel; + curp->mmin = mmin; curp->mmsg = mmsg; - curp->defos = defos; + curp->os_s = os_s; curp->roff = roff_alloc(curp, options); - curp->man = roff_man_alloc( curp->roff, curp, curp->defos, + curp->man = roff_man_alloc(curp->roff, curp, curp->os_s, curp->options & MPARSE_QUICK ? 1 : 0); if (curp->options & MPARSE_MDOC) { curp->man->macroset = MACROSET_MDOC; @@ -763,6 +766,7 @@ curp->man->manmac = roffhash_alloc(MAN_TH, MAN_MAX); } curp->man->first->tok = TOKEN_NONE; + curp->man->meta.os_e = os_e; return curp; } @@ -838,12 +842,12 @@ { enum mandoclevel level; + if (er < m->mmin && er != MANDOCERR_FILE) + return; + level = MANDOCLEVEL_UNSUPP; while (er < mandoclimits[level]) level--; - - if (level < m->wlevel && er != MANDOCERR_FILE) - return; if (m->mmsg) (*m->mmsg)(er, level, m->file, ln, col, msg);