aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-07-18 22:50:09 +0000
committerrsc <devnull@localhost>2005-07-18 22:50:09 +0000
commit72208f38277ad8aa8f1e9c13d5fc266d64474eb7 (patch)
treed19d1f16cb1131101ef536c5dec4d39cc3a71f90 /bin
parent829ec0d30c5a298739be7f3f97ff7472b7ee1b27 (diff)
downloadplan9port-72208f38277ad8aa8f1e9c13d5fc266d64474eb7.tar.gz
plan9port-72208f38277ad8aa8f1e9c13d5fc266d64474eb7.tar.bz2
plan9port-72208f38277ad8aa8f1e9c13d5fc266d64474eb7.zip
better troff handling
Diffstat (limited to 'bin')
-rwxr-xr-xbin/page21
1 files changed, 19 insertions, 2 deletions
diff --git a/bin/page b/bin/page
index 8b85e559..e38b6dd6 100755
--- a/bin/page
+++ b/bin/page
@@ -22,6 +22,16 @@ preview()
end tell' | osascript
}
+xfile()
+{
+ if sed 1q "$1" | 9 grep '^x T '
+ then
+ echo 'troff intermediate output'
+ else
+ file - < "$1"
+ fi
+}
+
main()
{
case `uname` in
@@ -29,7 +39,10 @@ main()
preview "$@"
;;
*)
- case "`file $1`" in
+ case "`xfile $1`" in
+ *troff*)
+ tr2post "$1" | psfonts | page
+ ;;
*PDF*)
psv $1
;;
@@ -51,7 +64,11 @@ case $# in
0)
tmp=/var/tmp/page.$$.tmp
cat >$tmp
- case "`file $tmp`" in
+ case "`xfile $tmp`" in
+ *troff*)
+ mv $tmp $tmp.tr
+ tmp=$tmp.tr
+ ;;
*PDF*)
mv $tmp $tmp.pdf
tmp=$tmp.pdf