]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
This simplifies the mime encoder selection and handling to follow the design:
authorAidan Van Dyk <aidan@ifax.com>
Tue, 9 Jan 2007 14:09:10 +0000 (14:09 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Tue, 9 Jan 2007 14:09:10 +0000 (14:09 +0000)
1) configure no longer *searches* for encoders.  If they are passed
   into configure (args, config.*) fine.  configure only uses them for
   setting the defaults when processing faxsetup.sh.in

2) faxsetup.sh does the looking/verifying of encoders.  It verifies only
   3 things:
   - BASE64ENCODE (tries mimencode, base64-encode,  then uuencode -m)
   - QPENCODE (ties mimencode -q, the qp-encode)
   - MIMENCODE (looks for mimencode)

3) MIMENCODE is set for bacwards compatibly (notify-4.2, notify-4.1,
   etc)

4) mimeEncode in common-functions tries *only* the one encoder, then
   falls back to $AWK based encoders

CHANGES
configure
etc/faxsetup.sh.in
util/common-functions.sh.in
util/faxrcvd.sh.in
util/notify.sh.in
util/pollrcvd.sh.in
util/tiff2pdf.sh.in

diff --git a/CHANGES b/CHANGES
index 4cc70ca3db82f2d3dacf4a902ca6b595ced0c615..3362d411e950879382eb9c3b1978d5c7bbe99e1a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@
 
 Chandlog since HylaFAX 4.3.1
 
+* Simplify/Unify mime encoder selection and use (9 Jan 2007)
 * Add the Include: option for Config file options (8 Jan 2007)
 * Redirected unwanted output from pd2pdf while running notify (24 Dec 2006)
 * Use @SCRIPT_SH@ for bin/ scripts to allow configure selection (23 Dec 2006)
index 990190d21ccf3ec7a97c158d1064a9bdc0cf72b5..636dd7d53a6fd0cff94d274109b8bc0afbf04a4b 100755 (executable)
--- a/configure
+++ b/configure
@@ -3642,49 +3642,10 @@ fi
 #
 # Check for email encoders.
 #
-test "$UUENCODE" || {
-    UUENCODE=`findAppDef uuencode $PATH uuencode`
-}
-test -x "$UUENCODE" && Note "Found uuencode encoder: $UUENCODE"
-
-if [ -z "$BASE64ENCODE" ]; then
-    # Use suggested $MIMENCODE for compatibility with earlier versions:
-    BASE64ENCODE=$MIMENCODE;
-fi
-test "$BASE64ENCODE" || {
-    BASE64ENCODE=`findAppDef mimencode $PATH mimencode`
-    test -x $BASE64ENCODE || {
-       BASE64ENCODE=`findAppDef base64-encode $PATH base64-encode`
-       if [ -x "$UUENCODE" ]; then
-           if capture "$UUENCODE -m port.h foo"; then
-               BASE64ENCODE="$UUENCODE -m ===="
-           fi
-       fi
-    }
-}
-test -n "$BASE64ENCODE" && Note "Found base64 encoder: $BASE64ENCODE"
-
-test "$QPENCODE" || {
-    cmd=`findAppDef mimencode $PATH mimencode`
-    QPENCODE="$cmd -q"
-    test -x $cmd || {
-       QPENCODE=`findAppDef qp-encode $PATH qp-encode`
-    }
-}
-test -n "$QPENCODE" && Note "Found Quoted-Printable encoder: $QPENCODE"
-
-# Keeping $MIMENCODE up to date for older scripts...
-test "$MIMENCODE" || MIMENCODE=$BASE64ENCODE
-
-if [ -z "$ENCODING" ]; then
-    if [ -n "$BASE64ENCODE" ]; then
-       ENCODING=base64
-       Note "Looks like $MIMENCODE supports base64 encoding."
-    elif [ -n "$UUENCODE" ]; then
-       ENCODING=x-uuencode
-       Note "Looks like $UUENCODE does not support base64 encoding."
-    fi
-fi
+test -n "$UUENCODE" && Note "Using uuencode encoder: $UUENCODE"
+test -n "$BASE64ENCODE" && Note "Using base64 encoder: $BASE64ENCODE"
+test -n "$QPENCODE" && Note "Using Quoted-Printable encoder: $QPENCODE"
+test -n "$MIMENCODE" && Note "Using mimencode for compatibility: $QPENCODE"
 
 #
 # Pick install mechanism.
index 4ebde82dc7ebed1acf0e41b2b56e45a4e565c468..f3a071164b1d8c90990d288a35a638ae2c53f8ec 100644 (file)
@@ -49,7 +49,6 @@ test -d /usr/sbin && PATH=/usr/sbin:$PATH             # 4.4BSD-derived
 test -d /usr/local/bin && PATH=$PATH:/usr/local/bin    # for GNU tools
 
 AWK=@AWK@                      # awk for use below
