diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-07-12 18:28:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2009-07-12 18:28:30 +0000 |
commit | ae0dec660f7fb4cba537af9de518acbccd8cff23 (patch) | |
tree | 1c832d4da0a532fde6ccafd890ded5d39ef45250 /usr.bin/mandoc | |
parent | 8781d26cf21fdd1ff882384d7aa4ca9666444a13 (diff) |
sync to 1.7.23: first step to get rid of enum mdoc_warn:
unify manwarn() and mdocwarn() into mwarn()
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/main.c | 52 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 9 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.h | 5 |
3 files changed, 14 insertions, 52 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 74d2d5bee27..d9d1fc6868c 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.11 2009/07/07 00:54:46 schwarze Exp $ */ +/* $Id: main.c,v 1.12 2009/07/12 18:28:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -85,9 +85,7 @@ static int toptions(enum outt *, char *); static int moptions(enum intt *, char *); static int woptions(int *, char *); static int merr(void *, int, int, const char *); -static int manwarn(void *, int, int, const char *); -static int mdocwarn(void *, int, int, - enum mdoc_warn, const char *); +static int mwarn(void *, int, int, const char *); static int ffile(struct buf *, struct buf *, const char *, struct curparse *); static int fdesc(struct buf *, struct buf *, @@ -215,7 +213,7 @@ man_init(struct curparse *curp) struct man_cb mancb; mancb.man_err = merr; - mancb.man_warn = manwarn; + mancb.man_warn = mwarn; /* Defaults from mandoc.1. */ @@ -243,7 +241,7 @@ mdoc_init(struct curparse *curp) struct mdoc_cb mdoccb; mdoccb.mdoc_err = merr; - mdoccb.mdoc_warn = mdocwarn; + mdoccb.mdoc_warn = mwarn; /* Defaults from mandoc.1. */ @@ -632,31 +630,17 @@ merr(void *arg, int line, int col, const char *msg) static int -mdocwarn(void *arg, int line, int col, - enum mdoc_warn type, const char *msg) +mwarn(void *arg, int line, int col, const char *msg) { struct curparse *curp; - char *wtype; curp = (struct curparse *)arg; - wtype = NULL; - switch (type) { - case (WARN_COMPAT): - wtype = "compat"; - if (curp->wflags & WARN_WCOMPAT) - break; - return(1); - case (WARN_SYNTAX): - wtype = "syntax"; - if (curp->wflags & WARN_WSYNTAX) - break; + if ( ! (curp->wflags & WARN_WALL)) return(1); - } - assert(wtype); - warnx("%s:%d: %s warning: %s (column %d)", - curp->file, line, wtype, msg, col); + warnx("%s:%d: warning: %s (column %d)", + curp->file, line, msg, col); if ( ! (curp->wflags & WARN_WERR)) return(1); @@ -665,23 +649,3 @@ mdocwarn(void *arg, int line, int col, return(0); } - -static int -manwarn(void *arg, int line, int col, const char *msg) -{ - struct curparse *curp; - - curp = (struct curparse *)arg; - - if ( ! (curp->wflags & WARN_WSYNTAX)) - return(1); - - warnx("%s:%d: syntax warning: %s (column %d)", - curp->file, line, msg, col); - - if ( ! (curp->wflags & WARN_WERR)) - return(1); - - warnx("considering warnings as errors"); - return(0); -} diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 3c17dffc83f..89892c15350 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.10 2009/06/23 23:02:54 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.11 2009/07/12 18:28:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -276,7 +276,7 @@ mdoc_vwarn(struct mdoc *mdoc, int ln, int pos, va_start(ap, fmt); (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap); va_end(ap); - return((*mdoc->cb.mdoc_warn)(mdoc->data, ln, pos, type, buf)); + return((*mdoc->cb.mdoc_warn)(mdoc->data, ln, pos, buf)); } @@ -312,7 +312,7 @@ mdoc_warn(struct mdoc *mdoc, enum mdoc_warn type, (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap); va_end(ap); return((*mdoc->cb.mdoc_warn)(mdoc->data, mdoc->last->line, - mdoc->last->pos, type, buf)); + mdoc->last->pos, buf)); } @@ -346,8 +346,7 @@ mdoc_pwarn(struct mdoc *mdoc, int line, int pos, enum mdoc_warn type, va_start(ap, fmt); (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap); va_end(ap); - return((*mdoc->cb.mdoc_warn)(mdoc->data, - line, pos, type, buf)); + return((*mdoc->cb.mdoc_warn)(mdoc->data, line, pos, buf)); } int diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h index e15857fdeda..e81c2970df2 100644 --- a/usr.bin/mandoc/mdoc.h +++ b/usr.bin/mandoc/mdoc.h @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.7 2009/06/23 23:02:54 schwarze Exp $ */ +/* $Id: mdoc.h,v 1.8 2009/07/12 18:28:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -279,8 +279,7 @@ struct mdoc_node { /* FIXME: unify somehow with man_cb. */ struct mdoc_cb { int (*mdoc_err)(void *, int, int, const char *); - int (*mdoc_warn)(void *, int, int, - enum mdoc_warn, const char *); + int (*mdoc_warn)(void *, int, int, const char *); }; /* See mdoc.3 for documentation. */ |