mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
321704296f
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>
90 lines
1.6 KiB
Bash
Executable File
90 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#---------------------------------------------------------------------------
|
|
#
|
|
# tell called and calling numbers answer script for i4b isdnd
|
|
# -----------------------------------------------------------
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# last edit-date: [Thu May 20 11:45:21 1999]
|
|
#
|
|
#---------------------------------------------------------------------------
|
|
VARDIR=/var/isdn
|
|
|
|
#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS
|
|
#LIBDIR=/usr/local/lib/isdn
|
|
#FreeBSD 3.1 and up
|
|
LIBDIR=/usr/share/isdn
|
|
|
|
LOGFILE=/tmp/answer.log
|
|
NCALLFILE=${VARDIR}/ncall
|
|
DATE=`date +%d%H`
|
|
DF=0
|
|
dF=0
|
|
sF=0
|
|
|
|
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
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo "" >>${LOGFILE}
|
|
|
|
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
|
|
|
|
echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE}
|
|
|
|
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} : '.*'`
|
|
|
|
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 [ -r "${LIBDIR}/beep.al" ]; then
|
|
dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k >/dev/null 2>&1
|
|
fi
|
|
|
|
dd if=${DEVICE} of=${VARDIR}/recorded.msg bs=2k
|