summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-12-31 07:45:42 +0000
committerschwarze <schwarze@openbsd.org>2018-12-31 07:45:42 +0000
commitb8223a526f40caacf2133eb95f2b4a9f57da8cf6 (patch)
tree2f449fcb3d836172a7d5ff44cf0bd50e5afdec2b
parentMove parsing of the .nf and .fi (fill mode) requests from the man(7) (diff)
downloadwireguard-openbsd-b8223a526f40caacf2133eb95f2b4a9f57da8cf6.tar.xz
wireguard-openbsd-b8223a526f40caacf2133eb95f2b4a9f57da8cf6.zip
Cleanup, no functional change:
Use the new parser flag ROFF_NOFILL in the mdoc(7) parser, too, instead of the old MDOC_LITERAL, which was an alias for the former MAN_LITERAL.
-rw-r--r--usr.bin/mandoc/mdoc.c8
-rw-r--r--usr.bin/mandoc/mdoc_state.c6
-rw-r--r--usr.bin/mandoc/mdoc_validate.c6
-rw-r--r--usr.bin/mandoc/roff_int.h3
4 files changed, 11 insertions, 12 deletions
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 1ecb0773e07..a24da770c1a 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc.c,v 1.162 2018/12/31 04:55:42 schwarze Exp $ */
+/* $OpenBSD: mdoc.c,v 1.163 2018/12/31 07:45:42 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -208,7 +208,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
* Strip trailing tabs in literal context only;
* outside, they affect the next line.
*/
- if (MDOC_LITERAL & mdoc->flags)
+ if (mdoc->flags & ROFF_NOFILL)
continue;
break;
case '\\':
@@ -233,7 +233,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
* but add a single vertical space elsewhere.
*/
- if (buf[offs] == '\0' && ! (mdoc->flags & MDOC_LITERAL)) {
+ if (buf[offs] == '\0' && (mdoc->flags & ROFF_NOFILL) == 0) {
switch (mdoc->last->type) {
case ROFFT_TEXT:
sp = mdoc->last->string;
@@ -258,7 +258,7 @@ mdoc_ptext(struct roff_man *mdoc, int line, char *buf, int offs)
roff_word_alloc(mdoc, line, offs, buf+offs);
- if (mdoc->flags & MDOC_LITERAL)
+ if (mdoc->flags & ROFF_NOFILL)
return 1;
/*
diff --git a/usr.bin/mandoc/mdoc_state.c b/usr.bin/mandoc/mdoc_state.c
index 34718dcc8c1..8f28958225a 100644
--- a/usr.bin/mandoc/mdoc_state.c
+++ b/usr.bin/mandoc/mdoc_state.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_state.c,v 1.13 2018/12/31 04:55:42 schwarze Exp $ */
+/* $OpenBSD: mdoc_state.c,v 1.14 2018/12/31 07:45:42 schwarze Exp $ */
/*
* Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -228,10 +228,10 @@ state_dl(STATE_ARGS)
switch (n->type) {
case ROFFT_HEAD:
- mdoc->flags |= MDOC_LITERAL;
+ mdoc->flags |= ROFF_NOFILL;
break;
case ROFFT_BODY:
- mdoc->flags &= ~MDOC_LITERAL;
+ mdoc->flags &= ~ROFF_NOFILL;
break;
default:
break;
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 8ac38a2a6a8..9c71ca70078 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.282 2018/12/31 04:55:42 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.283 2018/12/31 07:45:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -336,7 +336,7 @@ mdoc_validate(struct roff_man *mdoc)
check_text(mdoc, n->line, n->pos, n->string);
if (np->tok != MDOC_Ql && np->tok != MDOC_Dl &&
(np->tok != MDOC_Bd ||
- (mdoc->flags & MDOC_LITERAL) == 0) &&
+ (mdoc->flags & ROFF_NOFILL) == 0) &&
(np->tok != MDOC_It || np->type != ROFFT_HEAD ||
np->parent->parent->norm->Bl.type != LIST_diag))
check_text_em(mdoc, n->line, n->pos, n->string);
@@ -409,7 +409,7 @@ check_text(struct roff_man *mdoc, int ln, int pos, char *p)
{
char *cp;
- if (MDOC_LITERAL & mdoc->flags)
+ if (mdoc->flags & ROFF_NOFILL)
return;
for (cp = p; NULL != (p = strchr(p, '\t')); p++)
diff --git a/usr.bin/mandoc/roff_int.h b/usr.bin/mandoc/roff_int.h
index b6386b83d4f..5b99cfda3f4 100644
--- a/usr.bin/mandoc/roff_int.h
+++ b/usr.bin/mandoc/roff_int.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_int.h,v 1.14 2018/12/31 07:07:43 schwarze Exp $ */
+/* $OpenBSD: roff_int.h,v 1.15 2018/12/31 07:45:42 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -54,7 +54,6 @@ struct roff_man {
#define MDOC_PHRASEQF (1 << 13) /* Quote first word encountered. */
#define MDOC_PHRASEQL (1 << 14) /* Quote last word of this phrase. */
#define MDOC_PHRASEQN (1 << 15) /* Quote first word of the next phrase. */
-#define MDOC_LITERAL ROFF_NOFILL
#define MAN_NEWLINE MDOC_NEWLINE
enum roff_sec lastsec; /* Last section seen. */
enum roff_sec lastnamed; /* Last standard section seen. */