#!/bin/rc
# doctype: synthesize proper command line for troff
+if(~ $#* 0){
+ echo 'usage: doctype [ -n ] [ -T dev ] [ file ] ...' >[1=2]
+ exit usage
+}
+
troff=troff
eqn=eqn
prefer=prefer
eqn=neqn
prefer='prefer -n'
case -T
- dev=$1
+ dev=-T$2
+ shift
case -*
opt=$opt' $1'
}
'{
files=`{echo $*}
}
-grep -h '\$LIST|\|reference|Jp|^\.(EQ|TS|\[|PS|IS|GS|G1|GD|PP|BM|LP|BP|PI|cstart|begin|TH...)|^\.P$' $* |
+grep -h '\$LIST|\|reference|Jp|^\.(EQ|TS|\[|TPS|PS|IS|GS|G1|GD|PP|BM|LP|BP|PI|cstart|begin|TH...)|^\.P$' $* |
sort -u |
awk '
BEGIN { files = "'$files'" }
/^\.EQ/ { eqn++ }
/^\.TS/ { tbl++ }
/^\.PS/ { pic++ }
+/^\.TPS/ { tpic++; pic++ }
/^\.IS/ { ideal++ }
/^\.GS/ { tped++ }
/^\.G1/ { grap++; pic++ }
files = ""
}
else if (prefer) { x = "cat " files "| '$prefer'| "; files = "" }
+ if (tpic) { x = x "timepic " files " | "; files = "" }
if (tped) { x = x "tped " files " | "; files = "" }
if (dag) { x = x "dag " files " | "; files = "" }
if (ideal) { x = x "ideal -q " files " | "; files = "" }