tnow using binary - plan9port - [fork] Plan 9 from user space | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 0b4084dafc3578d5ff5e438a9c76c0d3627fac97 | |
parent 05a4d855f167ae2d0d2c0ba0e386d933172b71ea | |
Author: rsc <devnull@localhost> | |
Date: Mon, 26 Mar 2007 20:55:47 +0000 | |
now using binary | |
Diffstat: | |
D bin/page | 120 -----------------------------… | |
1 file changed, 0 insertions(+), 120 deletions(-) | |
--- | |
diff --git a/bin/page b/bin/page | |
t@@ -1,120 +0,0 @@ | |
-#!/bin/sh | |
- | |
-# BUG - Should clean up $tmp but how to know when viewer is done? | |
- | |
-preview() | |
-{ | |
- list="" | |
- pwd=`pwd` | |
- for i in "$@" | |
- do | |
- if [ -n "$list" ] | |
- then | |
- list="$list, " | |
- fi | |
- n=`cleanname -d $pwd $i | sed 's!/!:!g'` | |
- list="$list\"$n\"" | |
- done | |
- # echo run $list | |
- echo 'tell application "Preview" | |
- activate | |
- open {'"$list"'} | |
- end tell' | osascript | |
-} | |
- | |
-xfile() | |
-{ | |
- if sed 1q "$1" | 9 grep '^x T ' | |
- then | |
- echo 'troff intermediate output' | |
- else | |
- 9 file < "$1" | sed 's/stdin: //' | tr A-Z a-z | |
- fi | |
-} | |
- | |
-main() | |
-{ | |
- case `uname` in | |
- Darwin) | |
- preview "$@" | |
- ;; | |
- *) | |
- case "`xfile $1`" in | |
- *troff*) | |
- tr2post "$1" | psfonts | page | |
- ;; | |
- *pdf*) | |
- psv $1 | |
- ;; | |
- *ps*) | |
- psv $1 | |
- ;; | |
- *postscript*) | |
- psv $1 | |
- ;; | |
- *) | |
- qiv "$@" | |
- ;; | |
- esac | |
- ;; | |
- esac | |
-} | |
- | |
-case $# in | |
-0) | |
- tmp=/var/tmp/page.$$.tmp | |
- cat >$tmp | |
- type=`xfile $tmp` | |
- case "$type" in | |
- *troff*) | |
- mv $tmp $tmp.tr | |
- tmp=$tmp.tr | |
- ;; | |
- *pdf*) | |
- mv $tmp $tmp.pdf | |
- tmp=$tmp.pdf | |
- ;; | |
- *gif*) | |
- mv $tmp $tmp.gif | |
- tmp=$tmp.gif | |
- ;; | |
- *jpg*) | |
- mv $tmp $tmp.jpg | |
- tmp=$tmp.jpg | |
- ;; | |
- *jpeg*) | |
- mv $tmp $tmp.jpg | |
- tmp=$tmp.jpg | |
- ;; | |
- *png*) | |
- mv $tmp $tmp.png | |
- tmp=$tmp.png | |
- ;; | |
- *postscript*) | |
- mv $tmp $tmp.ps | |
- tmp=$tmp.ps | |
- ;; | |
- *postscript*) | |
- mv $tmp $tmp.ps | |
- tmp=$tmp.ps | |
- ;; | |
- *ps*) | |
- mv $tmp $tmp.ps | |
- tmp=$tmp.ps | |
- ;; | |
- *) | |
- echo 1>&2 page: unrecognized file type on standard input: $type | |
- rm -f $tmp | |
- exit 1 | |
- esac | |
- main $tmp | |
- if [ `uname` != Darwin ] | |
- then | |
- rm -f $tmp | |
- fi | |
- ;; | |
-*) | |
- main "$@" | |
- ;; | |
-esac | |
- |