# MS2LROFF -- Little awk program to translate documents marked-up with the # ms macro package into something lroffable. BEGIN { #"date" | getline date; date = "Wed Mar 14 10:57:26 MST 1990"; split(date, d, " "); date = d[2] substr(d[6],3,2); print ".help iraf", date, "ReleaseNotes"; } $1 == ".RP" { next } $1 == ".TL" { print ".ce"; next } $1 == ".AU" { print ".sp"; print ".ce"; next } $1 == ".AI" { next } $1 == ".K2" { print ".ce"; print "National Optical Astronomy Observatories"; print ".ce"; # take chance on date being next next; } $1 == ".ti" { next } $1 == ".AB" { print ".sp"; print ".ce"; print "ABSTRACT"; print ".sp"; print ".in 4"; next; } $1 == ".AE" { print ".in -4"; print ".sp"; next } $1 == ".DS" { getline; if (substr($0,1,1) != ".") { print ".sp"; print ".nf"; indent_indefinitely = 1; # indent displayed text } } $1 == ".DE" { if (indent_indefinitely == 1) { print ".fi"; print ".sp"; indent_indefinitely = 0; } else print ".le"; next; } $1 == ".XS" { getline; if (substr($0,1,1) != ".") { print ".sp"; print ".nf"; indent_indefinitely = 1; # indent displayed text } } $1 == ".XE" { if (indent_indefinitely == 1) { print ".fi"; print ".sp"; indent_indefinitely = 0; } else print ".le"; next; } $1 == ".IP" { $1 = ".ls 4"; if (ipindent == 1) print ".le"; ipindent=1; indent_once=0; } $2 == "\(bu" { $2 = "o" } # fake bullets $1 == ".LP" { print ""; next } $1 == ".PP" { print ""; next } $1 == ".NH" { if ($0 == ".NH") { print ".nh"; } else { split($0, d, " "); print ".nh " d[2]; } getline; print; # echo heading indent_once = 1; next; } $1 == ".RS" { if (ipindent == 0) { $1 = ".ls 4"; rsindent=1; indent_once=0; } else next; } $1 == ".RE" { if (rsindent == 1) $1 = ".le"; else next; rsindent=0; } $1 == ".TS" { print ".nf"; while (substr($0, length($0), 1) != ".") getline; next; } $1 == ".TE" { $1 = ".fi" } $1 == ".ps" { next } # Default action statement. { if (indent_indefinitely == 1 || (indent_once == 1 && substr($0,1,1) != ".")) { printf " "; indent_once = 0; } print } END { print ".endhelp" }