File hylafax-6.0.4.patch of Package hylafax

Index: Makefile.Linux
================================================================================
--- Makefile.Linux
+++ Makefile.Linux
@@ -0,0 +1,3 @@
+extract:
+	tar xIfp ../hylafax-SuSE.tar.bz2
+
--- config.site
+++ config.site
@@ -55,16 +55,16 @@
 #
 # Directory parameters.
 #
-#DIR_BIN="/usr/local/bin"		# directory for client apps
-#DIR_LIB="/usr/local/lib"		# directory for libhylafax
-#DIR_LIBDATA="/usr/lib/fax"		# directory for client data
-#DIR_LIBEXEC="/usr/lib/fax"		# directory for libraries&hidden apps
-#DIR_MAN="/usr/local/man"		# directory for manual pages
-#DIR_SPOOL="/var/spool/hylafax"		# directory for spooling area
-#DIR_SBIN="/var/spool/hylafax/bin"		# directory for system apps
-#DIR_LOCKS="/usr/spool/locks"		# directory for UUCP lock files
+DIR_BIN="/usr/bin"			# directory for client apps
+DIR_LIB="/usr/lib"			# directory for libfaxserver, libfaxutil
+DIR_LIBDATA="/usr/lib/fax"		# directory for client data
+DIR_LIBEXEC="/usr/lib/fax"		# directory for libraries&hidden apps
+DIR_MAN="/usr/share/man"		# directory for manual pages
+DIR_SPOOL="/var/spool/fax"		# directory for spooling area
+DIR_SBIN="/usr/sbin"			# directory for system apps
+DIR_LOCKS="/var/spool/locks"		# directory for UUCP lock files
 #FONTMAP="/usr/share/ghostscript/3.33"	# directorys containing Fontmap files
-#PATH_AFM="/usr/lib/DPS/AFM"		# directorys for AFM files
+#PATH_AFM="/usr/share/ghostscript/fonts"	# directorys for AFM files
 
 #
 # Miscellaneous parameters.
@@ -73,16 +73,16 @@
 #FILLORDER="MS2LSB"			# bit order of cpu (MSB2LSB/LSB2MSB)
 #FAXGID="uucp"				# group ID for fax user
 #FAXUID="uucp"				# user ID for fax user
-#PAGESIZE="North American Letter"	# default page size
+PAGESIZE="ISO A4"			# default page size
 #SYSGID="sys"				# group ID for system installs
 #SYSUID="bin"				# user ID for system installs
 #LOCKS="ascii"				# default UUCP lockfile scheme
 #
-#PATH_GETTY="/etc/getty"		# pathname of suitable getty program
-#PATH_VGETTY="/bin/vgetty"		# pathname of voice getty program
-#PATH_EGETTY="/bin/egetty"		# pathname of external getty program
-#PATH_SENDMAIL="/usr/lib/sendmail"	# pathname of suitable sendmail program
-#PATH_GSRIP="/usr/local/bin/gs"		# pathname of Ghostscript-based RIP
+PATH_GETTY="/usr/sbin/mgetty"		# pathname of suitable getty program
+PATH_VGETTY="/usr/sbin/vgetty"		# pathname of voice getty program
+PATH_EGETTY="/usr/sbin/egetty"		# pathname of external getty program
+PATH_SENDMAIL="/usr/sbin/sendmail"	# pathname of suitable sendmail program
+PATH_GSRIP="/usr/bin/gs"		# pathname of Ghostscript-based RIP
 #PATH_DPSRIP="/var/spool/hylafax/bin/ps2fax.exe" # pathname of DPS-based RIP
 #PATH_IMPRIP="/usr/lib/print/psrip"	# pathname of Impressario 2.1 RIP
 #MANSCHEME="sysv-source-cat-strip"	# manual page installation scheme
@@ -117,8 +117,8 @@
 #CXX="gcc"				# name/pathname of C++ compiler
 #CXXFILE="-x c++"			# options for proper C++ processing
 #ENVOPTS="-Aa"				# options for getting ANSI C
