diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-05-08 01:52:08 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-05-08 01:52:08 +0000 |
commit | 8e1ec00d78a028b557330f0ede1b9d4d43388bda (patch) | |
tree | ebe337982acfe638a3a2c77ed9b22add3b04feba /usr.bin | |
parent | 7d90ac7f43ce127c37d0aca2698efebff57302c2 (diff) |
handle text lines beginning with \." as comments, like groff does,
even though this is not correct comment syntax (so warn, too)
reported by Claus Assmann on misc@, fix by kristaps@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/libman.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/libmdoc.h | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/man.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 8 |
4 files changed, 18 insertions, 4 deletions
diff --git a/usr.bin/mandoc/libman.h b/usr.bin/mandoc/libman.h index c8c457f7955..7e50e366c15 100644 --- a/usr.bin/mandoc/libman.h +++ b/usr.bin/mandoc/libman.h @@ -1,4 +1,4 @@ -/* $Id: libman.h,v 1.16 2010/04/25 16:32:19 schwarze Exp $ */ +/* $Id: libman.h,v 1.17 2010/05/08 01:52:07 schwarze Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -67,6 +67,7 @@ enum merr { WROFFNEST, WROFFSCOPE, WTITLECASE, + WBADCOMMENT, WERRMAX }; diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h index acbeb51f8c2..196361493ff 100644 --- a/usr.bin/mandoc/libmdoc.h +++ b/usr.bin/mandoc/libmdoc.h @@ -1,4 +1,4 @@ -/* $Id: libmdoc.h,v 1.27 2010/04/07 23:15:05 schwarze Exp $ */ +/* $Id: libmdoc.h,v 1.28 2010/05/08 01:52:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -93,6 +93,7 @@ enum merr { ELIB, EBADCHILD, ENOTYPE, + EBADCOMMENT, MERRMAX }; diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index 24a4c27cfe8..7592c7b0b80 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.25 2010/04/25 16:32:19 schwarze Exp $ */ +/* $Id: man.c,v 1.26 2010/05/08 01:52:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -49,6 +49,7 @@ const char *const __man_merrnames[WERRMAX] = { "invalid nesting of roff declarations", /* WROFFNEST */ "scope in roff instructions broken", /* WROFFSCOPE */ "document title should be uppercase", /* WTITLECASE */ + "deprecated comment style", /* WBADCOMMENT */ }; const char *const __man_macronames[MAN_MAX] = { @@ -391,6 +392,11 @@ man_ptext(struct man *m, int line, char *buf) int i, j; char sv; + /* Ignore bogus comments. */ + + if ('\\' == buf[0] && '.' == buf[1] && '\"' == buf[2]) + return(man_pwarn(m, line, 0, WBADCOMMENT)); + /* Literal free-form text whitespace is preserved. */ if (MAN_LITERAL & m->flags) { diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 374c3b81f4a..53de090517a 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.43 2010/05/04 23:13:54 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.44 2010/05/08 01:52:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -80,6 +80,7 @@ const char *const __mdoc_merrnames[MERRMAX] = { "no description found for library", /* ELIB */ "bad child for parent context", /* EBADCHILD */ "list arguments preceding type", /* ENOTYPE */ + "deprecated comment style", /* EBADCOMMENT */ }; const char *const __mdoc_macronames[MDOC_MAX] = { @@ -630,6 +631,11 @@ parsetext(struct mdoc *m, int line, char *buf) int i, j; char sv; + /* Ignore bogus comments. */ + + if ('\\' == buf[0] && '.' == buf[1] && '\"' == buf[2]) + return(mdoc_pwarn(m, line, 0, EBADCOMMENT)); + if (SEC_NONE == m->lastnamed) return(mdoc_perr(m, line, 0, ETEXTPROL)); |