-BASE64ENCODE=@BASE64ENCODE@    # base64encode command to dump in setup.cache
 CAT=@CAT@                      # cat command for use below
 CHARSET=@CHARSET@              # character set to use in e-mails
 CHGRP=@CHGRP@                  # change file group for use below
@@ -62,16 +61,18 @@ FUSER=@FUSER@                       # fuser command to dump in setup.cache
 GREP=@GREP@                    # grep command for use below
 LN=@LN@                                # ln command for use below
 LN_S=@LN_S@                    # ln option for creating a symbolic link
-MIMENCODE=@MIMENCODE@          # mimencode command to dump in setup.cache
 MKFIFO=@MKFIFO@                        # FIFO creation program for use below
 MV=@MV@                                # move file for use below
-QPENCODE=@QPENCODE@            # qpencode command to dump in setup.cache
 RMCMD=@RM@                     # remove file for use below
 SCRIPT_SH=@SCRIPT_SH@          # shell for use below
 SED=@SED@                      # sed for use below
 TIFF2PDF=@TIFF2PDF@            # tiff-to-pdf conversion tool
 TTYCMD=@TTYCMD@                        # tty for error output
-UUENCODE=@UUENCODE@            # uuencode command to dump in setup.cache
+
+BASE64ENCODE="@BASE64ENCODE@"  # base64encode command to dump in setup.cache
+MIMENCODE="@MIMENCODE@"                # mimeencode command to dump in setup.cache for old notifys
+QPENCODE="@QPENCODE@"          # qpencode command to dump in setup.cache
+UUENCODE="@UUENCODE@"          # uuencode command to dump in setup.cache
 
 FAX=@FAXUID@                   # identity of the fax user
 SERVICES=/etc/services         # location of services database
@@ -795,12 +796,8 @@ test -x "$UUENCODE" || {
     test -x "$UUENCODE" && Note "Found uuencode encoder: $UUENCODE"
 }
 
-if [ -z "$BASE64ENCODE" ]; then
-    # Keep configured base64 encoder for upgrades from earlier versions:
-    BASE64ENCODE=$MIMENCODE;
-fi
 # $BASE64ENCODE may contain parameters
-cmd=`echo $BASE64ENCODE | $SED -e "s/^ *//" -e "s/ .*$//"`
+cmd=`echo "$BASE64ENCODE" | $SED -e "s/^ *//" -e "s/ .*$//"`
 test -x "$cmd" || {
     BASE64ENCODE=`findAppDef mimencode $PATH mimencode`
     test -x $BASE64ENCODE || {
@@ -808,13 +805,13 @@ test -x "$cmd" || {
        test -x $BASE64ENCODE || {
            if [ -x "$UUENCODE" ]; then
                if capture "$UUENCODE -m $PASSWD foo"; then
-                       BASE64ENCODE="$UUENCODE -m ===="
+                       BASE64ENCODE="$UUENCODE -m ==== | $GREP -v ===="
                fi
            fi
        }
     }
-    test -n "$BASE64ENCODE" && Note "Found base64 encoder: $BASE64ENCODE"
 }
+test -n "$BASE64ENCODE" && Note "Found base64 encoder: $BASE64ENCODE"
 
 # $QPENCODE may contain parameters
 cmd=`echo $QPENCODE | $SED -e "s/^ *//" -e "s/ .*$//"`
@@ -824,11 +821,8 @@ test -x "$cmd" || {
     test -x $cmd || {
        QPENCODE=`findAppDef qp-encode $PATH qp-encode`
     }
-    test -n "$QPENCODE" && Note "Found Quoted-Printable encoder: $QPENCODE"
 }
-
-# Keeping $MIMENCODE up to date for older scripts...
-test -x "$MIMENCODE" || MIMENCODE=$BASE64ENCODE
+test -n "$QPENCODE" && Note "Found Quoted-Printable encoder: $QPENCODE"
 
 if [ -n "$BASE64ENCODE" ]; then
     if [ "$ENCODING" != "base64" ]; then
@@ -842,6 +836,14 @@ elif [ -x "$UUENCODE" ]; then
     fi
 fi
 
+# $MIMENCODE may contain parameters
+cmd=`echo "$MIMENCODE" | $SED -e "s/^ *//" -e "s/ .*$//"`
+test -x "$cmd" || {
+    MIMENCODE=`findAppDef mimencode $PATH mimencode`
+}
+test -n "$MIMENCODE" && Note "Found mimencode for compatibilty: $MIMENCODE"
+
+
 RM="$RMCMD -f"                         # remove file for use below
 
 #
index 0839e9cb1f663e97561813c5e5d7434a6cd4e70f..920a0949faaac5548245fdd3ed1fe1e9e7cad83c 100644 (file)
@@ -162,6 +162,11 @@ parseFaxInfo()
     eval "$AWK_OUTPUT"
 }
 