-#GCOPTS="-g"				# options to pass C compiler
-#GCXXOPTS="-g"				# options to pass C++ compiler
+GCOPTS="-O2"				# options to pass C compiler
+GCXXOPTS="-O2"				# options to pass C++ compiler
 #GENDIST="/sbin/gendist"		# pathname of SGI inst generator program
 #INSTALL='${SHELL} ${PORT}/install.sh'	# SGI install program/emulator
 #LIBMALLOC="auto"			# yes|no|auto configure -lmalloc use
@@ -140,9 +140,9 @@
 # to link against.  If libtiff is installed in a
 # non-standard location then setup LIBTIFF accordingly.
 #
-#LIBTIFF="-L/usr/local/lib -ltiff"	# linkage convention for libtiff
-#TIFFINC="-I/usr/local/include"		# place to find tiffio.h
-#TIFFBIN="/usr/local/bin"		# where TIFF tools live
+LIBTIFF="-ltiff -ljpeg"		# linkage convention for libtiff
+TIFFINC=""  				# place to find tiffio.h
+TIFFBIN="/usr/bin"      		# where TIFF tools live
 
 #
 # The source for the ZLIB library is not required
@@ -150,8 +150,9 @@
 # to link against.  If ZLIB is installed in a 
 # non-standard location then setup LIBZ accordingly.
 #
-#LIBZ="-L/usr/local/lib -lz"		# linkage convention for libz
+LIBZ="-lz"                   		# linkage convention for libz
 #ZLIBINC="-I/usr/local/include"		# place to find zlib.h
+ZLIBINC="-I../regex"			# to find distributed regex.h
 
 #
 # The source for the POSIX regular expression package
@@ -250,5 +251,5 @@
 #MV_F="-f"				# option to ${MV} to force operation
 #RMCMD="/bin/rm"			# pathname of suitable rm program
 #SED="/bin/sed"				# pathname of suitable sed program
-#SCRIPT_SH="/bin/sh"			# pathname of suitable shell
+SCRIPT_SH="/bin/sh"			# pathname of suitable shell
 #SORT="/bin/sort"			# pathname of suitable sort program
