]> git.lizzy.rs Git - plan9front.git/blobdiff - rc/bin/doctype
git: fix non-interruptible temporary warning
[plan9front.git] / rc / bin / doctype
index 6a2a27d3c6c3dcddef486411f493ac7d932c79f2..5aa6cc300afb8764d517f384f83b3c792d9a3695 100755 (executable)
@@ -1,6 +1,11 @@
 #!/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
@@ -13,7 +18,8 @@ while(~ $1 -*){
                eqn=neqn
                prefer='prefer -n'
        case -T
-               dev=$1
+               dev=-T$2
+               shift
        case -*
                opt=$opt' $1'
        }
@@ -23,7 +29,7 @@ ifs='
 '{
        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'" }
@@ -33,6 +39,7 @@ BEGIN { files = "'$files'" }
 /^\.EQ/        { eqn++ }
 /^\.TS/        { tbl++ }
 /^\.PS/        { pic++ }
+/^\.TPS/ { tpic++; pic++ }
 /^\.IS/        { ideal++ }
 /^\.GS/ { tped++ }
 /^\.G1/ { grap++; pic++ }
@@ -55,6 +62,7 @@ END {
                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 = "" }