#! /bin/sh -e
## 
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description. 

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi  
case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac            

exit 0
@DPATCH@
--- mgetty-1.1.30.orig/fax/faxspool.in	2002-11-23 10:14:57.000000000 -0500
+++ mgetty-1.1.30/fax/faxspool.in	2003-04-27 23:48:56.000000000 -0400
@@ -70,7 +70,7 @@
 FAX_SPOOL=@FAX_SPOOL@
 FAX_SPOOL_OUT=@FAX_SPOOL_OUT@
 FAX_SEQ=$FAX_SPOOL_OUT/.Sequence
-FAX_SEQ_LOCKDIR=$FAX_SPOOL_OUT/locks
+FAX_SEQ_LOCKDIR=/var/lock/fax
 FAX_SEQ_LOCK=$FAX_SEQ_LOCKDIR/LCK..seq
 LAST_RUN=@FAX_SPOOL_OUT@/faxqueue_done
 
@@ -145,7 +145,7 @@
 #
 fs_cvt_pbm()
 {
-    pbm2g3 $1 >$2.001
+    pbm2g3 "$1" >"$2".001
 }
 
 #
@@ -153,7 +153,7 @@
 #
 fs_cvt_pgm()
 {
-    pgmtopbm $1 | pbm2g3 >$2.001
+    pgmtopbm "$1" | pbm2g3 >"$2".001
 }
 
 #
@@ -161,7 +161,7 @@
 #
 fs_cvt_ppm()
 {
-    ppmtopgm $1 | pgmtopbm | pbm2g3 >$2.001
+    ppmtopgm "$1" | pgmtopbm | pbm2g3 >"$2".001
 }
 
 #
@@ -171,7 +171,7 @@
 #
 fs_cvt_g3()
 {
-    g3cat $1 >$2.001
+    g3cat "$1" >"$2".001
 }
 
 #
@@ -183,14 +183,14 @@
 fs_cvt_xwd()
 {
     REDUCE="cat"
-    test X$3 = X-n && REDUCE="pnmscale -yscale 0.5"
+    test X"$3" = X-n && REDUCE="pnmscale -yscale 0.5"
 
-    xwdtopnm $1 |\
+    xwdtopnm "$1" |\
 	pnmscale -xysize 1728 2000 |\
 	$REDUCE |\
 	ppmtopgm |\
 	pgmtopbm |\
-	pbm2g3 >$2.001
+	pbm2g3 >"$2".001
 }
 
 #
@@ -201,14 +201,14 @@
 fs_cvt_gif()
 {
     REDUCE="cat"
-    test X$3 = X-n && REDUCE="pnmscale -yscale 0.5"
+    test X"$3" = X-n && REDUCE="pnmscale -yscale 0.5"
 
-    giftoppm $1 |\
+    giftopnm "$1" |\
 	pnmscale -xysize 1728 2000 |\
 	$REDUCE |\
 	ppmtopgm |\
 	pgmtopbm |\
-	pbm2g3 >$2.001
+	pbm2g3 >"$2".001
 }
 
 #
@@ -219,14 +219,14 @@
 fs_cvt_tif()
 {
     REDUCE="cat"
-    test X$3 = X-n && REDUCE="pnmscale -yscale 0.5"
+    test X"$3" = X-n && REDUCE="pnmscale -yscale 0.5"
 
-    tifftopnm $1 |\
+    tifftopnm "$1" |\
 	pnmscale -xysize 1728 2000 |\
 	$REDUCE |\
 	ppmtopgm |\
 	pgmtopbm |\
-	pbm2g3 >$2.001
+	pbm2g3 >"$2".001
 }
 
 #
@@ -235,11 +235,11 @@
 #
 fs_cvt_lj()
 {
-    if [ X$3 = X-n ]
+    if [ X"$3" = X-n ]
     then
-        hp2log3 -r$2 <$1
+        hp2log3 -r"$2" <"$1"
     else
-        hp2hig3 -r$2 <$1
+        hp2hig3 -r"$2" <"$1"
     fi
 }
 
@@ -251,10 +251,10 @@
 fs_cvt_ps()
 {
     driver="$GS_DRIVER_HI"
-    test X$3 = X-n && driver="$GS_DRIVER_LO"
+    test X"$3" = X-n && driver="$GS_DRIVER_LO"
 
-    cat $1 |
-	gs $driver -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -
+    cat "$1" |
+	gs $driver -sOutputFile="$2"%03d -dNOPAUSE -q -dSAFER -
 }
        
 #