--- configure
+++ configure
@@ -276,7 +276,7 @@
 dumpvars()
 {
     (for i do echo "$i"; done) |
-	while read a b; do eval c=\$${b:-$a}; echo "/@$a@/s;;$c;g"; done
+	while read a b; do eval c=\$${b:-$a}; echo "s;@$a@;$c;g"; done
 }
 dumpvals()
 {
@@ -812,6 +812,7 @@
     app=$1; shift
     eval `$app -v 2>&1 | \
 	sed -n -e '/[Vv]ersion/s/[^(]* [a-z\-]*\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/GCCdist=\1;GCCmajor=\2;GCCminor=\3/p'`
+    test -z "$GCCminor" && GCCminor=0
     GCCversion="${GCCdist}.${GCCmajor}.${GCCminor}"; export GCCversion
     if [ ${GCCdist} -gt $1 ]; then
         return 0
@@ -938,7 +939,7 @@
 	Note "Looks like $CCOMPILER supports the -g option."
 	# NB: cannot use captureX here 'cuz we lose stderr
 	if $CCOMPILER $ENVOPTS $GCOPTS -c -g -O dummy.c >t 2>&1 && CheckForGandO t; then
-	    GCOPTS="$GCOPTS -g"
+	    GCOPTS="$GCOPTS"
 	else
 	    Note "... but not together with the -O option, not using it."
 	fi
@@ -1102,7 +1103,7 @@
 	Note "Looks like $CXXCOMPILER supports the -g option."
 	# NB: cannot use captureX here 'cuz we lose stderr
 	if $CXXCOMPILER $ENVOPTS -c -g -O dummy.C >t 2>&1 && CheckForGandO t; then
-	    GCXXOPTS="$GCXXOPTS -g"
+	    GCXXOPTS="$GCXXOPTS"
 	else
 	    Note "... but not together with the -O option, not using it."
 	fi
@@ -1333,7 +1334,7 @@
 fi
 
 cat>dummy.C<<EOF
-#include "new.h"
+#include <new>
 struct foo {
     int x;
     foo();
@@ -3045,7 +3046,7 @@
 	Note "... configure use of logwtmp (BSD-style wtmp logging)"
 	CheckForFuncDecl logwtmp utmp.h || {
 	    AddFuncDecl logwtmp \
-		'int logwtmp(const char*, const char*, const char*);'
+		'void logwtmp(const char*, const char*, const char*);'
 	}
 	CheckForLibrary logout -lutil && {
 	    echo '#define HAS_LOGOUT 1'
@@ -3417,7 +3418,7 @@
 		echo 'int f() { return 0; }'>t.c
 		capture cat t.c
 		runMake t \
-		    't.o:; ${CCF} -c t.c' \
+	    't.o:; ${CCF} -fpic -c t.c' \
 		    "t: t.o; \${CCF} ${DSOOPTS} -o t.${DSOSUF} t.o"
 	    }
 	    CheckCXXDSO()
@@ -3461,7 +3462,7 @@
 	echo 'int f() { return 0; }'>t.c++
 	capture cat t.c++
 	runMake t \
-	    "t.o:; \${C++F} -c \${C++FILE} t.c++${MAKECXXOVERRIDE}" \
+	    "t.o:; \${C++F} -fpic -c \${C++FILE} t.c++${MAKECXXOVERRIDE}" \
 	    "t:t.o; \${C++F} ${DSOOPTS} -o t.${DSOSUF} t.o"
 	}
 	;;
--- defs.in
+++ defs.in
@@ -170,7 +170,7 @@
 # insufficient to locate the library you can setup a config.local
 # file that defines LIBTIFF and/or TIFFINC (used to find tiffio.h)
 #
-TIFFINC		= @TIFFINC@
+#TIFFINC		= @TIFFINC@
 LIBTIFF		= @LIBTIFF@
 TIFFBIN		= @TIFFBIN@
 #
@@ -181,7 +181,7 @@
 # insufficient to locate the library you can setup a config.local
 # file that defines LIBZ and/or ZINC (used to find zlib.h)
 #
-ZLIBINC		= @ZLIBINC@
+#ZLIBINC		= @ZLIBINC@
 LIBZ		= @LIBZ@
 #
 # regex-related definitions.  The source for the POSIX regular
@@ -232,7 +232,7 @@
 #
 # C++ flags are decomposed using the same hierarchy as C flags.
 #
-C++FLAGS	= ${CVERSION} ${VC++FLAGS} ${LC++FLAGS} ${GC++FLAGS}
+C++FLAGS	= ${CVERSION} ${VC++FLAGS} ${LC++FLAGS} ${GC++FLAGS} -D_GNU_SOURCE
 
 VC++FLAGS	= ${VC++DEFS} ${VC++INCS} ${VC++OPTS}
 LC++FLAGS	= ${LC++DEFS} ${LC++INCS} ${LC++OPTS}
--- etc/faxaddmodem.sh.in
+++ etc/faxaddmodem.sh.in
@@ -255,6 +255,14 @@
 faxGID=`$GREP "^$PROTOGID:" $GROUP | cut -d: -f3`
 if [ -z "$faxGID" ]; then faxGID=$defPROTOGID; fi
 
+if [ -x /usr/sbin/faxaddmodem.capi ]; then
+    promptForBooleanParameter no "Do you want setup a CAPI 2.0 based ISDN modem"
+    if [ "$param" = "yes" ]; then
+        /usr/sbin/faxaddmodem.capi $TTY
+   exit
+    fi
+fi
+
 DEVPATH="/dev/"
 if [ -n "`echo $TTY | grep "^/"`" ]; then
     DEVPATH=""
@@ -499,7 +507,9 @@
 setupServerParameters()
 {
     for i in $ServerParameters; do
+	set -o noglob
 	eval $i=\$default$i
+	set +o noglob
     done
 }
 
@@ -521,11 +531,11 @@
 echoServerSedCommands()
 {
     (for i in $RequiredServerParameters; do
-	eval echo \"$i:\$$i:\"
+	eval echo -e \"$i\\x00\$$i\\x00\"
      done
      for i in $OptionalServerParameters; do
-	eval echo \"$i:\$$i:\$default$i\"
-     done) | $AWK -F: '
+	eval echo -e \"$i\\x00\$$i\\x00\$default$i\"
+     done) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
@@ -657,8 +667,8 @@
 printServerConfig()
 {
     (for i in $ServerParameters; do
-	eval echo \"$i:\$$i:\$default$i\"
-    done) | $AWK -F: '
+	eval echo -e \"$i\\x00\$$i\\x00\$default$i\"
+    done) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
@@ -675,6 +685,7 @@
     echo "Reading scheduler config file $SCHEDCONFIG."
     echo ""
     getServerParameters $SCHEDCONFIG
+    schedconfig="yes"
 fi
 if [ -f $CONFIG ] || [ -z "$OLDCONFIG" ]; then
     OLDCONFIG=$CONFIG
@@ -688,6 +699,10 @@
     echo ""
     getServerParameters $MODEMCONFIG/skel # get from skeletal file
     ok="prompt"				# prompt for parameters
+    # restore overwritten allready entered values
+    if [ "$schedconfig" = "yes" ]; then
+        getServerParameters $SCHEDCONFIG
+    fi
 fi
 
 CHECK="`$GREP "AreaCode:" $SPOOL/etc/config | sed 's/.*:[	 ]*//g'`"
@@ -698,7 +713,7 @@
 if [ -n "$CHECK" ]; then
     CountryCode="$CHECK"
 fi
-if [ -z "$FAXNumber" ]; then
+if [ -z "$FAXNumber" -o "+1.999.555.1212" = "$FAXNumber" ]; then
     FAXNumber="+$CountryCode $AreaCode 555-1212"
 fi
 
@@ -834,7 +849,7 @@
     sleep 1					# wait for previous kill
     case $TARGET in
     *-linux*)	;;
