ps2txt Notes: Wed Nov 3 11:51:59 EST 2004 rsc i copied ps2txt to /n/sources/extra. it doesn't do nearly a good enough job to merit inclusion in /bin. Reference: /n/sources/patch/sorry/ps2txt Date: Wed Nov 3 17:52:18 CET 2004 Reviewed-by: rsc --- /rc/bin/ps2txt Thu Jan 1 00:00:00 1970 +++ /rc/bin/ps2txt Wed Nov 3 17:52:18 2004 @@ -0,0 +1,43 @@ +#!/bin/rc + +rfork e + +fn usage { + echo 'usage: ps2txt [gs-options] [input.ps] [output.txt]' >[1=2] + exit usage +} + +compat=(-'dCompatibilityLevel=1.2') +opt=() +while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 - --){ + if(~ $1 '-dCompatibilityLevel='*) + compat=() + opt=($opt $1) + shift +} +if(~ $1 --) + shift + +switch($#*){ +case 0 + fin='-' + fout='-' +case 1 + fin=$1 + fout='-' +case 2 + fin=$1 + fout=$2 +case * + usage +} + +# We have to include the options twice because -I only takes effect +# if it appears before other options. + +gscmd=( gs $opt -dSAFER -dNOPAUSE -dBATCH -dSIMPLE -q \ + $opt $compat \ + -s'OutputFile='$fout -c save -f ps2ascii.ps $fin ) +exec $gscmd + +