summaryrefslogtreecommitdiff
path: root/mdoc2man.awk
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc2man.awk')
-rw-r--r--mdoc2man.awk18
1 files changed, 17 insertions, 1 deletions
diff --git a/mdoc2man.awk b/mdoc2man.awk
index d6eaf4601..9d1126769 100644
--- a/mdoc2man.awk
+++ b/mdoc2man.awk
@@ -1,6 +1,9 @@
1#!/usr/bin/awk 1#!/usr/bin/awk
2# 2#
3# $Id: mdoc2man.awk,v 1.8 2007/06/05 10:01:16 dtucker Exp $
4#
3# Version history: 5# Version history:
6# v4+ Adapted for OpenSSH Portable (see cvs Id and history)
4# v3, I put the program under a proper license 7# v3, I put the program under a proper license
5# Dan Nelson <dnelson@allantgroup.com> added .An, .Aq and fixed a typo 8# Dan Nelson <dnelson@allantgroup.com> added .An, .Aq and fixed a typo
6# v2, fixed to work on GNU awk --posix and MacOS X 9# v2, fixed to work on GNU awk --posix and MacOS X
@@ -135,6 +138,12 @@ function add(str) {
135 nospace=0 138 nospace=0
136 } 139 }
137 if(match(words[w],"^Dd$")) { 140 if(match(words[w],"^Dd$")) {
141 if(match(words[w+1],"^\\$Mdocdate:")) {
142 w++;
143 if(match(words[w+4],"^\\$$")) {
144 words[w+4] = ""
145 }
146 }
138 date=wtail() 147 date=wtail()
139 next 148 next
140 } else if(match(words[w],"^Dt$")) { 149 } else if(match(words[w],"^Dt$")) {
@@ -157,6 +166,7 @@ function add(str) {
157 refissue="" 166 refissue=""
158 refdate="" 167 refdate=""
159 refopt="" 168 refopt=""
169 refreport=""
160 reference=1 170 reference=1
161 next 171 next
162 } else if(match(words[w],"^Re$")) { 172 } else if(match(words[w],"^Re$")) {
@@ -168,9 +178,14 @@ function add(str) {
168 } 178 }
169 if(nrefauthors>1) 179 if(nrefauthors>1)
170 add(" and ") 180 add(" and ")
171 add(refauthors[0] ", \\fI" reftitle "\\fP") 181 if(nrefauthors>0)
182 add(refauthors[0] ", ")
183 add("\\fI" reftitle "\\fP")
172 if(length(refissue)) 184 if(length(refissue))
173 add(", " refissue) 185 add(", " refissue)
186 if(length(refreport)) {
187 add(", " refreport)
188 }
174 if(length(refdate)) 189 if(length(refdate))
175 add(", " refdate) 190 add(", " refdate)
176 if(length(refopt)) 191 if(length(refopt))
@@ -187,6 +202,7 @@ function add(str) {
187 if(match(words[w],"^%N$")) { refissue=wtail() } 202 if(match(words[w],"^%N$")) { refissue=wtail() }
188 if(match(words[w],"^%D$")) { refdate=wtail() } 203 if(match(words[w],"^%D$")) { refdate=wtail() }
189 if(match(words[w],"^%O$")) { refopt=wtail() } 204 if(match(words[w],"^%O$")) { refopt=wtail() }
205 if(match(words[w],"^%R$")) { refreport=wtail() }
190 } else if(match(words[w],"^Nm$")) { 206 } else if(match(words[w],"^Nm$")) {
191 if(synopsis) { 207 if(synopsis) {
192 add(".br") 208 add(".br")