-    *)	onDev $STTY 0; sleep 1	;;		# reset the modem (hopefully)
+    *)	onDev $STTY -clocal; sleep 1	;;		# reset the modem (hopefully)
     esac
 						# start listening for output
     onDev -c "$STTY clocal && exec $CAT $tdev"; sleep 2
@@ -891,12 +906,13 @@
     # reset the modem.  If something goes wrong, it'll
     # nag the user to check on the problem.
     #
-    (trap "exit 1" 1 2 15;
+    (trap "exit 1" 1 2;
      while true; do
 	sleep 10;
 	echo ""
 	echo "Hmm, something seems to be hung, check your modem eh?"
      done)& nagpid=$!
+    trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; kill $nagpid \$catpid; exit 0" 0
     trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; kill $nagpid \$catpid; exit 1" 1 2 15
     SendToModem "AT+FCLASS=?" 			# ask for class support
 
@@ -905,6 +921,7 @@
     wait $nagpid            # Really waits its end
     exec 2>&3 3>&-          # Restore stderr
 
+    trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 0" 0
     trap "$RMCMD \$JUNK; $RMCMD -r $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 1" 1 2 15
     sleep 1
 
@@ -1413,20 +1430,38 @@
     ModemCmds=""
 
     (for i in $ModemParameters; do
-	eval echo \"$i:\$$i:\$proto$i\"
+	eval x=\$$i
+	x=`echo $x | $SED 's/&/\\\\&/g'`
+	eval $i=\$x
+	eval x="\$proto$i"
+	x=`echo $x | $SED 's/&/\\\\&/g'`
+	eval proto$i=\$x
+	eval echo -e \"$i\\x00\$$i\\x00\$proto$i\"
     done
     case "$ModemType" in
     Class1*)
 	for i in $Class1Parameters; do
-	    eval echo \"$i:\$$i:\$proto$i\"
+	    eval x="\$$i"
+	    x=`echo $x | $SED 's/&/\\\\&/g'`
+	    eval $i=\$x
+	    eval x="\$proto$i"
+	    x=`echo $x | $SED 's/&/\\\\&/g'`
+	    eval proto$i=\$x
+	    eval echo -e \"$i\\x00\$$i\\x00\$proto$i\"
 	done
 	;;
     Class2*)
 	for i in $Class2Parameters; do
-	    eval echo \"$i:\$$i:\$proto$i\"
+	    eval x="\$$i"
+	    x=`echo $x | $SED 's/&/\\\\&/g'`
+	    eval $i=\$x
+	    eval x="\$proto$i"
+	    x=`echo $x | $SED 's/&/\\\\&/g'`
+	    eval proto$i=\$x
+	    eval echo -e \"$i\\x00\$$i\\x00\$proto$i\"
 	done
 	;;
