summaryrefslogtreecommitdiffstats
path: root/etc/isdn/tell
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-09-13 15:44:20 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-09-13 15:44:20 +0000
commitd8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663 (patch)
treef61d8b7d858e07792674c281853167482e6806c5 /etc/isdn/tell
parent019fd9cb5fe17ed3ce93a28306ec3009d2a512f7 (diff)
downloadFreeBSD-src-d8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663.zip
FreeBSD-src-d8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663.tar.gz
Apply a consistent style to most of the etc scripts. Particularly, use
case instead of test where appropriate, since case allows case is a sh builtin and (as a side-effect) allows case-insensitivity. Changes discussed on freebsd-hackers. Submitted by: Doug Barton <Doug@gorean.org>
Diffstat (limited to 'etc/isdn/tell')
-rwxr-xr-xetc/isdn/tell90
1 files changed, 40 insertions, 50 deletions
diff --git a/etc/isdn/tell b/etc/isdn/tell
index 7bdd10a..047c834 100755
--- a/etc/isdn/tell
+++ b/etc/isdn/tell
@@ -17,81 +17,71 @@ VARDIR=/var/isdn
LIBDIR=/usr/share/isdn
LOGFILE=/tmp/answer.log
-NCALLFILE=$VARDIR/ncall
+NCALLFILE=${VARDIR}/ncall
DATE=`date +%d%H`
DF=0
dF=0
sF=0
-set -- `getopt D:d:s: $*`
-
-if test $? != 0
-then
+if ! set -- `getopt D:d:s: $*`; then
echo 'Usage: answer -D device -d destination -s source'
exit 1
fi
-for i
-do
- case "$i"
- in
- -D)
- DEVICE=$2
- DF=1
- shift
- shift
- ;;
- -d)
- DEST=$2
- dF=1
- shift
- shift
- ;;
- -s)
- SRC=$2
- sF=1
- shift
- shift
- ;;
- --)
- shift
- break
- ;;
+for i ; do
+ case ${i} in
+ -D)
+ DEVICE=$2
+ DF=1
+ shift
+ shift
+ ;;
+ -d)
+ DEST=$2
+ dF=1
+ shift
+ shift
+ ;;
+ -s)
+ SRC=$2
+ sF=1
+ shift
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
esac
done
-echo "" >>$LOGFILE
+echo "" >>${LOGFILE}
-if [ $DF -eq 0 -o $dF -eq 0 -o $sF -eq 0 ]
-then
+if [ "${DF}" -eq 0 -o "${dF}" -eq 0 -o "${sF}" -eq 0 ]; then
echo 'Usage: answer -D device -d destination -s source'
exit 1
-fi
+fi
-echo "answer: device $DEVICE destination $DEST source $SRC " >>$LOGFILE
+echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE}
-if [ -f $LIBDIR/beep.al ]
-then
- dd of=$DEVICE if=$LIBDIR/beep.al bs=2k >/dev/null 2>&1
+if [ -r "${LIBDIR}/beep.al" ]; then
+ dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1
fi
# tell the caller the number he is calling from
POS=1
-LENGTH=`expr $SRC : '.*'`
+LENGTH=`expr ${SRC} : '.*'`
-while :
-do
- DIGIT=`echo $SRC | cut -c $POS`
- /bin/dd of=$DEVICE if=$LIBDIR/$DIGIT.al bs=2k >/dev/null 2>&1
- POS=`expr $POS + 1`
- if [ $POS -gt $LENGTH ]
- then
+while : ; do
+ DIGIT=`echo ${SRC} | cut -c ${POS}`
+ /bin/dd of=${DEVICE} if=${LIBDIR}/${DIGIT}.al bs=2k >/dev/null 2>&1
+ POS=`expr ${POS} + 1`
+ if [ "${POS}" -gt "${LENGTH}" ]; then
break
fi
done
-if [ -f $LIBDIR/beep.al ]
-then
- dd of=$DEVICE if=$LIBDIR/beep.al bs=2k >/dev/null 2>&1
+if [ -r "${LIBDIR}/beep.al" ]; then
+ dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1
fi
OpenPOWER on IntegriCloud