summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_term.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-04-11 17:10:35 +0000
committerschwarze <schwarze@openbsd.org>2018-04-11 17:10:35 +0000
commit4c2938735c8645bf013bba2aadf2b593401b76b2 (patch)
treebd18d208ac85fca83b2a9412e92e7dc15fbcc551 /usr.bin/mandoc/man_term.c
parentThe pledge flag for file descriptors opened from /dev/fd was always (diff)
downloadwireguard-openbsd-4c2938735c8645bf013bba2aadf2b593401b76b2.tar.xz
wireguard-openbsd-4c2938735c8645bf013bba2aadf2b593401b76b2.zip
preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
Diffstat (limited to 'usr.bin/mandoc/man_term.c')
-rw-r--r--usr.bin/mandoc/man_term.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 6fd2368e13c..839230e10d5 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: man_term.c,v 1.162 2017/07/31 15:18:59 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.163 2018/04/11 17:10:35 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -673,7 +673,8 @@ pre_SS(DECL_ARGS)
n = n->prev;
} while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
- if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
+ if (n == NULL || n->type == ROFFT_COMMENT ||
+ (n->tok == MAN_SS && n->body->child == NULL))
break;
for (i = 0; i < mt->pardist; i++)
@@ -735,7 +736,8 @@ pre_SH(DECL_ARGS)
n = n->prev;
} while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
- if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
+ if (n == NULL || n->type == ROFFT_COMMENT ||
+ (n->tok == MAN_SH && n->body->child == NULL))
break;
for (i = 0; i < mt->pardist; i++)
@@ -883,7 +885,8 @@ print_man_node(DECL_ARGS)
term_word(p, n->string);
goto out;
-
+ case ROFFT_COMMENT:
+ return;
case ROFFT_EQN:
if ( ! (n->flags & NODE_LINE))
p->flags |= TERMP_NOSPACE;