1#! @SCRIPT_SH@ 2# $Id$ 3# 4# HylaFAX Facsimile Software 5# 6# Copyright (c) 1990-1996 Sam Leffler 7# Copyright (c) 1991-1996 Silicon Graphics, Inc. 8# HylaFAX is a trademark of Silicon Graphics 9# 10# Permission to use, copy, modify, distribute, and sell this software and 11# its documentation for any purpose is hereby granted without fee, provided 12# that (i) the above copyright notices and this permission notice appear in 13# all copies of the software and related documentation, and (ii) the names of 14# Sam Leffler and Silicon Graphics may not be used in any advertising or 15# publicity relating to the software without the specific, prior written 16# permission of Sam Leffler and Silicon Graphics. 17# 18# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 19# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 20# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 21# 22# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR 23# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, 24# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 25# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 26# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 27# OF THIS SOFTWARE. 28# 29 30# 31# Convert PostScript to facsimile using Impressario 2.0-based RIP for IRIX. 32# 33# ps2fax [-o output] [-l pagelength] [-w pagewidth] 34# [-r resolution] [-m maxpages] [-*] [file ...] 35# 36# We need to process the arguments to extract the input 37# files so that we can prepend a prologue file that defines 38# LaserWriter-specific stuff as well as to insert and error 39# handler that generates ASCII diagnostic messages when 40# a problem is encountered in the interpreter. 41# 42# NB: this shell script is assumed to be run from the 43# top of the spooling hierarchy -- s.t. the etc directory 44# is present. 45 46test -f etc/setup.cache || { 47 SPOOL=`pwd` 48 cat<<EOF 49 50FATAL ERROR: $SPOOL/etc/setup.cache is missing! 51 52The file $SPOOL/etc/setup.cache is not present. This 53probably means the machine has not been setup using the faxsetup(@MANNUM1_8@) 54command. Read the documentation on setting up HylaFAX before you 55startup a server system. 56 57EOF 58 exit 1 59} 60. etc/setup.cache 61 62PS=$IMPRIP 63DSO_DIR=$LIBEXEC 64 65pagewidth=1728 # standard fax width 66pagelength=297 # default to A4 67vres=98 # default to low res 68out=ps.fax # default output filename 69 70fil= 71opt= 72while test $# != 0 73do case "$1" in 74 -o) shift; out="$1" ;; 75 -l) shift; pagelength="$1" ;; 76 -w) shift; pagewidth="$1" ;; 77 -r) shift; vres="$1" ;; 78 -m) shift;; # NB: not implemented 79 -1) ;; 80 -2) opt="$opt -o 2d" ;; 81 *) fil="$fil $1" ;; 82 esac 83 shift 84done 85 86test -x $PS || { 87 $CAT<<EOF 88 89The Impressario PostScript RIP does not exist on the server machine 90or is not located at the expected location: 91 92 $PS 93 94This indicates that you either do not have Impressario installed on 95the system or that it is installed in a nonstandard location. 96 97EOF 98 exit 254; # cause document to be rejected 99} 100test -r $DSO_DIR/fax.so || { 101 $CAT<<EOF 102 103The FAX back-end for the Impressario PostScript RIP does not exist 104on the server machine or is not located at the expected location: 105 106 $DSO_DIR/fax.so 107 108This indicates the Impressario 2.0 FAX back-end provided for use with 109HylaFAX was not installed on the server system (hylafax.sw.imprip). 110 111EOF 112 exit 254; # cause document to be rejected 113} 114 115# 116# Calculate raster image height based on page length 117# and vertical resolution. 118# 119pageheight=`expr "$pagelength" \* "$vres" \* 10 / 255 2>/dev/null` 120 121# 122# Apply customizations such as watermarking. 123# 124if [ -f etc/FaxModify ]; then 125 . etc/FaxModify 126fi 127 128# 129# Force temp/scratch files away from the normal place 130# in the spooling area in case we are using the RIP on 131# a system w/o the rest of Impressario 132# 133PSRIPTMPDIR=tmp; export PSRIPTMPDIR 134 135exec 2>&1 # capture error messages 136$PS -b $DSO_DIR -C fax \ 137 -X 204 -Y "$vres" \ 138 -W "$pagewidth" -H "$pageheight" \ 139 -I etc/dpsprinter.ps \ 140 -O $out \ 141 $opt -S \ 142 $fil 143