-    esac) | $AWK -F: '
+    esac) | $AWK -F'\000' '
 function p(tag, value)
 {
     if (match(value, "^[^\"].*[ ]") == 0)
@@ -1482,20 +1517,20 @@
 printModemConfig()
 {
     (for i in $ModemParameters; do
-	eval echo \"$i:\$$i:\$proto$i\"
+	eval echo -e \"$i\\x00\$$i\\x00\$proto$i\"
     done
     case "$ModemType" in
     Class1*)
 	for i in $Class1Parameters; do
-	    eval echo \"$i:\$$i:\$proto$i\"
+	    eval echo -e \"$i\\x00\$$i\\x00\$proto$i\"
 	done
 	;;
     Class2*)
 	for i in $Class2Parameters; do
-	    eval echo \"$i:\$$i:\$proto$i\"
+	    eval echo -e \"$i\\x00\$$i\\x00\$proto$i\"
 	done
 	;;
-    esac) | $AWK -F: '
+    esac) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
@@ -1626,7 +1661,7 @@
 	Maximum time to wait for OK after aborting a receive (ms)
 #	Class1RecvIdentTimer	\
 	Maximum wait for initial identification frame (ms)
-#	Class1SwitchingCmd	\
+S	Class1SwitchingCmd	\
 	Command to ensure silence after receiving HDLC and before sending
 #	Class1TCFRecvTimeout	Timeout for receiving TCF (ms)
 EOF
@@ -1768,7 +1803,7 @@
 	die
     fi
 }
-$CHOWN $FAX $FIFO; $CHGRP $faxGID $FIFO; $CHMOD 600 $FIFO
+$CHOWN uucp.uucp $FIFO; $CHMOD 600 $FIFO
 if [ "$OLDFIFO" ]; then
     echo "Removing old fifo $OLDFIFO.";
     $RMCMD $OLDFIFO;
@@ -1796,6 +1831,7 @@
     InternationalPrefix
     DialStringRules
     ServerTracing
+    SessionTracing
 "
 OptionalSchedulerParameters="
     ContCoverPage
@@ -1810,7 +1846,6 @@
     SendFaxCmd
     SendPageCmd
     SendUUCPCmd
-    SessionTracing
     TimeOfDay
     Use2D
 "
@@ -1876,11 +1911,11 @@
 echoSchedulerParameters()
 {
     (for i in $RequiredSchedulerParameters; do
-	eval echo \"$i:\$$i:\"
+	eval echo -e \"$i\\x00\$$i\\x00\"
      done
      for i in $OptionalSchedulerParameters; do
-	eval echo \"$i:\$$i:\$default$i\"
-     done) | $AWK -F: '
+	eval echo -e \"$i\\x00\$$i\\x00\$default$i\"
+     done) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
@@ -1898,8 +1933,8 @@
 printSchedulerConfig()
 {
     (for i in $SchedulerParameters; do
-	eval echo \"$i:\$$i:\$default$i\"
-    done) | $AWK -F: '
+	eval echo -e \"$i\\x00\$$i\\x00\$default$i\"
+    done) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
--- etc/faxsetup.sh.in
+++ etc/faxsetup.sh.in
@@ -932,6 +932,7 @@
     (umask 077 ; mkdir $TMPDIR) || exit 1
 
     JUNK="etc/setup.tmp"
+    trap "$RM \$JUNK; $RM -r \$TMPDIR; exit 0" 0
     trap "$RM \$JUNK; $RM -r \$TMPDIR; exit 1" 1 2 15
 
     exec 5>etc/setup.tmp
@@ -2083,6 +2084,7 @@
     InternationalPrefix
     DialStringRules
     ServerTracing
+    SessionTracing
 "
 OptionalSchedulerParameters="
     ContCoverPage
@@ -2097,7 +2099,6 @@
     SendFaxCmd
     SendPageCmd
     SendUUCPCmd
-    SessionTracing
     TimeOfDay
     Use2D
 "
