Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 1 | #!/usr/bin/awk |
| 2 | # |
| 3 | # Version history: |
Darren Tucker | 51e5ab0 | 2007-06-05 19:16:59 +1000 | [diff] [blame] | 4 | # v4+ Adapted for OpenSSH Portable (see cvs Id and history) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 5 | # v3, I put the program under a proper license |
| 6 | # Dan Nelson <dnelson@allantgroup.com> added .An, .Aq and fixed a typo |
| 7 | # v2, fixed to work on GNU awk --posix and MacOS X |
| 8 | # v1, first attempt, didn't work on MacOS X |
| 9 | # |
| 10 | # Copyright (c) 2003 Peter Stuge <stuge-mdoc2man@cdy.org> |
| 11 | # |
| 12 | # Permission to use, copy, modify, and distribute this software for any |
| 13 | # purpose with or without fee is hereby granted, provided that the above |
| 14 | # copyright notice and this permission notice appear in all copies. |
| 15 | # |
| 16 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 17 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 18 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 19 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 20 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 21 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 22 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 23 | |
| 24 | |
| 25 | BEGIN { |
| 26 | optlist=0 |
| 27 | oldoptlist=0 |
| 28 | nospace=0 |
| 29 | synopsis=0 |
| 30 | reference=0 |
| 31 | block=0 |
| 32 | ext=0 |
| 33 | extopt=0 |
| 34 | literal=0 |
| 35 | prenl=0 |
Darren Tucker | d062da5 | 2004-07-02 18:43:09 +1000 | [diff] [blame] | 36 | breakw=0 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 37 | line="" |
| 38 | } |
| 39 | |
| 40 | function wtail() { |
| 41 | retval="" |
| 42 | while(w<nwords) { |
| 43 | if(length(retval)) |
| 44 | retval=retval OFS |
| 45 | retval=retval words[++w] |
| 46 | } |
| 47 | return retval |
| 48 | } |
| 49 | |
| 50 | function add(str) { |
| 51 | for(;prenl;prenl--) |
| 52 | line=line "\n" |
| 53 | line=line str |
| 54 | } |
| 55 | |
| 56 | ! /^\./ { |
| 57 | for(;prenl;prenl--) |
| 58 | print "" |
| 59 | print |
| 60 | if(literal) |
| 61 | print ".br" |
| 62 | next |
| 63 | } |
| 64 | |
| 65 | /^\.\\"/ { next } |
| 66 | |
| 67 | { |
| 68 | option=0 |
| 69 | parens=0 |
| 70 | angles=0 |
| 71 | sub("^\\.","") |
| 72 | nwords=split($0,words) |
| 73 | for(w=1;w<=nwords;w++) { |
| 74 | skip=0 |
| 75 | if(match(words[w],"^Li|Pf$")) { |
| 76 | skip=1 |
| 77 | } else if(match(words[w],"^Xo$")) { |
| 78 | skip=1 |
| 79 | ext=1 |
| 80 | if(length(line)&&!(match(line," $")||prenl)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 81 | add(OFS) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 82 | } else if(match(words[w],"^Xc$")) { |
| 83 | skip=1 |
| 84 | ext=0 |
| 85 | if(!extopt) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 86 | prenl++ |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 87 | w=nwords |
| 88 | } else if(match(words[w],"^Bd$")) { |
| 89 | skip=1 |
| 90 | if(match(words[w+1],"-literal")) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 91 | literal=1 |
| 92 | prenl++ |
| 93 | w=nwords |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 94 | } |
| 95 | } else if(match(words[w],"^Ed$")) { |
| 96 | skip=1 |
| 97 | literal=0 |
| 98 | } else if(match(words[w],"^Ns$")) { |
| 99 | skip=1 |
| 100 | if(!nospace) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 101 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 102 | sub(" $","",line) |
| 103 | } else if(match(words[w],"^No$")) { |
| 104 | skip=1 |
| 105 | sub(" $","",line) |
| 106 | add(words[++w]) |
| 107 | } else if(match(words[w],"^Dq$")) { |
| 108 | skip=1 |
| 109 | add("``") |
| 110 | add(words[++w]) |
| 111 | while(w<nwords&&!match(words[w+1],"^[\\.,]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 112 | add(OFS words[++w]) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 113 | add("''") |
| 114 | if(!nospace&&match(words[w+1],"^[\\.,]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 115 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 116 | } else if(match(words[w],"^Sq|Ql$")) { |
| 117 | skip=1 |
| 118 | add("`" words[++w] "'") |
| 119 | if(!nospace&&match(words[w+1],"^[\\.,]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 120 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 121 | } else if(match(words[w],"^Oo$")) { |
| 122 | skip=1 |
| 123 | extopt=1 |
| 124 | if(!nospace) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 125 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 126 | add("[") |
| 127 | } else if(match(words[w],"^Oc$")) { |
| 128 | skip=1 |
| 129 | extopt=0 |
| 130 | add("]") |
| 131 | } |
| 132 | if(!skip) { |
| 133 | if(!nospace&&length(line)&&!(match(line," $")||prenl)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 134 | add(OFS) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 135 | if(nospace==1) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 136 | nospace=0 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 137 | } |
| 138 | if(match(words[w],"^Dd$")) { |
Darren Tucker | 88bca06 | 2007-06-05 19:30:47 +1000 | [diff] [blame] | 139 | if(match(words[w+1],"^\\$Mdocdate:")) { |
Darren Tucker | 51e5ab0 | 2007-06-05 19:16:59 +1000 | [diff] [blame] | 140 | w++; |
| 141 | if(match(words[w+4],"^\\$$")) { |
| 142 | words[w+4] = "" |
| 143 | } |
| 144 | } |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 145 | date=wtail() |
| 146 | next |
| 147 | } else if(match(words[w],"^Dt$")) { |
| 148 | id=wtail() |
| 149 | next |
Darren Tucker | 6ac91a7 | 2009-10-24 11:52:42 +1100 | [diff] [blame] | 150 | } else if(match(words[w],"^Ux$")) { |
| 151 | add("UNIX") |
| 152 | skip=1 |
Darren Tucker | f561596 | 2005-05-31 16:59:16 +1000 | [diff] [blame] | 153 | } else if(match(words[w],"^Ox$")) { |
| 154 | add("OpenBSD") |
| 155 | skip=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 156 | } else if(match(words[w],"^Os$")) { |
| 157 | add(".TH " id " \"" date "\" \"" wtail() "\"") |
| 158 | } else if(match(words[w],"^Sh$")) { |
| 159 | add(".SH") |
| 160 | synopsis=match(words[w+1],"SYNOPSIS") |
| 161 | } else if(match(words[w],"^Xr$")) { |
| 162 | add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w]) |
| 163 | } else if(match(words[w],"^Rs$")) { |
| 164 | split("",refauthors) |
| 165 | nrefauthors=0 |
| 166 | reftitle="" |
| 167 | refissue="" |
| 168 | refdate="" |
| 169 | refopt="" |
Darren Tucker | 0c0dc49 | 2007-06-05 20:01:16 +1000 | [diff] [blame] | 170 | refreport="" |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 171 | reference=1 |
| 172 | next |
| 173 | } else if(match(words[w],"^Re$")) { |
| 174 | prenl++ |
| 175 | for(i=nrefauthors-1;i>0;i--) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 176 | add(refauthors[i]) |
| 177 | if(i>1) |
| 178 | add(", ") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 179 | } |
| 180 | if(nrefauthors>1) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 181 | add(" and ") |
Darren Tucker | 0c0dc49 | 2007-06-05 20:01:16 +1000 | [diff] [blame] | 182 | if(nrefauthors>0) |
| 183 | add(refauthors[0] ", ") |
| 184 | add("\\fI" reftitle "\\fP") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 185 | if(length(refissue)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 186 | add(", " refissue) |
Darren Tucker | 0c0dc49 | 2007-06-05 20:01:16 +1000 | [diff] [blame] | 187 | if(length(refreport)) { |
| 188 | add(", " refreport) |
| 189 | } |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 190 | if(length(refdate)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 191 | add(", " refdate) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 192 | if(length(refopt)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 193 | add(", " refopt) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 194 | add(".") |
| 195 | reference=0 |
| 196 | } else if(reference) { |
| 197 | if(match(words[w],"^%A$")) { refauthors[nrefauthors++]=wtail() } |
| 198 | if(match(words[w],"^%T$")) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 199 | reftitle=wtail() |
| 200 | sub("^\"","",reftitle) |
| 201 | sub("\"$","",reftitle) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 202 | } |
| 203 | if(match(words[w],"^%N$")) { refissue=wtail() } |
| 204 | if(match(words[w],"^%D$")) { refdate=wtail() } |
| 205 | if(match(words[w],"^%O$")) { refopt=wtail() } |
Darren Tucker | 0c0dc49 | 2007-06-05 20:01:16 +1000 | [diff] [blame] | 206 | if(match(words[w],"^%R$")) { refreport=wtail() } |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 207 | } else if(match(words[w],"^Nm$")) { |
| 208 | if(synopsis) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 209 | add(".br") |
| 210 | prenl++ |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 211 | } |
| 212 | n=words[++w] |
| 213 | if(!length(name)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 214 | name=n |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 215 | if(!length(n)) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 216 | n=name |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 217 | add("\\fB" n "\\fP") |
| 218 | if(!nospace&&match(words[w+1],"^[\\.,]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 219 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 220 | } else if(match(words[w],"^Nd$")) { |
| 221 | add("\\- " wtail()) |
| 222 | } else if(match(words[w],"^Fl$")) { |
| 223 | add("\\fB\\-" words[++w] "\\fP") |
| 224 | if(!nospace&&match(words[w+1],"^[\\.,]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 225 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 226 | } else if(match(words[w],"^Ar$")) { |
| 227 | add("\\fI") |
| 228 | if(w==nwords) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 229 | add("file ...\\fP") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 230 | else { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 231 | add(words[++w] "\\fP") |
| 232 | while(match(words[w+1],"^\\|$")) |
| 233 | add(OFS words[++w] " \\fI" words[++w] "\\fP") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 234 | } |
| 235 | if(!nospace&&match(words[w+1],"^[\\.,]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 236 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 237 | } else if(match(words[w],"^Cm$")) { |
| 238 | add("\\fB" words[++w] "\\fP") |
| 239 | while(w<nwords&&match(words[w+1],"^[\\.,:;)]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 240 | add(words[++w]) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 241 | } else if(match(words[w],"^Op$")) { |
| 242 | option=1 |
| 243 | if(!nospace) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 244 | nospace=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 245 | add("[") |
| 246 | } else if(match(words[w],"^Pp$")) { |
| 247 | prenl++ |
| 248 | } else if(match(words[w],"^An$")) { |
| 249 | prenl++ |
| 250 | } else if(match(words[w],"^Ss$")) { |
| 251 | add(".SS") |
| 252 | } else if(match(words[w],"^Pa$")&&!option) { |
| 253 | add("\\fI") |
| 254 | w++ |
| 255 | if(match(words[w],"^\\.")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 256 | add("\\&") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 257 | add(words[w] "\\fP") |
| 258 | while(w<nwords&&match(words[w+1],"^[\\.,:;)]")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 259 | add(words[++w]) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 260 | } else if(match(words[w],"^Dv$")) { |
| 261 | add(".BR") |
| 262 | } else if(match(words[w],"^Em|Ev$")) { |
| 263 | add(".IR") |
| 264 | } else if(match(words[w],"^Pq$")) { |
| 265 | add("(") |
| 266 | nospace=1 |
| 267 | parens=1 |
| 268 | } else if(match(words[w],"^Aq$")) { |
| 269 | add("<") |
| 270 | nospace=1 |
| 271 | angles=1 |
| 272 | } else if(match(words[w],"^S[xy]$")) { |
| 273 | add(".B " wtail()) |
| 274 | } else if(match(words[w],"^Ic$")) { |
| 275 | plain=1 |
| 276 | add("\\fB") |
| 277 | while(w<nwords) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 278 | w++ |
| 279 | if(match(words[w],"^Op$")) { |
| 280 | w++ |
| 281 | add("[") |
| 282 | words[nwords]=words[nwords] "]" |
| 283 | } |
| 284 | if(match(words[w],"^Ar$")) { |
| 285 | add("\\fI" words[++w] "\\fP") |
| 286 | } else if(match(words[w],"^[\\.,]")) { |
| 287 | sub(" $","",line) |
| 288 | if(plain) { |
| 289 | add("\\fP") |
| 290 | plain=0 |
| 291 | } |
| 292 | add(words[w]) |
| 293 | } else { |
| 294 | if(!plain) { |
| 295 | add("\\fB") |
| 296 | plain=1 |
| 297 | } |
| 298 | add(words[w]) |
| 299 | } |
| 300 | if(!nospace) |
| 301 | add(OFS) |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 302 | } |
| 303 | sub(" $","",line) |
| 304 | if(plain) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 305 | add("\\fP") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 306 | } else if(match(words[w],"^Bl$")) { |
| 307 | oldoptlist=optlist |
| 308 | if(match(words[w+1],"-bullet")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 309 | optlist=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 310 | else if(match(words[w+1],"-enum")) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 311 | optlist=2 |
| 312 | enum=0 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 313 | } else if(match(words[w+1],"-tag")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 314 | optlist=3 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 315 | else if(match(words[w+1],"-item")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 316 | optlist=4 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 317 | else if(match(words[w+1],"-bullet")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 318 | optlist=1 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 319 | w=nwords |
| 320 | } else if(match(words[w],"^El$")) { |
| 321 | optlist=oldoptlist |
Damien Miller | 8663e51 | 2016-09-28 07:40:33 +1000 | [diff] [blame] | 322 | if(!optlist) |
| 323 | add(".PP") |
Darren Tucker | d062da5 | 2004-07-02 18:43:09 +1000 | [diff] [blame] | 324 | } else if(match(words[w],"^Bk$")) { |
| 325 | if(match(words[w+1],"-words")) { |
| 326 | w++ |
| 327 | breakw=1 |
| 328 | } |
| 329 | } else if(match(words[w],"^Ek$")) { |
| 330 | breakw=0 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 331 | } else if(match(words[w],"^It$")&&optlist) { |
| 332 | if(optlist==1) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 333 | add(".IP \\(bu") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 334 | else if(optlist==2) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 335 | add(".IP " ++enum ".") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 336 | else if(optlist==3) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 337 | add(".TP") |
| 338 | prenl++ |
Darren Tucker | 58cef1f | 2004-06-28 15:45:08 +1000 | [diff] [blame] | 339 | if(match(words[w+1],"^Pa$|^Ev$")) { |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 340 | add(".B") |
| 341 | w++ |
| 342 | } |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 343 | } else if(optlist==4) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 344 | add(".IP") |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 345 | } else if(match(words[w],"^Sm$")) { |
| 346 | if(match(words[w+1],"off")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 347 | nospace=2 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 348 | else if(match(words[w+1],"on")) |
Damien Miller | a8e06ce | 2003-11-21 23:48:55 +1100 | [diff] [blame] | 349 | nospace=0 |
Darren Tucker | 167bd9c | 2003-09-07 12:34:54 +1000 | [diff] [blame] | 350 | w++ |
| 351 | } else if(!skip) { |
| 352 | add(words[w]) |
| 353 | } |
| 354 | } |
| 355 | if(match(line,"^\\.[^a-zA-Z]")) |
| 356 | sub("^\\.","",line) |
| 357 | if(parens) |
| 358 | add(")") |
| 359 | if(angles) |
| 360 | add(">") |
| 361 | if(option) |
| 362 | add("]") |
| 363 | if(ext&&!extopt&&!match(line," $")) |
| 364 | add(OFS) |
| 365 | if(!ext&&!extopt&&length(line)) { |
| 366 | print line |
| 367 | prenl=0 |
| 368 | line="" |
| 369 | } |
| 370 | } |