+programOfCommand()
+{
+       echo "$*" | $SED -e -'s/^ *//' -e 's/ .*$//'
+}
+
 #
 # Produce mailable encoding for binary files.
 # mimeEncode(filename, encoding)
@@ -179,37 +184,28 @@ mimeEncode()
     fi
     encoding=`echo $encoding | $SED -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
 
-    # Configuration for which faxsetup was not rerun contains $MIMENCODE
     # rather than separate $BASE64ENCODE and $QPENCODE
     case "$encoding" in
         base64)
            if [ -n "$BASE64ENCODE" ]; then
+
                # $BASE64ENCODE may contain parameters
-               cmd=`echo $BASE64ENCODE | $SED -e "s/^ *//" -e "s/ .*$//"`
+               cmd=`programOfCommand $BASE64ENCODE`
                if [ -x "$cmd" ]; then
-                   ($BASE64ENCODE < $1 \
-                       | $GREP -v "====$") \
-                       2>$ERRORSTO
+                   $BASE64ENCODE < $1 2>$ERRORSTO
                fi
-           # For compatibility with earlier configurations:
-           elif [ -x "$MIMENCODE" ]; then
-               $MIMENCODE < $1 2>$ERRORSTO
-           elif [ -x "$UUENCODE" ]; then
-               ($UUENCODE -m ==== < $1 \
-                   | $GREP -v "====$") \
-                   2>$ERRORSTO
+           else
+               $AWK -f bin/b64-encode.awk < $1 2>$ERRORSTO
            fi;;
         quoted-printable)
            if [ -n "$QPENCODE" ]; then
                # $QPENCODE may contain parameters
-               cmd=`echo $QPENCODE | $SED -e "s/^ *//" -e "s/ .*$//"`
+               cmd=`programOfCommand $QPENCODE`
                if [ -x "$cmd" ]; then
                    $QPENCODE < $1 2>$ERRORSTO
                fi
-            # For compatibility with earlier configurations:
-           elif [ -x "$MIMENCODE" ]; then
-               # Take a chance that $MIMENCODE really contains mimencode
-               $MIMENCODE -q < $1 2>$ERRORSTO
+           else
+               $AWK -f bin/qp-encode.awk < $1 2>$ERRORSTO
            fi;;
         *uue*)
            if [ -x "$UUENCODE" ]; then
index a985eb83ed46252ea6b7ba0b492a1c922f038730..6cd0dbf41f997ce0b2fe5a232e3ea2b78249a494 100644 (file)
@@ -54,7 +54,6 @@ EOF
 # didn't re-run faxsetup; we set them before calling setup.cache for
 # backward compatibility.
 ENCODING=base64
-MIMENCODE=mimencode
 TIFF2PDF=bin/tiff2pdf
 TTYCMD=tty
 CHARSET=us-ascii
index 0b644ae370deb67555e44ddcc1f773c7139ee476..55da73d4c9a973b311b2d1fe68182438292765cf 100644 (file)
@@ -55,7 +55,6 @@ NEXT=${4:-'??:??'}
 # didn't re-run faxsetup; we set them before calling setup.cache for
 # backward compatibility.
 ENCODING=base64
-MIMENCODE=mimencode
 TIFF2PDF=bin/tiff2pdf
 TTYCMD=tty
 CHARSET=us-ascii
index 8d1947ecffa1479eecf94581f522aea59a8ea982..d28854c0596a12eb74122e780ecead4ceb733b50 100644 (file)
@@ -55,7 +55,6 @@ EOF
 # didn't re-run faxsetup; we set them before calling setup.cache for
 # backward compatibility.
 ENCODING=base64
-MIMENCODE=mimencode
 TIFF2PDF=bin/tiff2pdf
 TTYCMD=tty
 CHARSET=us-ascii
index 5e634f4d120175f781666a4739d9b3c265ecf646..d9cbbfc2b91e0c10c8427fc5f25a65d6d8e93871 100644 (file)
@@ -59,7 +59,6 @@ EOF
 # didn't re-run faxsetup; we set them before calling setup.cache for
 # backward compatibility.
 ENCODING=base64
-MIMENCODE=mimencode
 TTYCMD=tty
 
 . etc/setup.cache