FROMADDR=fax
TIFFINFO=tiffinfo
NOTIFY_FAXMASTER=always
+ERRORSTO=/dev/tty
#
# Permit various types of attachment types: ps, tif, pdf
encode()
{
if [ -x "$MIMENCODE" ]; then
- $MIMENCODE $1 2>/dev/null
+ $MIMENCODE $1 2>$ERRORSTO
elif [ -x "$UUENCODE" ]; then
if [ "$ENCODING" = "base64" ]; then
- $UUENCODE -m $1 $1 | grep -E -v "^begin|^====$" 2>/dev/null
+ $UUENCODE -m $1 $1 | grep -E -v "^begin|^====$" 2>$ERRORSTO
else
- $UUENCODE $1 $1 | grep -E -v "^begin|^====$" 2>/dev/null
+ $UUENCODE $1 $1 | grep -E -v "^begin|^====$" 2>$ERRORSTO
fi
else
# Do not use "-x" for backward compatibility; even if it fails
# this is last chance to encode data, so there's nothing to lose.
- $MIMENCODE $1 2>/dev/null
+ $MIMENCODE $1 2>$ERRORSTO
fi
}
# Check the sender's TSI and setup to dispatch
# facsimile received from well-known senders.
#
- SUBADDR="`$INFO $FILE | $AWK -F: '/SubAddr/ { print $2 }' 2>/dev/null`"
- SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>/dev/null`"
+ SUBADDR="`$INFO $FILE | $AWK -F: '/SubAddr/ { print $2 }' 2>$ERRORSTO`"
+ SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>$ERRORSTO`"
SENDTO=
if [ -f etc/FaxDispatch ]; then
. etc/FaxDispatch # NB: FaxDispatch sets SENDTO
echo "Content-Transfer-Encoding: $ENCODING"
echo "Content-Disposition: attachment; filename=\"$FILENAME.pdf\""
echo ""
- GW=`$TIFFINFO $FILE | $GREP "Image Width" | \
+ GW=`$TIFFINFO $FILE 2>$ERRORSTO | $GREP "Image Width" | \
$SED 's/.*Image Width: \([0-9]*\).*/\1/g' | sort -n | $SED -n '$p'`
- GL=`$TIFFINFO $FILE | $GREP "Image Length" | \
+ GL=`$TIFFINFO $FILE 2>$ERRORSTO | $GREP "Image Length" | \
$SED 's/.*Image Length: \([0-9]*\).*/\1/g' | sort -n | $SED -n '$p'`
- RW=`$TIFFINFO $FILE | $GREP "Resolution" | \
+ RW=`$TIFFINFO $FILE 2>$ERRORSTO | $GREP "Resolution" | \
$SED 's/.*Resolution: \([0-9]*\).*/\1/g' | sort -n | $SED -n '$p'`
- RL=`$TIFFINFO $FILE | $GREP "Resolution" | \
+ RL=`$TIFFINFO $FILE 2>$ERRORSTO | $GREP "Resolution" | \
$SED 's/.*Resolution: [0-9]*, \([0-9]*\).*/\1/g' | sort -n | $SED -n '$p'`
- $TIFF2PS -a -O $FILE.ps $FILE 2>/dev/null # fax2ps looks bad
- $PS2PDF -g$GW\x$GL -r$RW\x$RL $FILE.ps $FILE.pdf 2>/dev/null
+ # keep any output from tiff2ps and ps2pdf from the message source
+ $TIFF2PS -a -O $FILE.ps $FILE > $ERRORSTO 2>&1 # fax2ps output looks bad
+ $PS2PDF -g$GW\x$GL -r$RW\x$RL $FILE.ps $FILE.pdf > $ERRORSTO 2>&1
encode $FILE.pdf
- $RM -f $FILE.ps $FILE.pdf 2>/dev/null
+ $RM -f $FILE.ps $FILE.pdf 2>$ERRORSTO
else # default as Postscript
echo "Content-Type: application/postscript; name=\"$FILENAME.ps\""
echo "Content-Description: FAX document"
echo "Content-Transfer-Encoding: 7bit"
echo "Content-Disposition: attachment; filename=\"$FILENAME.ps\""
echo ""
- $FAX2PS $FILE 2>/dev/null
+ $FAX2PS $FILE 2>$ERRORSTO
fi
echo ""
echo "--$MIMEBOUNDARY--"