summaryrefslogtreecommitdiffstats
path: root/etc/isdn/tell
diff options
context:
space:
mode:
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