DIALD-SCRIPT

Section: File Formats (5)
Index Return to Main Contents
 

NAME

DIALD-SCRIPT - Dialup IP connection script files  

DESCRIPTION

The Dialup IP package connects to a remote system under the control of a script file specified in the host's configuration file. The script specifies how to dial and negotiate the login procedure on the remote system, as well as how to invoke whatever commands might be necessary to start the Dialup IP protocol on the remote host.

The final command in a script should specify whether or not the call succeeded. If the script indicates success, then diald(8) will start the Dialup IP protocol on the local line and bring up the device. If a script indicates a failure, or ``falls off the end'' without indicating success, then the device is not brought up.

Script files consist of lines containing a command word and zero or more arguments. Blank lines and lines beginning with a pound sign, #, are ignored. Scripts may invoke other scripts, and pass parameters into them. If an argument contains whitespace it must be surrounded by quotation marks. Each argument may contain standard C escape sequences: \b, \f, \n, \r, \t, or \ddd (where d is an octal digit). In addition, if the current script has any parameters, then the sequence $d (where d is decimal digit), expands to the d'th parameter of the script. It is an error to reference more parameters than were passed in. The sequence $$ becomes a single $.

Establishing a connection to a remote site is typically done in two parts, dialing the phone and then entering the username and password once the connection has been made. By convention, these parts are put into two different scripts. For example, dial-tb.script is a script that instructs a Trailblazer modem to dial the number in $1 while login-unix.script is a script to login to a UNIX machine running Dialup IP with username $1 and password $2. These scripts would then be joined called by a parent script known as tb-unix.script which takes the phone number, username, and password as parameters.

The following commands are legal:

abort
The script terminates unsuccessfully.
go
The script terminates, and the call is considered initiated, including assuming that the proper line discipline has been set on the remote system, such as with the dudisc or sliplogin commands.
log "text"
The indicated text is written to the log file.
mark
As bytes are read from the remote system, they are collected into a buffer that can be recalled by the replay command. The mark command sets the point at which the replay begins. See the description of ``select blocks'' below.
replay
This command rewinds the input buffer back to the most recent mark command. The next recv command will then look at data which may have already been seen by previous recv commands.
recv "text" timeout
This command causes the script to wait until the indicated text is received from the remote system. The timeout indicates how long to wait, in seconds, until the text is received, and must be a number greater than zero. If it is not received within the indicated time, an abort is executed and the script fails. If the recv command is inside a ``select block,'' however, control is passed to the next alternative rather than aborting; see below.
use script [parameter...]
The named script is read and executed. If it does not abort then execution of the current script continues at the next line. Any parameters on the use line may be used in the called script as $1, $2, and so on. Scripts can be nested: a script named in a use command can, in turn, have its own use commands. Note, however, that a failure at any level is passed all the way back to the top and the script execution ceases.
xmit "text"
The indicated text is sent to the remote system. In addition to the escape sequences described above, the following are also valid:
        \x      Delay one second
        \#      Send a break
 

Select Blocks

For more complicated connection requirements, it is possible to use ``select blocks'' to choose among different choices depending on what the remote system sends. The general structure of a select block is as follows:
{
alternate
        commands
        ...
alternate
        commands
        ...
}
Note that the curly braces are command words that take no arguments and therefore must be the only item on the line where they appear. A select block is composed of one or more alternatives which are marked by the command word alternate. An alternative is delimited by the end of the select block or another alternative. Select blocks can be nested.

A select block can change the order in which commands are executed. If the end of an alternative is reached, all following alternatives are skipped and execution continues with the next statement after the closing curly brace. If any recv within the block times out, then control passes to the next alternative. If there are no more alternatives available, then an abort is done and the script fails. For example, the following excerpt will send a break if no login prompt appears within 30 seconds, and then try again:

xmit "\r\r"
{
alternate
        recv "login" 30
alternate
        xmit "\#"
        recv "login" 30
}

The mark and replay commands are particularly useful within select blocks so that a script can ``parse'' the data sent by the remote system. For example, the following excerpt will connect to one of two lines on a simple terminal switch:

recv "Request"
mark
{
alternate
        xmit "A\r"
        recv "A-Connected" 30
alternate
        # Didn't get the connected to A message, reread.
        replay
        recv "A-Busy" 1
        log "A was busy-trying B"
        xmit "B\r"
        recv "B-Connected" 30
alternate
        log "A down or both A and B were busy"
        abort
}
Note that the timeout for the A-Busy string is small; this is adequate since the first recv will have already read most of the input.  

SEE ALSO

diald(8), diald.conf(5)


 

Index

NAME
DESCRIPTION
Select Blocks
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 07:01:34 GMT, May 19, 2025