]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 501: create an ERRORSTO option in faxrcvd as well as redirecting
authorLee Howard <faxguy@howardsilvan.com>
Wed, 11 Feb 2004 16:30:55 +0000 (16:30 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Wed, 11 Feb 2004 16:30:55 +0000 (16:30 +0000)
         more potential ps2pdf error messages from causing problems

util/faxrcvd.sh.in

index 9a0a365c10768be2f51b2c050c8fd06079607934..13894e0a4f19b108e551ed41cdec705769a31bc7 100644 (file)
@@ -66,6 +66,7 @@ TOADDR=FaxMaster
 FROMADDR=fax
 TIFFINFO=tiffinfo
 NOTIFY_FAXMASTER=always
+ERRORSTO=/dev/tty
 
 #
 # Permit various types of attachment types: ps, tif, pdf
@@ -80,17 +81,17 @@ FILETYPE=ps
 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
 }
 
@@ -118,8 +119,8 @@ if [ -f $FILE ]; then
     # 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
@@ -228,25 +229,26 @@ if [ -f $FILE ]; then
             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--"