]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Some $SED portability issues, similar in vein to the $AWK ones.
authorAidan Van Dyk <aidan@ifax.com>
Wed, 4 Oct 2006 21:26:02 +0000 (21:26 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 4 Oct 2006 21:26:02 +0000 (21:26 +0000)
Most sed handle 0,/^$/d as deleting liens starting right away.
SCO OpenServer can't start at 0, and needs 1, which is technically correct.

Also - SCO's sed doesn't have the "Q" command (hard quit), but since we don't
use auto-print, a normal quit "q" is sufficient.

util/common-functions.sh.in

index 4ed1e5648a514402ccf6ab4aac80a22f37713d79..8350ad44f2d9a8113a2fc04d41c12b3809a68082 100644 (file)
@@ -241,12 +241,12 @@ template ()
                 {
                        if (substr(line,RSTART-1,1) == "\\")
                        {
-                               tmp = substr(line, 0, RSTART-1);
+                               tmp = substr(line, 1, RSTART-2);
                                var = substr(line, RSTART+1, RLENGTH-1);
                                printf "%s$%s", tmp, var
                        } else
                        {
-                               tmp = substr(line, 0, RSTART);
+                               tmp = substr(line, 1, RSTART-1);
                                var = substr(line, RSTART+1, RLENGTH-1);
                                printf "%s%s", tmp, ENVIRON[var];
                        }
@@ -282,7 +282,7 @@ CreateMailMessage ()
     # First we take the top part of the e-mail for headers
     # Excluding any "Content-" lines, which need to stay with
     # the actual template content
-    $SED -e '/^$/Q' $1                 \
+    $SED -e '/^$/q' $1                 \
        | $GREP -v ^Content             \
        | template
 
@@ -295,18 +295,18 @@ CreateMailMessage ()
     fi
 
     # Now print the Content-* headers for the template
-    $SED -e '/^$/Q' $1                 \
+    $SED -e '/^$/q' $1                 \
        | $GREP ^Content                \
        | template
 
     echo ""
-    body_encoding=`$SED -e '/^$/Q' $1          \
+    body_encoding=`$SED -e '/^$/q' $1          \
        | $GREP -i ^Content-Transfer-Encoding   \
        | template                              \
        | $SED -e 's/^[^ ]*: *//'`;
     test "$body_encoding" || body_encoding=7bit;
 
-    $SED -e '0,/^$/d' $1 | template > $TMPDIR/body.txt
+    $SED -e '1,/^$/d' $1 | template > $TMPDIR/body.txt
     mimeEncode $TMPDIR/body.txt $body_encoding
 
     if [ -n "$2" ]; then