#! /bin/sh # $Id: tiff2fax.sh.in,v 1.3 2006/06/02 18:57:58 faxguy Exp $ # # HylaFAX Facsimile Software # # Copyright (c) 1990-1996 Sam Leffler # Copyright (c) 1991-1996 Silicon Graphics, Inc. # HylaFAX is a trademark of Silicon Graphics # # Permission to use, copy, modify, distribute, and sell this software and # its documentation for any purpose is hereby granted without fee, provided # that (i) the above copyright notices and this permission notice appear in # all copies of the software and related documentation, and (ii) the names of # Sam Leffler and Silicon Graphics may not be used in any advertising or # publicity relating to the software without the specific, prior written # permission of Sam Leffler and Silicon Graphics. # # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. # # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # # # Convert TIFF to fax as needed. # # tiff2fax [-o output] [-l pagelength] [-w pagewidth] # [-r resolution] [-m maxpages] [-1] [-2] [-3] file ... # # NB: This script uses the tiffcp program from the TIFF # software distribution to do certain format conversions. # The TIFF distribution is available by ftp at # ftp://ftp.sgi.com/graphics/tiff/; be sure to get # v3.4beta016 or later. # test -f etc/setup.cache || { SPOOL=`pwd` cat</dev/null` ACTIONS=`echo "$RESULT" | $SED 1q` case "$ACTIONS" in OK) # no conversion needed # # 1) We don't use hard links because it screws up faxqclean # logic that assumes the only hard links are used # temporarily when document files are being created during # the job submission process. # 2) We don't use symbolic links because the links get broken # when the source document is shared between jobs and # faxq removes the source document before all jobs complete. # # If we ever encounter problems where the client submits corrupt # TIFF and we need to clean it up before transmission, then we # can simply merge OK with REFORMAT. For now we use $CP instead # of $TIFFCP, however, to provide the client some control. # $CP -f $fil $out exit 0 # successful conversion ;; *REJECT*) # document rejected out of hand echo "$RESULT" | $SED 1d exit 254 # reject document ;; REFORMAT) # only need format conversion (e.g. g4->g3) rowsperstrip="-r 9999 " if [ -n "`$TIFFINFO $fil | $GREP 'Compression Scheme: ISO JBIG'`" ]; then rowsperstrip="" fi $TIFFCP -i -c $df -f lsb2msb $rowsperstrip$fil $out # libtiff 3.5.7 gives exit status 9 when there are unknown tags... if [ $? != 0 ] && [ $? != 9 ]; then { $CAT<