#! /bin/csh # MKPS -- Make PostScript files from troff documents. # # Usage: mkps [-n] file... # # The `-n' is no-execute mode; mkps just assembles the command line and spews it # out on the terminal for you to admire. Mkps makes an attempt to pick a troff # macro package based on filename extension, and looks through the input for # magic troff commands that signal the need for one of the preprocessors; the # document is filtered through the relevant ones. # # Mkps will not process files with null or .ps extensions. # # CB, NOAO, 4/12/90 # Check for no-execute mode. if ($1 == "-n") then set sharg = "nv" shift else set sharg = "v" endif foreach file ($*) # Parse out filename root and extension. set root = $file:r set extn = $file:e if ($root == $extn) set extn = '' if ($extn == "ps" || $extn == "") continue # Select troff macro package based on filename extension. switch ($extn) case [1-8]: case [1-8][a-z]*: set tmacpkg = "an" breaksw case ms: set tmacpkg = "slw" breaksw default: set tmacpkg = `echo $extn | awk '{print substr($0,2)}'` breaksw endsw # Select troff preprocessors. set pp = "cat $file" if { grep -s "^\.TS" $file } set pp = "$pp | ditbl" if { grep -s "^\.G1" $file } set pp = "$pp | digrap" if { grep -s "^\.PS" $file } set pp = "$pp | dipic" if { grep -s "^\.IS" $file } set pp = "$pp | ideal" if { grep -s "^\.EQ" $file } set pp = "$pp | dieqn" # Assemble command line and pipe to shell. set cmd = "$pp | ditroff -t -Tps -m$tmacpkg | devps -mplus > $root.ps" echo $cmd | sh -$sharg end