@@ -2126,11 +2127,11 @@
 echoSchedulerParameters()
 {
     (for i in $RequiredSchedulerParameters; do
-	eval echo \"$i:\$$i:\"
+	eval echo -e \"$i\\x00\$$i\\x00\"
      done
      for i in $OptionalSchedulerParameters; do
-	eval echo \"$i:\$$i:\$default$i\"
-     done) | $AWK -F: '
+	eval echo -e \"$i\\x00\$$i\\x00\$default$i\"
+     done) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
@@ -2148,8 +2149,8 @@
 printSchedulerConfig()
 {
     (for i in $SchedulerParameters; do
-	eval echo \"$i:\$$i:\$default$i\"
-    done) | $AWK -F: '
+	eval echo -e \"$i\\x00\$$i\\x00\$default$i\"
+    done) | $AWK -F'\000' '
 function p(tag, value)
 {
     tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
--- etc/hylafax.in
+++ etc/hylafax.in
@@ -47,6 +47,19 @@
 #
 # NB: This script assumes faxgetty processes are managed by init
 #
+### BEGIN INIT INFO
+# Provides: hylafax
+# Required-Start: $remote_fs
+# Should-Start: ypbind isdn
+# Required-Stop: $remote_fs
+# Should-Stop: ypbind isdn
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Description: Start hylafax fax server daemon
+### END INIT INFO
+
+. /etc/rc.status
+
 SPOOL=@SPOOL@
 
 test -f $SPOOL/etc/setup.cache || {
@@ -55,7 +68,7 @@
 FATAL ERROR: $SPOOL/etc/setup.cache is missing!
 
 The file $SPOOL/etc/setup.cache is not present.  This
-probably means the machine has not been setup using the faxsetup(@MANNUM1_8@)
+probably means the machine has not been setup using the faxsetup(1M)
 command.  Read the documentation on setting up HylaFAX before you
 startup a server system.
 
@@ -65,20 +78,18 @@
 . $SPOOL/etc/setup.cache
 
 # Just in case these are not in setup.cache yet
-if [ -z "$HFAXD_SERVER" ]; then
-    HFAXD_SERVER=@HFAXD_SERVER@
-fi
-if [ -z "$FAXQ_SERVER" ]; then
-    FAXQ_SERVER=@FAXQ_SERVER@
+if [ -z $HFAXD_SERVER ]; then
+    HFAXD_SERVER=1
 fi
-if [ -z "$HFAXD_SNPP_SERVER" ]; then
-    HFAXD_SNPP_SERVER=@HFAXD_SNPP_SERVER@
+if [ -z $FAXQ_SERVER ]; then
+    FAXQ_SERVER=1
 fi
 
 IS_ON=/etc/chkconfig		# NB: chkconfig is IRIX- and Linux-specific
-FAXQ=$SBIN/faxq
-HFAXD=$LIBEXEC/hfaxd
-FAXQUIT=$SBIN/faxquit
+FAXQ=@SBIN@/faxq
+HFAXD=@LIBEXEC@/hfaxd
+FAXQUIT=@SBIN@/faxquit
+KILLALL=/usr/bin/killall
 FAXPORT=hylafax			# designated port for new protocol
 SNPPPORT=444			# official port for SNPP
 
@@ -87,116 +98,67 @@
 fi
 
 if $IS_ON verbose ; then
-    ECHO=echo
+    ECHO="echo -e"
 else		# For a quiet startup and shutdown
     ECHO=:
 fi
 
-#
-# Figure out which brand of echo we have and define prompt
-# and printf shell functions accordingly.  Note that we
-# assume that if the System V-style echo is not present,
-# then the BSD printf program is available.  These functions
-# are defined here so that they can be tailored on a per-site,
-# etc. basis.
-#
-if [ `echo foo\\\c`@ = "foo@" ]; then
-    # System V-style echo supports \r
-    # and \c which is all that we need
-    printf()
-    {
-       $ECHO "$*\\c"
-    }
-elif [ "`echo -n foo`@" = "foo@" ]; then
-    # BSD-style echo; use echo -n to get
-    # a line without the trailing newline
-    printf()
-    {
-       $ECHO -n "$*"
-    }
-else
-    # something else; do without
-    printf()
-    {
-	$ECHO "$*"
-    }
-fi
-
-#
-#
-# killall -SIGNAL process-name
-#
-# Emulate the necessary functionality of the
-# killall program
-#
-killall()
-{
-	# NB: ps ax should give an error on System V, so we try it first!
-	pid="`ps ax 2>/dev/null | $AWK \"\
-		/[\/ (]$2[ )]/	{print \\$1;}
-		/[\/ ]$2\$/	{print \\$1;}\"`"
-	test "$pid" ||
-	    pid="`ps -e 2>/dev/null | $AWK \"/ $2[ ]*\$/ {print \\$1;}\"`"
-	test "$pid" && kill $1 $pid; return
-}
+# The echo return value for success (defined in /etc/rc.config).
+return=$rc_done
 
 do_start()
 {
 	if $IS_ON fax && test -x $FAXQ; then
-	    if test $FAXQ_SERVER = yes ; then
-		killall -15 faxq
-	    fi
-	    if test $HFAXD_SERVER = yes ; then
-		killall -15 hfaxd
-	    fi
-	    printf "HylaFAX:"
-            if test $FAXQ_SERVER = yes ; then
-	        $FAXQ; printf " faxq"
-            fi
-            if test $HFAXD_SERVER = yes ; then
-	        HFAXD="$HFAXD -i $FAXPORT"
-		HFAXMSG=" hfaxd"
-		if [ $HFAXD_SNPP_SERVER = yes ]; then
-	    	    HFAXD="$HFAXD -s $SNPPPORT"
-		    HFAXMSG="$HFAXMSG (with SNPP support)"
-		else
-		    HFAXMSG="$HFAXMSG (without SNPP support)"
-		fi
-		$HFAXD ; printf "$HFAXMSG"
-            fi
-	    if test $FAXQ_SERVER != yes && test $HFAXD_SERVER != yes ; then
-		printf " not started (script disabled by configure)"
-	    fi
-	    $ECHO "."
+	    echo -n "Starting service HylaFAX"
+	    killall -15 $FAXQ >/dev/null 2>&1
+	    killall -15 $HFAXD >/dev/null 2>&1
+	    /sbin/startproc $FAXQ || return=$rc_failed
+	    /sbin/startproc $HFAXD -i $FAXPORT -o 4557 -s $SNPPPORT \
+					|| return=$rc_failed
+	    echo -e "$return"
 	fi
 }
 
 do_stop ()
 {
-    $ECHO "Stopping HylaFAX Servers."
-    $FAXQUIT >/dev/null 2>&1
-    killall -15 hfaxd
+	echo -n "Shutting down service HylaFAX"
+
+ 	$FAXQUIT >/dev/null 2>&1
+	/sbin/killproc -TERM $HFAXD || return=$rc_failed
+
+	echo -e "$return"
 }
 
 case $1 in
-'start')
+start)
 	do_start
 	;;
