diff options
author | 2018-04-11 17:11:13 +0000 | |
---|---|---|
committer | 2018-04-11 17:11:13 +0000 | |
commit | 0fde2fa390d9a4194f8a09e5c0f5d921d8755109 (patch) | |
tree | 08324b073d43d72772f99a603423e81140da0263 /mdoc_man.c | |
parent | aa23a004eb502cf67af388be4976d369784961db (diff) | |
download | mandoc-0fde2fa390d9a4194f8a09e5c0f5d921d8755109.tar.gz mandoc-0fde2fa390d9a4194f8a09e5c0f5d921d8755109.tar.zst mandoc-0fde2fa390d9a4194f8a09e5c0f5d921d8755109.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 'mdoc_man.c')
-rw-r--r-- | mdoc_man.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,6 +1,6 @@ -/* $Id: mdoc_man.c,v 1.125 2018/04/05 22:05:08 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.126 2018/04/11 17:11:13 schwarze Exp $ */ /* - * Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011-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 @@ -610,6 +610,14 @@ man_mdoc(void *arg, const struct roff_man *mdoc) { struct roff_node *n; + printf(".\\\" Automatically generated from an mdoc input file." + " Do not edit.\n"); + for (n = mdoc->first->child; n != NULL; n = n->next) { + if (n->type != ROFFT_COMMENT) + break; + printf(".\\\"%s\n", n->string); + } + printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", mdoc->meta.title, (mdoc->meta.msec == NULL ? "" : mdoc->meta.msec), @@ -624,7 +632,7 @@ man_mdoc(void *arg, const struct roff_man *mdoc) fontqueue.head = fontqueue.tail = mandoc_malloc(8); *fontqueue.tail = 'R'; } - for (n = mdoc->first->child; n != NULL; n = n->next) + for (; n != NULL; n = n->next) print_node(&mdoc->meta, n); putchar('\n'); } |