summaryrefslogtreecommitdiffstats
path: root/etc/isdn/isdntel.sh
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/isdntel.sh
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/isdntel.sh')
-rwxr-xr-xetc/isdn/isdntel.sh61
1 files changed, 27 insertions, 34 deletions
diff --git a/etc/isdn/isdntel.sh b/etc/isdn/isdntel.sh
index d76885d..14f528a 100755
--- a/etc/isdn/isdntel.sh
+++ b/etc/isdn/isdntel.sh
@@ -17,9 +17,9 @@ LIBDIR=/usr/share/isdn
VARDIR=/var/isdn
DEVICE=/dev/i4btel0
-# sounds
-MESSAGE=$LIBDIR/msg.al
-BEEP=$LIBDIR/beep.al
+# sounds
+MESSAGE=${LIBDIR}/msg.al
+BEEP=${LIBDIR}/beep.al
# dd options
SKIP=25
@@ -35,36 +35,32 @@ dst=
DATE=`date`
# check if directory exists
-if [ ! -d $VARDIR ]
+if [ ! -d "${VARDIR}" ]
then
- mkdir $VARDIR
+ mkdir ${VARDIR}
fi
# get options
-set -- `/usr/bin/getopt D:d:s: $*`
-
-if [ $? != 0 ]
-then
+if ! set -- `/usr/bin/getopt D:d:s: $*`; then
echo "usage2: play -D device -d <dest-telno> -s <src-telno>"
exit 1
fi
# process options
-for i
-do
+for i ; do
case $i in
- -D)
- DEVICE=$2; shift; shift;
- ;;
- -d)
- dst=$2; shift; shift;
- ;;
- -s)
- src=$2; shift; shift;
- ;;
- --)
- shift; break;
- ;;
+ -D)
+ DEVICE=$2; shift; shift;
+ ;;
+ -d)
+ dst=$2; shift; shift;
+ ;;
+ -s)
+ src=$2; shift; shift;
+ ;;
+ --)
+ shift; break;
+ ;;
esac
done
@@ -73,33 +69,30 @@ done
FILEDATE=`date \+%y%m%d%H%M%S`
# echo message to phone
-if [ -f $MESSAGE ]
-then
- /bin/dd of=$DEVICE if=$MESSAGE bs=2k >/dev/null 2>&1
+if [ -r "${MESSAGE}" ]; then
+ /bin/dd of=${DEVICE} if=${MESSAGE} bs=2k >/dev/null 2>&1
fi
# echo beep to phone
-if [ -f $BEEP ]
-then
- /bin/dd of=$DEVICE if=$BEEP bs=2k >/dev/null 2>&1
+if [ -r "${BEEP}" ]; then
+ /bin/dd of=${DEVICE} if=${BEEP} bs=2k >/dev/null 2>&1
fi
# start time
START=`date \+%s`
# get message from caller
-/bin/dd if=$DEVICE of=$VARDIR/$FILEDATE-$dst-$src skip=$SKIP bs=2k count=$MAXMSIZ >/dev/null 2>&1
+/bin/dd if=${DEVICE} of=${VARDIR}/${FILEDATE}-${dst}-${src} skip=${SKIP} bs=2k count=${MAXMSIZ} >/dev/null 2>&1
# end time
END=`date \+%s`
# duration
-TIME=`expr $END - $START`
+TIME=`expr ${END} - ${START}`
# save recorded message
-if [ -f $VARDIR/$FILEDATE-$dst-$src ]
-then
- mv $VARDIR/$FILEDATE-$dst-$src $VARDIR/$FILEDATE-$dst-$src-$TIME
+if [ -r "${VARDIR}/${FILEDATE}-${dst}-${src}" ]; then
+ mv ${VARDIR}/${FILEDATE}-${dst}-${src} ${VARDIR}/${FILEDATE}-${dst}-${src}-${TIME}
fi
exit 0
OpenPOWER on IntegriCloud