[mod.sources] v06i086: System V generic dial routines

sources-request@mirror.UUCP (08/04/86)

Submitted by: ihnp4!quest!gene
Mod.sources: Volume 6, Issue 86
Archive-name: sysVdial/Part1

[  I did not try to compile this, as we run BSD exlusively.  It appears
   that the hardest part of doing the port will be emulating the timed-
   out reads (c_cc[VTIME]) in dial.c  --r$  ]

#	Generic Modem Dialer subroutine and support programs for system V.
#	
#	Modem configuration is done in the user configured file
#	dialinfo.  Should be able to dial any modem (eg Vadic, Hayes)
#	with a built-in auto dialer.   Replaces ATT dial(3C).
#	Works with CU, uucico, lp, etc.
#	
#	This is part 1 of 3.
#	
#	The parts are:
#	
#	1)	README file and all documentation.
#	2)	Makefile, dialinfo, *.h, some *.c files
#	3)	dial.c
#	
#--------CUT---------CUT---------CUT---------CUT--------#
#########################################################
#                                                       #
# This is a shell archive file.  To extract files:      #
#                                                       #
#    1)	Create an empty directory for the files.        #
#    2) Write a file, such as "file.shar", containing   #
#       this archive file into the directory.           #
#    3) Type "sh file.shar".  Do not use csh.           #
#                                                       #
#########################################################
echo Creating: README
sed -e 's/^#//' >README <<'end_README'
#MOTIVATION
#
#This Dial program is a replacement for the standard System V
#"dial" subroutine documented in the V.2 and later manuals.
#
#It appears--see ACU(7)--the standard dial program requires
#a real or pseudo device driver in the kernel to support dial
#out.   In ATT machines,  this driver is tied to proprietary
#hardware,  and that means--by and large--dial doesn't port well.
#Every vendor seems to have a unique solution to the dial-out
#problem,  and most of them are a mess.
#
#I wrote this in the hope vendors would pick it up and provide
#a standard interface to dial-out lines.   It does nothing strange
#and plugs into all the system V programs (I think).
#
#The System V.2 CU program (for sure) and the System V uucico
#program (I am guessing) use the DIAL subroutine to do their
#dialing.   Altos was gracious enough to let me try out this
#subroutine with their CU source,  so I can tell you it definitely
#works with System V CU.  Unfortunately, I was unable to try it
#with uucico, but I believe it will work there also.   Ah,
#for access to source....
#
#The main claim to fame this dialer has is its configurability,
#portability and flexibility.
#
#I have used it to dial out on Altos and Plexus machines, and
#it went without a hitch.  It has also been used to talk to
#communication equipment (eg telephone systems) and even to
#defeat dialback modems.  It works with the System V spooler
#too.  You can have it call your home and put a message on
#the screen for example.
#
#Anyway, read the "dialinfo" documentation.   If you find a
#modem dialer it won't work with,  drop me a line and we'll
#try to fix it....
#
#INSTALLATION
#
#1)	Get all 3 pieces of the USENET posting and "sh" them.
#
#2)	Print out the documentation and read it.  This step is
#	supposed to get you all fired up for what follows.
#
#3)	Type "make".   This builds everything you need.   If you
#	are wildly optimistic,  you might try "make install".
#
#4)	Copy "dialinfo" to /usr/lib/uucp.
#
#5)	Copy "dialer" and "dialprint" to /usr/lbin or wherever
#	you keep your local binaries.
#
#6)	Either copy "libdial.a" to /usr/lib so it can be used
#	as a library -ldial,  or replace "dial.o" and add
#	dialinfo.o and readinfo.o--in that order--to your System V
#	library (usually /lib/libc.a).
#
#7)	Take a look at "dialinfo".   If you have a hayes or
#	vadic,  you are set to go.  Otherwise you may need to
#	create a dialer entry.   Not to worry,  it is pretty easy
#	to make a simple one.  If you use it much,  you may want
#	to write a fancy one later.
#
#8)	Try "dialprint hayes" to make sure things are basically
#	working.  That should print out a hayes entry.  If you
#	are using a different dialer,  try that too.
#
#10)	Change L-devices to name the type of dialer you selected
#	in the "dialinfo" file.   This entry goes in the third
#	blank-separated field.   A typical entry is:
#
#		ACU tty12 hayes 1200
#
#	If you don't know what fields 1-2 and 4 do,  you will have
#	to spend some time with the uucp documentation.   You may
#	also need to figure out how to hook up a modem.
#
#11)	Hip-hip-hooray!  Now you are ready to actually dial someone.
#	Try the following,  where you replace 5551212 with a harmless
#	number to dial.
#
#		DIALDEBUG=a dialer 5551212
#
#	This should dial out on the first available line, and wait
#	for carrier.   In the mean time, it will print gobs of
#	debug output on your terminal.
#
#12)	If you have source or object copies of UUCICO and CU, you
#	should just be able to compile/link them up and they should
#	use the new dialer.  If not, this is the hard part.  You
#	need to figure out what sort of dialer solution your vendor
#	thought up,  which usually amounts to a special dial program
#	in /usr/lib/uucp or elsewhere.   You must figure out what
#	parameters are used to execute the program (maybe replace
#	the program with an echo script) and then create a script
#	to execute "dialer" with those parameters.  Usually, this
#	script will look something like:
#
#		exec /usr/lbin/dialer -n -t$1 -s$2 $3
#
#	If all went well, you should now be able to use CU and UUCP
#	with telephone numbers, dialing, and all the rest.  Chances
#	are you will have to do some hacking on your system before
#	that happens.  I can't give you too many hints,  because systems
#	are so different in this regard.  Which is why I started this
#	project in the first place.
#
#HINTS
#
#	Some vendors use field 3 in the L-devices file to name a
#	program which actually does the dialing.  If your system
#	is like this,  put the pathname of your dial script in there
#	and also create a dialer with that name.   So maybe you
#	have an entry that looks like:
#
#		ACU tty12 /usr/lib/uucp/dialscript 1200
#
#	and an entry in your dialinfo file that looks like:
#
#		/usr/lib/uucp/dialscript,
#			use=hayes,
#
#	If you are having problems with modem control on your system,
#	it is likely dip switches in the Modem,  a bad cable,  or
#	straps on your computer.   This is kind of a nightmare too.
#	You should be able to see your computer raise DTR (pin 20)
#	on the modem when DIAL opens the communication line,  and
#	sense one line back from the modem to tell when carrier is
#	present.   I have seen CD (pin 8) CTS (pin 5) or DSR (pin 6)
#	all used for this same purpose.  You need to check the doco
#	on your modem,  or better yet, get a breakout box.  Above
#	all, don't believe the LED's on the front of the modem.
#	Usually there are straps between those LEDs and the RS232
#	connector on the back.  Get it working with the breakout
#	box, then build a cable to do the same thing.  If you are
#	lucky, your vendor will have a section in the manual telling
#	about the straps and cable you need.  Some vendors have an
#	application note on the subject.
#
#	As of this writing, both the Altos and Plexus systems where
#	I tested have modem control problems acknowledged by the vendor.
#	These can also complicate your life....
#
#FEEDBACK
#
#	If you find something in the dial subroutine that doesn't fit
#	in with other System V programs, drop me a line, or a bug fix,
#	or something.   I would really like a permanent solution to the
#	System V dial problem.
#
#	I am interested in any comments or suggestions for enhancements.
#
#	If you feel you need to remove the Copyright notice for
#	distribution,  contact me and I will give you permission.
#
#ihnp4!quest!gene
end_README
echo Creating: dial.3
sed -e 's/^#//' >dial.3 <<'end_dial.3'
#.TH DIAL 3
#.SH NAME
#dial \- dial out on a modem
#.SH SYNOPSIS
#.B #include <termio.h>
#.br
#.B #include <dial.h>
#.PP
#.B int dial(call)
#.br
#.B CALL call;
#.PP
#.B void undial(fd)
#.br
#.B int fd;
#.SH DESCRIPTION
#.I Dial\^
#is a modem-independent implementation of the standard
#System V
#.I Dial
#procedure.
#.PP
#.I Dial
#calls out on a modem or a direct terminal
#line, and returns a file-descriptor open for read/write.
#.PP
#When finished with the line, the caller
#must invoke
#.I undial
#to gracefully disconnect.
#.PP
#.I Dial
#reads the uucp
#.I L-devices
#file to determine eligible devices,
#and the
#.I dialinfo
#file to determine the modem dial procedure.
#.I Dial
#is fully compatible with
#.I cu
#and
#.I uucp.
#.PP
#The definition of CALL in the <dial.h> header
#file is:
#.PP
#.nf
#typedef struct {
#.RS
#struct termio  *attr;     /* Final terminal attributes */
#int            baud;      /* Baud rate to use after dialing */
#int            speed;     /* Baud rate to use during dialing */
#char           *line;     /* TTY device name */
#char           *telno;    /* Phone number(s) or system name */
#int            modem;     /* Use modem control on direct lines */
#char           *device;   /* Where to store device name */
#int            dev_len;   /* Sizeof(call.device) */
#.RE
#} CALL;
#.fi
#.PP
#The CALL parameters are as follows:
#.TP 10
#.B attr
#If specified, the tty device is set to use the
#given parity,
#character size,
#and baud rate after connect.
#Before a successful return,
#the remaining tty attributes--except carrier sense--are set.
#Carrier sense is controlled exclusively through
#.I dialinfo
#commands.
#If not given, baud rate defaults to the modem baud rate,
#and in any case is overridden by
#.I baud
#below, or commands in the
#.I dialinfo
#file.
#.TP 10
#.B baud
#If specified,
#the tty device is set to this baud rate after connect.
#This parameter may be overridden by commands in the
#.I dialinfo
#file.
#.TP 10
#.B speed
#If specified,
#only entries with this speed in field 4 of
#.I L-devices
#are considered.
#.TP
#.B line
#If specified,
#only entries with this tty name in field 2 of
#.I L-devices
#are considered.
#.TP
#.B telno
#If not specified, the call is to a DIRect line.
#Otherwise this is the telephone number to be dialed.
#Several alternate numbers may be given, separated
#by commas.
#.I L-dialcodes
#prefix substitution is performed.
#.TP 10
#.B modem
#Modem control is used on direct lines when
#this variable is non-zero, and connect option 2
#(command C2) is selected by the
#.I dialinfo
#procedure.
#.TP 10
#.B device
#If this pointer is non-null,
#the line device pathname (eg /dev/tty12)
#is copied here after a successful dial.
#.TP 10
#.B dev_len
#Length of the array pointed to by
#.I device
#above.
#.PP
#If the global variable
#.I nolock
#is non-zero,
#.I dial
#does not test for or secure the normal uucp lock file,
#and
#.I undial
#does not remove it.
#.SH FILES
#.nf
#.ta 27
#/usr/lib/uucp/dialinfo	Dial procedure data base.
#/usr/lib/uucp/L-devices	UUCP device entries.
#/usr/lib/uucp/L-dialcodes	Dialcode substitutions.
#/usr/lib/uucp/L.sys	UUCP system definitions.
#/usr/spool/uucp/LCK..*	UUCP lock file.
#/dev/tty*	TTY device names.
#.fi
#.SH AUTHOR
#Gene H. Olson, Quest Research, Burnsville MN.
#.SH SEE ALSO
#.nf
#.ta 17
#cu(1C)	Calls another system.
#dialprint(1)	Prints a dialer entry.
#dialer(1)	Modem dial-out program.
#uucp(1)	UUCP interface.
#dialinfo(4)	Dial procedure data base.
#termio(7)	TTY device information.
#.SH DIAGNOSTICS
#On failure, a negative error code is returned.
#Possible error codes--as listed in <dial.h>--include:
#.PP
#.RS
#.nf
#INTRPT   -1   /* Interrupt during dial */
#D_HUNG   -2   /* Dialer hung */
#NO_ANS   -3   /* Busy or no answer */
#ILL_BD   -4   /* Illegal/unknown baud rate */
#A_PROB   -5   /* Dialinfo(4) configuration error */
#L_PROB   -6   /* TTY device error */
#NO_Ldv   -7   /* L-devices file unreadable */
#DV_NT_A  -8   /* Requested device not available */
#DV_NT_K  -9   /* Requested device unknown */
#NO_BD_A  -10  /* Nothing available at requested speed */
#NO_BD_K  -11  /* No device known at requested speed */
#.RE
#.fi
#.PP
#If the environment variable DIALINFO exists, it specifies
#a pathname to be used instead of /usr/lib/uucp/dialinfo.
#.PP
#If
#.I dial
#discovers a corrupted or improperly configured file
#or device, diagnostic information is written to
#.I stderr.
#.PP
#Debugging output is written to
#.I stderr
#when the environment
#variable
#.I DIALDEBUG
#exists,
#and contains one or more of the characters listed below.
#.TP 10
#.B d
#Show data and decisions related to the
#.I L-devices
#file, plus creation and deletion of the
#uucp lockfile.
#.TP 10
#.B s
#Show dialer state definitions and transitions.
#.TP 10
#.B m
#Show matching of dialer
#transition strings against the incoming data stream.
#.TP 10
#.B l
#Show all device operations other than character I/O
#to the communications device.
#.TP 10
#.B c
#Show all transmitted and received communication.
#.TP 10
#.B a
#Show all of the above.
#.PP
#The
#.I dialinfo
#file may also contain commands which write user specified
#diagnostics to
#.I stderr.
#.SH WARNING
#On some systems, a UUCP daemon periodically removes UUCP
#lockfiles older than (for example) 90 minutes, without first
#checking for activity on the corresponding communication line.
#.I Dial
#takes no precautions against that.
end_dial.3
echo Creating: dialer.1
sed -e 's/^#//' >dialer.1 <<'end_dialer.1'
#.TH DIALER 1 
#.SH NAME
#dialer \- General purpose dialer program.
#.SH SYNOPSIS
#\fBdialer
#[-cenorw]
#[-l \fRline\fB]
#[-b \fRbaud\fB]
#[-e \fRspeed\fB]
#[\fRtelno\fB]
#.SH DESCRIPTION
#.I Dialer
#is a modem-independent dialer program.
#.I Dialer
#is normally executed by programs such as
#.I cu
#and
#.I uucp
#to perform dialing functions,
#or in an
#.I lp
#interface script to spool output to a remote printer.
#The program is also useful in debugging
#.I dialinfo
#entries.
#.PP
#If
#.I telno
#is present,
#the program uses
#the first available
#.I L-device
#entry which begins with
#.B ACU,
#and otherwise uses the first
#.B DIR
#entry.
#Communications are 8 bits/no parity, carrier sense disabled.
#No retries are performed if all lines are busy,
#or the remote does not answer.
#The following options change all that:
#.TP 10
#.B -c
#After a successful dial, copy standard input to the
#remote
#.TP 10
#.B \-e
#Switch to even parity after connect.
#.TP 10
#.B \-o
#Switch to odd parity after connect.
#.TP 10
#.B \-n
#Do not create the
#.I uucp
#lock file before dialing,
#and do not delete it when the dial is complete.
#This is useful when the caller has already selected
#the dial-out line,
#and secured the corresponding lock file.
#.TP 10
#.B \-w
#If all outgoing lines are busy, wait until one becomes
#available.
#.TP 10
#.B \-r
#If the remote does not answer, redial every 30 seconds
#until he does.
#.TP 10
#.BI \-l line
#Dial out on the tty device /dev/\fIline\fR.
#.TP 10
#.BI \-s speed
#Connect to the remote at baud rate
#.I speed.
#.TP 10
#.BI \-b baud
#Switch to communication speed
#.I baud
#after connect.
#.SH FILES
#.nf
#.ta 29
#/usr/lib/uucp/L-devices	For uucp devices entries.
#/usr/lib/uucp/dialinfo	For dialer definitions.
#/usr/spool/uucp/LCK..*	TTY lock files.
#.SH AUTHOR
#Gene H. Olson, Quest Research, Burnsville MN.
#.SH SEE ALSO
#.nf
#.ta 17
#dialprint(1)	Prints out a dialer entry.
#uucp(1)	UUCP interface.
#lp(1)	Line printer spooler.
#dial(3)	Dial-out procedure.
#dialinfo(4)	Dial procedure data base.
#.SH DIAGNOSTICS
#Exit code 0 is returned for success,
#the absolute value of an error code
#described in \fIdial\fR(1) for failure.
end_dialer.1
echo Creating: dialinfo.4
sed -e 's/^#//' >dialinfo.4 <<'end_dialinfo.4'
#.TH DIALINFO 4
#.SH NAME
#dialinfo - dial procedure data base
#.SH SYNOPSIS
#/usr/lib/uucp/dialinfo
#.SH DESCRIPTION
#The
#.I dialinfo
#file is a database of
#.I dialers.
#Each dialer is 
#a procedure for connecting
#a terminal line to some kind of remote computer system.
#Most
#.I dialer
#entries dial out on a
#modem with built-in auto-dial capability.
#Some more esoteric entries resolve
#baud rate switching with a remote
#.I getty,
#perform auto-login,
#and even detect/defeat remote dialback modems.
#.PP
#Each
#.I dialer
#entry describes the operation of a state machine.
#This state machine is capable of sending characters to
#the remote, controlling the switchook, sending break,
#adjusting baud-rate,
#and printing user messages on
#.I stderr.
#State transition decisions are made according
#to responses from the remote, response timeout,
#carrier detection, and retry count.
#The state machine may be
#partially or fully customized
#with user environment variables.
#.PP
#.I Dialinfo
#contains an extensive diagnostic capability both to
#support initial debugging,
#and to deal with day-to-day problems on real
#telephone lines and down systems.
#.PP
#The entry format of
#.I dialinfo
#is modeled after
#.I terminfo.
#.nf
#Entries have the general form:
#
#    name1|name2|...,
#        key1=str1, key2=str2, ...
#        ...
#        keyn=strn, ...
#.fi
#.PP
#Where:
#.TP 12
#name?
#Descriptive dialer name.
#For an auto-dial modem this is usually manufacturer name
#and model number.
#For a dialer to be used,
#this name must appear in field 3 of a corresponding entry in the
#.I L-devices
#file.
#.TP
#key?
#Dialinfo keyword.
#.TP 12
#str?
#Keyword definition string.
#A definition may span several lines.
#Only commas need be escaped.
#.PP
#The name entry must begin in column 1.
#Keyword entries may immediately follow the first comma,
#or may be indented and placed on subsequent lines.
#Blank lines, and comment lines beginning with
#.B #
#are ignored.
#.PP
#Keywords include:
#.TP 12
#.B delay
#Modem string to get a 2 second dial delay.
#.TP 12
#.B wait
#Modem string to wait for dial tone or secondary dial tone.
#.TP 12
#.B star
#Modem string for the
#.B *
#key on a touch tone phone.
#.TP 12
#.B pound
#Modem string for the
#.B #
#key on a touch tone phone.
#.TP 12
#.B flash
#Modem string to flash off hook for 1 second.
#.TP 12
#.B retry
#Initial retry count.
#Specifies the number of retries to be performed before
#announcing failure.
#.TP 12
#.BI s n
#Definition of machine state
#.I n.
#There are 100 possible states numbered 0 to 99.
#.TP 12
#.B use
#The specified string is a dialer entry
#from which remaining undefined keywords may be taken.
#Presently defined keywords are not affected.
#Any keyword definitions which follow in
#the current dialer entry are ignored.
#.PP
#An environment variable string may be placed anywhere
#in a
#.I dialinfo
#definition.
#the form
#\fB${\fIname\fB}\fR
#inserts the value of the environment variable
#.I name.
#The form
#\fB${\fIname-default\fB}\fR
#inserts the value of
#.I name
#if it exists,
#and otherwise literally inserts the
#.I default
#string.
#.PP
#Machine state definitions contain a sequence of commands
#performed in order from left to right.
#Possible commands include:
#.TP 12
#.B B
#Transmit 250 millisecond break signal.
#.TP 12
#.BI C n
#Set connect option.
#If
#.I n
#is 0, use
#8 bits, no parity, L-devices baud rate and
#.I clocal
#mode for modem communication.
#If
#.I n
#is 1,
#switch parity,
#character size and baud rate
#for communication with the remote system;
#carrier detect is still disabled.
#If
#.I n
#is 2,
#proceed as with 1, but enable carrier detect if
#this is an ACU line or
#.I call.modem
#is non-zero.
#If
#.I n
#is 3, set options as with 1, but always enable carrier detect.
#If
#.I n
#is 4, set options as with 1, but enable carrier detect
#and wait for carrier to be established.
#If carrier is not seen within the timeout period set
#by the last
#.B S
#command,
#take action according to the last
#.B H
#command.
#.TP 12
#.BI D n
#Drop DTR (hang up line) for
#.I n
#seconds.
#When DTR is restored, baud rate, parity etc is set as if
#.I C0
#was executed.
#.TP 12
#\fBE\fI"string"\fR
#Write
#.I string
#to
#.I stderr.
#Presumably
#.I stderr
#is directed to a user terminal, or a log file.
#.TP 12
#\fBF\fI"string"\fR
#Declare that
#.I string
#should be sent to
#.I stderr
#on any subsequent dial failure.
#Remains in effect until canceled.
#.TP 12
#.BI G s
#Immediately transfer control to state
#.I s.
#.TP 12
#.BI H s
#Declare that the carrier lost error recovery state is
#.I s.
#If a subsequent read of the communication line fails
#because carrier sense is enabled and DCD is false,
#control will be transferred to state
#.I s.
#.TP 12
#\fBM\fI"string"\fR
#Write
#.I string
#to the communication line.
#.TP 12
#.BI N b
#Change the communication line
#baud rate to speed
#.I b.
#.TP 12
#.BI P n
#Pause for
#.I n
#seconds.
#.TP 12
#.BI R n
#Decrement the retry count,
#and fail if the result is negative.
#.TP 12
#.BI S n
#Declare that the timeout used when
#waiting for carrier,
#or a communication line response is
#.I n
#seconds.
#.TP 12
#.BI T s
#Declare that the timeout recovery state is
#.I s.
#Any subsequent timeout will cause a transfer
#to this state.
#.TP 12
#.BI U n
#Execute (use) the text of state definition
#.I n
#as a subroutine.
#This command nests up to 10 deep.
#.TP 12
#\fB[\fIstring\fB]\fIs\fR
#Declare that a transfer to state
#.I s
#should be performed when
#.I string
#is received from the remote.
#.PP
#The
#state
#parameter denoted as
#.I s
#in the above entries is one of the following:
#.TP 12
#.I n
#Transfer control to state
#.I n,
#where
#.I n
#is a decimal number in the range 0 to 99.
#.TP 12
#.B \+
#Exit, returning success.
#.TP 12
#.B \-
#Exit, returning the error code
#.I NO_ANS
#(no answer).
#.TP 12
#.BI \- n
#Exit,
#returning the error code
#.I \-n.
#.PP
#The following escapes are recognised in
#\fBE\fR,
#\fBF\fR,
#\fBM\fR,
#and
#\fB[]\fR
#command
#.I strings:
#.TP 12
#\fB\\\\\\\\\fInnn\fR
#The octal character
#.I nnn.
#.TP 12
#.BI ^ c
#The control character derived by
#the logical and of the ASCII character
#.I c
#and the octal mask 037.
#This is the character transmitted by a standard
#ASCII keyboard when the control key is held down,
#and the character
#.I c
#is depressed.
#.TP 12
#\fB\\\\\\\\\fIc\fR
#Standard C language escapes
#\\b (backspace),
#\\f (formfeed),
#\\t (tab),
#\\n (newline),
#and
#\\r (return).
#.TP 12
#.BI % n
#Field number
#.I n
#of the current L-devices entry.
#.TP 12
#\fB%{\fIvar\fB}\fR
#The user environment variable
#.I var.
#.TP 12
#.B %n
#The unmodified telephone number string.
#.TP 12
#.B %N
#Converted telephone number described below.
#.PP
#The following characters have special meaning in the
#.B %N
#character strings,
#and are replaced with corresponding
#.I dialinfo
#strings as described below.
#.TP 12
#\fB*\fR or \fB:\fR
#.I (star)
#Dials the
#.B *
#on a touch-tone telephone.
#.TP 12
#\fB#\fR or \fB;\fR
#.I (pound)
#Dials the
#.B #
#on a touch-tone telephone.
#.TP 12
#.B \-
#.I (pause)
#Pauses 2 seconds.
#.TP 12
#\fB=\fR or \fBw\fR
#.I (wait)
#Wait for secondary dial tone.
#.TP 12
#\fBf\fR
#.I (flash)
#Flash off hook for one second.
#.SH "DIALER OPERATION"
#The state machine is initialized to "C0 H- S10 T-",
#and execution begins at state 0.
#.PP
#As each state is entered,
#any previous
#.B []
#command strings are cleared.
#Command execution then proceeds in order from left to right.
#.PP
#If a command
#(eg \fBG\fR)
#is encountered which causes a change of state,
#remaining commands in the current state are not performed,
#and execution continues in the new state.
#.PP
#Otherwise, when all the commands in a state have been
#executed,
#a read operation is performed on the communication line.
#Incoming characters are then matched
#against previously declared
#.B []
#command strings.
#If a match is found,
#the corresponding state transfer occurs.
#If carrier sense was enabled by a previous
#.B C
#command,
#and carrier is lost,
#the last
#.B H
#command is honored.
#If neither of these events occur within the timeout
#specified by the last
#.B S
#command, a timeout is detected.
#Action is then taken according to the last
#.B T
#command.
#.SH EXAMPLES
#The following is a stripped-down definition for a Hayes Smartmodem.
#.PP
#.nf
#	hayes,
#		star=*, pound=#, flash=H0\\,H1,
#		delay=\\,, wait=\\,, retry=2,
#		s0=M"\\rAT DT%N\\r" S60 [CONNECT]+,
#.fi
#.PP
#Below is a more complicated entry to handle a Vadic 3451.
#.PP
#.nf
#.ta 5 9
#	vadic|va3451,
#		delay=K, wait=KK, retry=5,
#		s0=P1 M"^E\\r" [*]1 S2 T10,
#		s1=P1 M"D\\r" [NUMBER]2,
#		s2=P1 M"%N\\r" P1 "\\r" [DIALING]3,
#		s3=E"Dialing %n ..." S30 H11 C4 [CONNECT]4 T11,
#		s4=E"Connected." G+,
#		s10=F"No response from modem." R1 D1 G0,
#		s11=F"Dial failed." R1 E"No Carrier, retrying ..." D1 G0,
#.fi
#.PP
#The next entry gets its complete definition from
#the DIALCUSTOM environment variable,
#and defaults to hayes if that variable is undefined.
#.PP
#.nf
#custom,
#	${DIALCUSTOM-use=hayes},
#.fi
#.SH FILES
#.nf
#.ta 29
#/usr/lib/uucp/dialinfo	Dial procedure data base.
#/usr/lib/uucp/L-devices	UUCP device file.
#.SH AUTHOR
#Gene H. Olson, Quest Research, Burnsville MN.
#.SH SEE ALSO
#.nf
#.ta 17
#dialer(1)	Modem dial-out program.
#dialprint(1)	Prints dialer entries.
#getty(1)	For information on dial-in lines.
#uucp(1)	UUCP interface information.
#dial(3)	C library dial procedure.
#terminfo(4)	Terminal capability data base.
#acu(7)	For System V phone number conventions.
#term(7)	Terminal device information.
end_dialinfo.4
echo Creating: dialprint.1
sed -e 's/^#//' >dialprint.1 <<'end_dialprint.1'
#.TH DIALPRINT 1
#.SH NAME
#dialprint \- Print dialinfo entry.
#.SH SYNOPSIS
#\fBdialprint \fRdialer
#.SH DESCRIPTION
#.I dialprint
#prints out entry
#.I dialer
#from the dialer configuration data base
#.I dialinfo.
#All
#.I use
#keywords are evaluated
#and all
#\fB${\fIenv\fB}\fR
#environment substitutions are shown.
#.SH FILES
#.nf
#.ta 27
#/usr/lib/uucp/dialinfo	Dial procedure data base.
#.SH AUTHOR
#Gene H. Olson, Quest Research, Burnsville MN.
#.SH SEE ALSO
#.nf
#.ta 17
#dialer(1)	Modem dial-out program.
#uucp(1)	For info on UNIX communications.
#dial(3)	Dial-out procedure.
#dialinfo(4)	Dial procedure data base.
#.SH BUGS
#No verification of dialer state strings is performed.
end_dialprint.1