-'stop')
+stop)
 	do_stop
 	;;
-'restart')
-	do_stop
-	sleep 2 #wait some time...
-	do_start
-	;;
-'start_msg')
-	$ECHO "Starting HylaFAX Servers."
-	;;
-'stop_msg')
-	$ECHO "Stopping HylaFAX Servers."
-	;;
+restart|force-reload)
+        ## If first returns OK call the second, if first or
+        ## second command fails, set echo return value.
+        $0 stop  &&  $0 start  ||  return=$rc_failed
+        ;;
+reload)
+        $0 stop  &&  $0 start  ||  return=$rc_failed
+        ;;
+status)
+        echo -n "Checking for service HylaFAX: "
+        ## Check status with checkproc(8), if process is running
+        ## checkproc will return with exit status 0.
+        echo -n "HylaFAX queue manager process: "
+        /sbin/checkproc $FAXQ
+	rc_status -v
+        echo -n "HylaFAX client-server protocol server: "
+        /sbin/checkproc $HFAXD
+	rc_status -v
+        ;;
 *)
-	$ECHO "usage: hylafax {start|stop|restart|start_msg|stop_msg}"
+	echo "usage: /etc/init.d/hylafax {start|stop|status|restart|reload}"
 	;;
 esac
+
+rc_exit
+
--- etc/probemodem.sh.in
+++ etc/probemodem.sh.in
@@ -133,6 +133,7 @@
 # Lock the device for later use when deducing the modem type.
 #
 JUNK="$LOCKX $OUT"
+trap "@RM@ -f $JUNK; @RM@ -fr $TMPDIR; exit 0" 0
 trap "@RM@ -f $JUNK; @RM@ -fr $TMPDIR; exit 1" 1 2 15
 
 LOCKSTR=`expr "         $$" : '.*\(..........\)'`
