diff options
author | 2012-04-15 10:31:00 +0000 | |
---|---|---|
committer | 2012-04-15 10:31:00 +0000 | |
commit | 22972b1411a5ab9eeadc0b7d896c3ce4da83f392 (patch) | |
tree | b3757577fa3bd1332e778f73d88bce7663f7796f /usr.bin/mandoc/mdoc_validate.c | |
parent | fix a leak (diff) | |
download | wireguard-openbsd-22972b1411a5ab9eeadc0b7d896c3ce4da83f392.tar.xz wireguard-openbsd-22972b1411a5ab9eeadc0b7d896c3ce4da83f392.zip |
Two bugfixes regarding the -width and -offset macro arguments:
1) They consume the next argument even if it starts with a dash.
2) When -width is the last argument on the line such that the
actual width argument is missing, downgrade from a fatal to a
non-fatal error, just like for -offset. The formatting still
doesn't agree with groff, but at least we don't die any longer.
Item 2 was observed and that part of the patch coded by kristaps@,
who found lots of instances of this particular formatting error
in Mac OSX manuals.
Diffstat (limited to 'usr.bin/mandoc/mdoc_validate.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 85bea2c39d5..75a93f6e094 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,6 +1,6 @@ -/* $Id: mdoc_validate.c,v 1.100 2011/12/03 22:47:27 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.101 2012/04/15 10:31:00 schwarze Exp $ */ /* - * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> + * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -657,8 +657,13 @@ pre_bl(PRE_ARGS) comp = 1; break; case (MDOC_Width): - dup = (NULL != n->norm->Bl.width); - width = n->args->argv[i].value[0]; + /* NB: this can be empty! */ + if (n->args->argv[i].sz) { + width = n->args->argv[i].value[0]; + dup = (NULL != n->norm->Bl.width); + break; + } + mdoc_nmsg(mdoc, n, MANDOCERR_IGNARGV); break; case (MDOC_Offset): /* NB: this can be empty! */ |