Changelog since HylaFAX 4.3.0
+* Use ] && [ instead of -a for shell portability (2 Jun 2006)
* Add continuation support to FaxClient in libfaxutil (31 May 2006)
* Add UseJobTagLine config option for faxsend (4 Apr 2006)
REASON=`find $CONFIG_FILES -newer config.cache -print 2>/dev/null`
test "$REASON" && REASON="$REASON has been updated"
fi
-if [ "$REASON" -a -f config.cache ]; then
+if [ "$REASON" ] && [ -f config.cache ]; then
Note "Flushing cached parameters because $REASON."
Note ""
rm -f config.cache
{
t="$1"; app=$1; path=$2;
case $app in
- /*) eval test -x $app -a ! -d $app && { echo $app; return; };;
+ /*) eval test -x $app && test ! -d $app && { echo $app; return; };;
esac
IFS=:
for i in $path; do
- eval test -x $i/$app -a ! -d $i/$app && { echo $i/$app; return 0; }
+ eval test -x $i/$app && test ! -d $i/$app && { echo $i/$app; return 0; }
done
return 1
}
if [ ${GCCmajor} -gt $2 ]; then
return 0
fi
- if [ ${GCCmajor} -eq $2 -a ${GCCminor} -ge $3 ]; then
+ if [ ${GCCmajor} -eq $2 ] && [ ${GCCminor} -ge $3 ]; then
return 0
fi
fi
Note "Done checking TIFF support."
# NB: only check if we have the MLA tools
-if [ -f $SRCDIR/MLA/VERSION -a $DBLIB = no ]; then
+if [ -f $SRCDIR/MLA/VERSION ] && [ $DBLIB = no ]; then
Note ""
Note "Checking LIBDB support."
#
getGSFonts()
{
- if [ ! "$PS" = gs -a -n $PATH_PSRIP ];then
+ if [ ! "$PS" = gs ] && [ -n $PATH_PSRIP ];then
return 1
fi
$PATH_PSRIP -h | $AWK -F '[ ]' '
test -x $1 || bitchExecutable $1
}
-if [ $QUIET = no -a $INTERACTIVE != no ]; then
+if [ $QUIET = no ] && [ $INTERACTIVE != no ]; then
Note "Press Return to Continue "
read ok
fi
DEPEND="$DEPEND html html/tools"
fi
test -f $SRCDIR/MLA/VERSION && DEPEND="$DEPEND MLA"
- test -d $SRCDIR/faxview -a -d faxview && DEPEND="$DEPEND faxview"
+ test -d $SRCDIR/faxview && test -d faxview && DEPEND="$DEPEND faxview"
for i in $DEPEND; do
test -f $i/Makedepend || cp /dev/null $i/Makedepend
done
# Test selected modem speed against a list of known standards
-if [ "$SPEED" != "" -a "$SPEED" != 38400 -a "$SPEED" != 19200 \
- -a "$SPEED" != 9600 -a "$SPEED" != 4800 -a "$SPEED" != 2400 \
- -a "$SPEED" != 1200 ]; then
+if [ "$SPEED" != "" ] && [ "$SPEED" != 38400 ] && [ "$SPEED" != 19200 ] \
+ && [ "$SPEED" != 9600 ] && [ "$SPEED" != 4800 ] && [ "$SPEED" != 2400 ] \
+ && [ "$SPEED" != 1200 ]; then
cat<<EOF
Warning, you have selected a DTE-DCE communication rate ($SPEED) that
#
euid=`id|$SED -e 's/.*uid=[0-9]*(\([^)]*\)).*/\1/'`
test -z "$euid" && euid=`(whoami) 2>/dev/null`
-test -z "$euid" -a -w /dev && euid=root
+test -z "$euid" && test -w /dev && euid=root
if [ "$euid" != "root" ]; then
echo "Sorry, but you must run this script as the super-user!"
exit 1
faxGID=`$GREP "^$PROTOGID:" $GROUP | cut -d: -f3`
if [ -z "$faxGID" ]; then faxGID=$defPROTOGID; fi
-while [ -z "$TTY" -o ! -c /dev/$TTY ]; do
+while [ -z "$TTY" ] || [ ! -c /dev/$TTY ]; do
test "$TTY" != "" && echo "/dev/$TTY is not a terminal device."
prompt "Serial port that modem is connected to [$TTY]?"; read TTY
done
echo ""
getServerParameters $SCHEDCONFIG
fi
-if [ -f $CONFIG -o -z "$OLDCONFIG" ]; then
+if [ -f $CONFIG ] || [ -z "$OLDCONFIG" ]; then
OLDCONFIG=$CONFIG
fi
if [ -f $OLDCONFIG ]; then
isOK()
{
x="$1"
- test -z "$x" -o "$x" = y -o "$x" = yes
+ test -z "$x" || test "$x" = y || test "$x" = yes
}
isNotOK()
{
x="$1"
- test -n "$x" -a "$x" != y -a "$x" != yes
+ test -n "$x" && test "$x" != y && test "$x" != yes
}
#
checkOctalNumber $DeviceMode && DeviceMode=$param
checkForLocalFile $DialStringRules "dial string rules"
checkFaxNumber;
- if [ "$TagLineFont" != "" -a "$TagLineFont" != '""' ]; then
+ if [ "$TagLineFont" != "" ] && [ "$TagLineFont" != '""' ]; then
checkForLocalFile $TagLineFont "tag line font";
fi
printServerConfig; prompt "Are these ok [yes]?"; read ok
{
case "$ModemFlowControl" in
xonxoff|XONXOFF)
- if [ "$TTY" = ttyf${PORT} -a -c /dev/ttym${PORT} ]; then
+ if [ "$TTY" = ttyf${PORT} ] && [ -c /dev/ttym${PORT} ]; then
echo ""
echo "Warning, the modem is setup to use software flow control,"
echo "but the \"$TTY\" device is used with hardware flow control"
fi
;;
rtscts|RTSCTS)
- if [ "$TTY" = ttym${PORT} -a -c /dev/ttyf${PORT} ]; then
+ if [ "$TTY" = ttym${PORT} ] && [ -c /dev/ttyf${PORT} ]; then
echo ""
echo "Warning, the modem is setup to use hardware flow control,"
echo "but the \"$TTY\" device does not honor the RTS/CTS signals."
. $PROMPTS
fi
checkForLocalFile $DialStringRules "dial string rules"
- if [ "$DestControls" != "" -a "$DestControls" != '""' ]; then
+ if [ "$DestControls" != "" ] && [ "$DestControls" != '""' ]; then
checkForLocalFile $DestControls "destination controls";
fi
printSchedulerConfig; prompt "Are these ok [yes]?"; read ok
checkIRIXPort()
{
devID="`echo $1 | tr '/' '_'`"
- if [ -f $CPATH.$devID -a -p $SPOOL/FIFO.$devID ]; then
+ if [ -f $CPATH.$devID ] && [ -p $SPOOL/FIFO.$devID ]; then
echo "There appears to be a modem already setup on $devID,"
prompt "is this to be replaced [yes]?"
read x;
fi
# if nothing specified on command line, default client+server
-if [ $isClient = no -a $isServer = no ]; then
+if [ $isClient = no ] && [ $isServer = no ]; then
isClient=yes
isServer=yes
fi
# NB: some systems override these function definitions through
# per-os faxsetup files
#
- if [ -f /bin/passmgmt -o -f /usr/sbin/passmgmt ]; then
+ if [ -f /bin/passmgmt ] || [ -f /usr/sbin/passmgmt ]; then
addPasswd()
{
passmgmt -o -a -c 'Facsimile Agent' -h $4 -u $2 -g $3 $1
q
_EOF
}
- elif [ -f /usr/sbin/useradd -o -f /etc/useradd ]; then
+ elif [ -f /usr/sbin/useradd ] || [ -f /etc/useradd ]; then
addPasswd()
{
useradd -c 'Facsimile Agent' -d $4 -u $2 -o -g $3 $1
REASON=`find $CONFIG_FILES -newer $DIR_SPOOL/etc/setup.cache -print 2>/dev/null`
test "$REASON" && REASON="$REASON has been updated"
fi
- if [ "$REASON" -a -f $DIR_SPOOL/etc/setup.cache ]; then
+ if [ "$REASON" ] && [ -f $DIR_SPOOL/etc/setup.cache ]; then
Note "Flushing cached parameters because $REASON."
Note ""
rm -f $DIR_SPOOL/etc/setup.cache
#
euid=`id|$SED -e 's/.*uid=[0-9]*(\([^)]*\)).*/\1/'`
test -z "$euid" && euid=`(whoami) 2>/dev/null`
-test -z "$euid" -a -w /dev && euid=root
+test -z "$euid" && test -w /dev && euid=root
if [ "$euid" != "root" ]; then
bitch "Sorry, but you must run this script as the super-user!"
boom
isOK()
{
x="$1"
- test -z "$x" -o "$x" = y -o "$x" = yes
+ test -z "$x" || test "$x" = y || test "$x" = yes
}
if onServer; then
true
fi
fi
- if [ -f $INETDCONF -a $HFAXD_SERVER = no ]; then
+ if [ -f $INETDCONF ] && [ $HFAXD_SERVER = no ]; then
E="hylafax stream tcp nowait root $DIR_LIBEXEC/hfaxd hfaxd -I"
editInetdConf()
{
}
eval `$GREP '^hylafax[ ]*stream[ ]*tcp' $INETDCONF | \
$AWK -F'[ ]+' '{ print "F=" $6 "; U=" $5 }' 2>/dev/null`
- if [ -z "$F" -a -z "$U" ]; then
+ if [ -z "$F" ] && [ -z "$U" ]; then
cat<<EOF
EOF
prompt "Should an entry be added to $INETDCONF [no]?"; read x
- if [ "$x" = y -o "$x" = yes ]; then
+ if [ "$x" = y ] || [ "$x" = yes ]; then
echo "$E" >>$INETDCONF;
signalINETD=yes
fi
isOK "$x" && editInetdConf
fi
fi
- elif [ ! -f $INETDCONF -a $HFAXD_SERVER = no ]; then
+ elif [ ! -f $INETDCONF ] && [ $HFAXD_SERVER = no ]; then
cat<<EOF
#
if onServer; then
x=`(ypcat -k aliases) 2>/dev/null | $GREP -i '^faxmaster'` 2>/dev/null
- if [ -z "$x" -a -f $ALIASES ]; then
+ if [ -z "$x" ] && [ -f $ALIASES ]; then
x=`$GREP -i '^faxmaster' $ALIASES`
fi
if [ -z "$x" ]; then
isNotOK()
{
x="$1"
- test "$x" != y -a "$x" != yes
+ test "$x" != y && test "$x" != yes
}
CONFIG=$DIR_SPOOL/etc/config # faxq config file
. $PROMPTS
fi
checkForLocalFile $DialStringRules "dial string rules"
- if [ "$DestControls" != "" -a "$DestControls" != '""' ]; then
+ if [ "$DestControls" != "" ] && [ "$DestControls" != '""' ]; then
checkForLocalFile $DestControls "destination controls";
fi
printSchedulerConfig; prompt "Are these ok [yes]?"; read ok
fi
fi
- if [ "$FAXQ" -o "$FAXD" ]; then
+ if [ "$FAXQ" ] || [ "$FAXD" ]; then
cat<<EOF
FATAL ERROR: Old server processes still running!
fi
DEVS="`cd $DIR_SPOOL/etc; echo config.*`"
- if [ -z "$DEVS" -o "$DEVS" = 'config.*' ]; then
+ if [ -z "$DEVS" ] || [ "$DEVS" = 'config.*' ]; then
cat<<EOF
You do not appear to have any modems configured for use. Modems are
DEVS="`cd $DIR_SPOOL/etc; echo config.*`"
fi
- if [ -n "$DEVS" -a "$DEVS" != 'config.*' ]; then
+ if [ -n "$DEVS" ] && [ "$DEVS" != 'config.*' ]; then
FAXGETTY="`findproc faxgetty`"
if [ "$FAXGETTY" ]; then
cat<<EOF
fi
$HFAXD ; printf "$HFAXMSG"
fi
- if test $FAXQ_SERVER != yes -a $HFAXD_SERVER != yes ; then
+ if test $FAXQ_SERVER != yes && test $HFAXD_SERVER != yes ; then
printf " not started (script disabled by configure)"
fi
$ECHO "."
ONDELAY=$LIBEXEC/ondelay # prgm to open devices blocking on carrier
CAT="$CAT -u" # something to do unbuffered reads and writes
-while [ -z "$TTY" -o ! -c /dev/$TTY ]; do
+while [ -z "$TTY" ] || [ ! -c /dev/$TTY ]; do
if [ "$TTY" != "" ]; then
echo "/dev/$TTY is not a terminal device."
fi
install()
{
src=$1 target=$2
- if [ $RemoveFirst = yes -a -f $target ]; then
+ if [ $RemoveFirst = yes ] && [ -f $target ]; then
$VERBOSE "$RM $target"
$RM $target
fi
- if [ $SaveFirst = yes -a -f $target ]; then
+ if [ $SaveFirst = yes ] && [ -f $target ]; then
bf=`echo $src | @SED@ 's;.*/;;'`
$VERBOSE "$MV $target $ROOT/$DESTDIR/OLD$bf"
$MV $target $ROOT/$DESTDIR/OLD$bf
fi
- if [ -z "$SRC" -a $HasSource = yes ]; then
+ if [ -z "$SRC" ] && [ $HasSource = yes ]; then
$VERBOSE "$CMD $preopts $src $target $postopts"
$CMD $preopts $f $target $postopts
elif [ $SaveFirst = no ] && objectExists $target; then
fi
$VERBOSE "$CHMOD $target"
do_chXXX $CHMOD $target
- if [ $STRIP != ":" -a -x $ROOT$DESTDIR$f ]; then
+ if [ $STRIP != ":" ] && [ -x $ROOT$DESTDIR$f ]; then
$STRIP $target >/dev/null 2>&1 || true
$VERBOSE "$STRIP $target"
fi
for f in $TARGETS; do
t=$ROOT$DESTDIR$f
if [ -f $t ]; then
- if [ -z "$SRC" -a $HasSource = yes ]; then
+ if [ -z "$SRC" ] && [ $HasSource = yes ]; then
$CMP -s $f $t || {
$ECHO "*** Warning, target has local changes, installing $f as $t.N"
install $f $t.N;
for f in $TARGETS; do
t=$ROOT$DESTDIR$f
if [ -f $t ]; then
- if [ -z "$SRC" -a $HasSource = yes ]; then
+ if [ -z "$SRC" ] && [ $HasSource = yes ]; then
$CMP -s $f $t || $MV $t $t.O
else
$CMP -s $SRC $t || $MV $t $t.O
errors) NOTIFY_FAXMASTER=no;;
*) NOTIFY_FAXMASTER=yes;;
esac
- if [ "$TOADDR" != "$SENDTO" -a "$NOTIFY_FAXMASTER" != "no" ]; then
+ if [ "$TOADDR" != "$SENDTO" ] && [ "$NOTIFY_FAXMASTER" != "no" ]; then
(echo "Mime-Version: 1.0"
echo "Content-Type: text/plain; charset=$CHARSET"
echo "Content-Transfer-Encoding: quoted-printable"
#
# Return mail to the submitter of a job when notification is needed.
#
-if [ $# != 3 -a $# != 4 ]; then
+if [ $# != 3 ] && [ $# != 4 ]; then
echo "Usage: $0 qfile why jobtime [nextTry]"
exit 1
fi
#
# Return mail to the submitter of a job when notification is needed.
#
-if [ $# != 3 -a $# != 4 ]; then
+if [ $# != 3 ] && [ $# != 4 ]; then
echo "Usage: $0 qfile why jobtime [nextTry]"
exit 1
fi
if [ -n "$commid" ] ; then
printItem "%s" "$DICTCOMMID" "$commid"
fi
- if [ "$modem" != "any" -a "$RETURNTECHINFO" = "yes" ] ; then
+ if [ "$modem" != "any" ] && [ "$RETURNTECHINFO" = "yes" ] ; then
printItem "%s" "$DICTMODEM" "$modem"
fi
printItem "%s" "$DICTSUBMITTEDFROM" "$client"
- if [ "$jobtype" = "facsimile" -a "$RETURNTECHINFO" = "yes" ] ; then
+ if [ "$jobtype" = "facsimile" ] && [ "$RETURNTECHINFO" = "yes" ] ; then
printItem "%u (mm)" "$DICTPAGEWIDTH" "$pagewidth"
printItem "%.0f (mm)" "$DICTPAGELENGTH" "$pagelength"
printItem "%.0f (lpi)" "$DICTRES" "$resolution"
printItem "%u ($DICTTOTALPAGES)" "$DICTTOTPAGES" "$totpages"
printItem "%u ($DICTATTEMPTSPAGE)" "$DICTATTEMPTS" "$ntries"
printItem "%u ($DICTDIRNEXTPAGE)" "$DICTDIRNUM" "$dirnum"
- if [ $nfiles -gt 0 -a "$RETURNTECHINFO" = "yes" ] ; then
+ if [ $nfiles -gt 0 ] && [ "$RETURNTECHINFO" = "yes" ] ; then
printBanner "$DICTDOCSSUBMITTED"
eval echo "$DICTDOCSTEXT1"
eval echo "$DICTDOCSTEXT2"
printf "%15s\n" "$DICTPIN" $pin
done
fi
- if [ $nfiles -ne 0 -a -s $files_0 ] ; then
+ if [ $nfiles -ne 0 ] && [ -s $files_0 ] ; then
printBanner "$DICTMESSAGETEXT"
cat $files_0
fi
printItem "%s" "$DICTCOMMID" "c$commid"
printf "\n$DICTPROCESSINGTIME %s.\n" "$JTIME"
fi
- if [ -n "$faxstatus" -a "$RETURNTRANSCRIPT" = "yes" ] ; then
+ if [ -n "$faxstatus" ] && [ "$RETURNTRANSCRIPT" = "yes" ] ; then
# use -e in echo to interpret escape characters in faxstatus
echo "$DICTADDITIONALINFO"
printStatus " $faxstatus"
REFORMAT) # only need format conversion (e.g. g4->g3)
$TIFFCP -i -c $df -f lsb2msb -r 9999 $fil $out
# libtiff 3.5.7 gives exit status 9 when there are unknown tags...
- if [ $? != 0 -a $? != 9 ]; then {
+ if [ $? != 0 ] && [ $? != 9 ]; then {
$CAT<<EOF
Unexpected failure converting TIFF document; the command
# Disable faxgetty
# NB: this is for an System V-style system.
#
- if [ -f /etc/inittab -a -n "$WEDGED_DISABLE_FAXGETTY" ]; then
+ if [ -f /etc/inittab ] && [ -n "$WEDGED_DISABLE_FAXGETTY" ]; then
ed - /etc/inittab<<EOF
/^[^#].*:respawn:.*faxgetty .*$tty/s/respawn/off/
w