@@ -212,7 +213,7 @@
     sleep 1					# wait for previous kill
     case $TARGET in    
     *-linux*)	;;
-    *)	onDev $STTY 0; sleep 1	;;		# reset the modem (hopefully)
+    *)	onDev $STTY -clocal; sleep 1	;;		# reset the modem (hopefully)
     esac
 						# start listening for output
     onDev -c "$STTY clocal && exec $CAT $tdev"; sleep 2
@@ -270,12 +271,13 @@
     # reset the modem.  If something goes wrong, it'll
     # nag the user to check on the problem.
     #
-    (trap "exit 1" 1 2 15;
+    (trap "exit 1" 1 2;
      while true; do
 	sleep 10;
 	echo ""
 	echo "Hmm, something seems to be hung, check your modem eh?"
      done)& nagpid=$!
+    trap "@RM@ -f \$JUNK; @RM@ -fr $TMPDIR; kill $nagpid \$catpid; exit 0" 0
     trap "@RM@ -f \$JUNK; @RM@ -fr $TMPDIR; kill $nagpid \$catpid; exit 1" 1 2 15
 
     if [ x"$ATCMD" != x"" ]; then
@@ -289,6 +291,7 @@
     wait $nagpid		# Really waits its end
     exec 2>&3 3>&-		# Restore stderr
 
+    trap "@RM@ -f \$JUNK; @RM@ -fr $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 0" 0
     trap "@RM@ -f \$JUNK; @RM@ -fr $TMPDIR; test \"\$catpid\" && kill \$catpid; exit 1" 1 2 15
     sleep 1
 
--- libhylafax/typerules
+++ libhylafax/typerules
@@ -147,8 +147,7 @@
 0	string		WNGZWZSS	error	Wingz spreadsheet support not configured
 0       string          #Inventor V	error	IRIS Inventor file support not configured
 >15     string          binary		error	binary IRIS Inventor file support not configured
->15     string          ascii		ps	%F/textfmt -B -f Courier-Bold\
-						-Ml=0.4in -p 11 -s %s >%o <%i
+>15     string          ascii		ps	%F/a2pswrap %s %o %i
 #
 0	string		\x89PNG		error	PNG support not configured
 0	short		0xffd8		error	filetype conversion support not configured
@@ -186,5 +185,4 @@
 
 #  Support 7-bit text which would otherwise be seen as binary.
 #
-#0	byte		x		ps	%F/textfmt -B -f Courier-Bold \
-#							  -p 11 -s %s >%o <%i
+0	ascii		x		ps	%F/a2pswrap %s %o %i
--- man/faxrcvd.1m
+++ man/faxrcvd.1m
@@ -75,7 +75,7 @@
 .SH NOTES
 This script can route facsimile directly to the intended recipient.
 To do this create a shell script
-.B etc/FaxDispatch
+.B bin/FaxDispatch
 in the spooling area that sets
 .I SENDTO
 to the receiver's electronic mail address.  For example,
--- port/install.sh.in
+++ port/install.sh.in
@@ -210,7 +210,7 @@
 	    do_chXXX $CHGRP $target
 	fi
 	$VERBOSE "$CHMOD $target"
-	do_chXXX $CHMOD $target
+	$CHMOD $target
 	if [ $STRIP != ":" ] && [ -x $ROOT$DESTDIR$f ]; then
 	    $STRIP $target >/dev/null 2>&1 || true
 	    $VERBOSE "$STRIP $target"
--- util/faxcron.sh.in
+++ util/faxcron.sh.in
@@ -37,9 +37,11 @@
 # 4. Notify about sites that currently have jobs rejected.
 #
 
+/usr/sbin/rchylafax status &>/dev/null || exit 0
+
 AGEINFO=30			# purge remote info after 30 days inactivity
 AGELOG=30			# keep log info for last 30 days
-AGERCV=7			# purge received facsimile after 7 days
+AGERCV=9999			# purge received facsimile after 9999 days
 AGETMP=1			# purge orphaned temp files after 1 day
 FAXUSER=@FAXUID@		# owner of log files
 LOGMODE=0644			# mode for log files
openSUSE Build Service is sponsored by