home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1820 / talkanswer < prev    next >
Encoding:
Text File  |  1990-12-28  |  739 b   |  31 lines

  1. #!/bin/sh
  2. TERM=vt100;export TERM
  3. {
  4.   /bin/setuid "$1" touch /tmp/talkans.$$
  5.   until grep -s stablished /tmp/talkans.$$
  6.   do
  7.     sleep 3
  8.   done
  9.   /bin/setuid "$1" rm /tmp/talkans.$$
  10.   echo "This is the talkanswer system, answering for $1."
  11.   echo "Please leave your name after the beep."
  12.   echo "<beep>"
  13.   sleep 300
  14.   echo ""
  15.   echo "Thirty seconds left on the tape."
  16.   sleep 30
  17.   echo ""
  18.   echo "Thank you for calling."
  19.   echo "<beep>"
  20.   echo x | tr x '\003'
  21. } | {
  22.   echo "From: $2@$3"
  23.   echo "To: $1"
  24.   echo ""
  25.   /bin/setuid "$1" /usr/local/pty -dxuR /usr/ucb/talk "$2@$3" 2>&1
  26. } | {
  27.   /bin/setuid "$1" awk '{ print }
  28. /stablished/ { print "established" >"/tmp/talkans.'$$'" }'
  29. } | /usr/lib/sendmail -f"$2@$3" -F"talkanswer" "$1" &
  30. exit 0
  31.