Example dial script.
sources-request at panda.UUCP
sources-request at panda.UUCP
Thu Feb 13 04:43:11 AEST 1986
Mod.sources: Volume 3, Issue 123
Submitted by: "Oliver Laumann" <seismo!unido!tub!net>
I forgot to include the sample dial script in the dial distribution.
I'm sorry about that. Here it comes:
--
Oliver Laumann net at DB0TUI6.BITNET net at tub.UUCP
------------------cut here------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# example
# This archive created: Wed Feb 12 13:14:28 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'example'" '(2386 characters)'
if test -f 'example'
then
echo shar: will not over-write existing file "'example'"
else
cat << \SHAR_EOF > 'example'
# Example for a dial script.
#
# Connect to a remote UNIX machine through a PABX and obtain certain
# information from a server account (`qomnews') on this machine.
# The line through which the PABX can be accessed is defined in
# /etc/remote under the name `pabx', thus...
line=pabx
# If the PABX receives ^A^B+, it responds with D+ indicating that
# it is ready to accept a phone number.
# Due to a bug in the PABX software, it sometimes responds with
# two beeps; In this case, there is nothing we can do exept quit
# and fix it by hand...
prolog \1\2+ 1
dial D+
exit \7\7 "Go buy a new PABX!\n"
exit # "No response from PABX.\n"
# Send the phone number of the remote UNIX machine. Sleep 0.1 seconds
# before actually transmitting the number (otherwise the PABX gets angry).
# If we receive a V followed by a three-digit number and a plus sign,
# the connection has been established successfully. Several responses
# of the form <letter>+ are used by the PABX to indicate that something
# went wrong; these reponses are translated into useful messages.
dial 618\r 5,.1
exit B+ "Port busy -- try later.\n"
exit N+ "Out of order.\n"
exit E+ "Invalid phone number.\n"
connected V...+
exit # "Connection failed.\n"
# Transmit a carriage return in order to get the login prompt.
connected \r 5,.1
login "login: "
exit # "Login failed.\n"
# Login at the remote machine using the login name `qomnews'.
login qomnews\r
enter "name? "
exit # "QOM news server down.\n"
# The qomnews server prompts for a user name. The name is obtained
# from the file .qomid from the caller's home directory.
# Note that a time-out of 15 seconds is scheduled in order to give
# the server a resonable time for the response.
# If all goes well, the server transmits a number of lines of the form
# You have <n> unseen letters
# You have <n> unseen entries in XYZ
# or simply
# You have seen all the news.
# If the first `You' has been received, enter the `data' loop below.
enter "${~/.qomid}" 15
data \r\n\r\nYou You
exit O+ "Early disconnect."
exit # "QOM news server is hung.\n"
# Print all data received from the remote machine on standard output
# until either a time-out of 5 seconds occurs or the disconnect message
# O+ is received.
data "" 5
exit O+
data * &
SHAR_EOF
if test 2386 -ne "`wc -c < 'example'`"
then
echo shar: error transmitting "'example'" '(should have been 2386 characters)'
fi
fi # end of overwriting check
# End of shell archive
exit 0
More information about the Mod.sources
mailing list