@@ -268,19 +268,19 @@
 # via Ghostscript:
 
     driver="$GS_DRIVER_HI"
-    test X$3 = X-n && driver="$GS_DRIVER_LO"
+    test X"$3" = X-n && driver="$GS_DRIVER_LO"
 
-    gs $driver -sOutputFile=$2%03d -dNOPAUSE \
-			-- gslp.ps -fCourier-Bold10 -B $1
+    gs $driver -sOutputFile="$2"%03d -dNOPAUSE \
+			-- gslp.ps -fCourier-Bold10 -B "$1"
 
 #####
 # via hp2pbm:
 # (convert "LF" to "CR+LF" via awk)
 
 #    pgm=hp2hig3
-#    test X$3 = X-n && pgm=hp2log3
+#    test X"$3" = X-n && pgm=hp2log3
 #
-#    $AWK '{ printf "%s\r\n", $0 }' $1 | $pgm -r$2
+#    $AWK '{ printf "%s\r\n", $0 }' "$1" | $pgm -r"$2"
 
 #####
 # via pbmtext (not really recommended):
@@ -288,13 +288,13 @@
 
 ## Select appropriate font
 #    font=$PBMFONT_BODY_F
-#    test X$3 = X-n && font=$PBMFONT_BODY_N
+#    test X"$3" = X-n && font=$PBMFONT_BODY_N
 # Determine how many pages text will be split in to.  Uses default pagelen.
-#    nr=`pgx < $1`
+#    nr=`pgx < "$1"`
 # Convert each page into a separate G3 file.  Uses default pagelen (60).
 #    page=1
 #    while [ $page -le $nr ]; do
-#	pgx $page < $1 | pbmtext -font $font | pbm2g3 >$2.$page
+#	pgx $page < "$1" | pbmtext -font $font | pbm2g3 >"$2".$page
 #	page=`expr $page + 1`
 #    done
 }
@@ -306,7 +306,7 @@
 #
 fs_cvt_dvi()
 {
-    if [ X$3 = X-n ]
+    if [ X"$3" = X-n ]
     then 
 	driver="$GS_DRIVER_LO" ; dvipscfg="-P dfaxlo"
     else
@@ -316,18 +316,18 @@
 # if you do not have the dfaxlo(w)/dfaxhigh dvips modes configured, 
 # remove "$dvipscfg" from the dvips command line below [or configure them!]
 
-    dvips $dvipscfg $1 -o \
-        !"gs $driver -sOutputFile=$2%03d -dNOPAUSE -dSAFER -q -"
+    dvips $dvipscfg "$1" -o \
+        !"gs $driver -sOutputFile="$2"%03d -dNOPAUSE -dSAFER -q -"
 
 # for those that only have the old "dvialw":
 #
 #	dvialw <$file |
-#	    gs $driver -sOutputFile=$2%03d -dNOPAUSE -dSAFER -q -
+#	    gs $driver -sOutputFile="$2"%03d -dNOPAUSE -dSAFER -q -
 
 # for those that have dvi2ps and not dvips:
 #
 #	dvi2ps -r -q $q |
-#	    gs $driver -sOutputFile=$2%03d -dNOPAUSE -dSAFER -q -
+#	    gs $driver -sOutputFile="$2"%03d -dNOPAUSE -dSAFER -q -
 
 }
 
@@ -341,11 +341,11 @@
 fs_cvt_pdf()
 {
     driver="$GS_DRIVER_HI"
-    test X$3 = X-n && driver="$GS_DRIVER_LO"
+    test X"$3" = X-n && driver="$GS_DRIVER_LO"
 
-    cat $1 |
+    cat "$1" |
 	acroread -toPostScript |
-	gs $driver -sOutputFile=$2%03d -dNOPAUSE -q -dSAFER -
+	gs $driver -sOutputFile="$2"%03d -dNOPAUSE -q -dSAFER -
 }
 
 
@@ -547,7 +547,7 @@
     exit 3
 fi
 
-phone=$1 ; shift
+phone="$1" ; shift
 if expr "$phone" : "[-0-9TtPpWw,;]*$" >/dev/null ; then :
 else
     alias="$phone"
