DIAL

Section: User Commands (1)
Updated: 23 January 1986
Index Return to Main Contents
 

NAME

dial - connect to a remote system using a state transition script  

SYNOPSIS

dial [ -v ] [ -p ] [ -lline ] [script-file [ arguments... ]]  

DESCRIPTION

Dial establishes a connection to a remote machine using a user-supplied state transition script. Dial is mainly used to communicate with remote server-logins in a non-interactive way, or for interactive sessions on a remote machine when the login/logout procedures should be carried out automatically.

The -lline parameter specifies the line to be opened to establish the connection. If it is a relative pathname, dial prepends the string ``/dev/'' to the specified line. If the line does not exist, dial interprets line as the system name of the remote machine and uses the file /etc/remote to find out how to reach the system and how the line parameters (e.g. baud rate) should be set; refer to remote(5) for a full description.

The -v option causes dial to print on standard output diagnostic information for each state transition. This can be helpful for debugging dial scripts.

Script-file contains the state transition table; if script-file is `-', standard input is used. If script-file cannot be opened, the value of the environment variable ``DIALDIR'' (if present) is prepended to the file name. If this also fails, the path ``/usr/local/lib/dial/'' is prepended to the specified file name.

Lines in the script beginning with `#' are treated as comment lines. Comment lines and blank lines are ignored. All occurrences of `$n' in the script are substituted by the nth optional argument from the command line; the first argument is `$0'. `$*' is substituted by the concatenation of all arguments separated by blanks. All occurrences of `${symbol}' are replaced by the value of the environment variable symbol. If symbol begins with `~' or `/', it is interpreted as the name of a file, and the contents of the file is interpolated into the script (dial performs csh(1)-style expansion of `~' and `~user').

The script file contains a list of state definitions; each definition is of the form

state-name send-string [[time-out][,delay]] next-state pattern [output-string] next-state pattern [output-string]    ...

The first line of each state definition starts in column 0; the following lines are indented by spaces or tabs. State-name is the name of the state; send-string is a string that is sent to the remote system whenever the state is entered. When a state has been entered, dial receives data from the remote system until the characters read so far match one of the patterns listed in the state definitions. If a match occurs, the optional output-string is sent to the standard output, and then the corresponding next-state is entered. The order of the next-state-pattern pairs is significant.

When the -p options is given, the output-string field of each rule is ignored. Instead, all characters received from the remote system are sent to the standard output.

When a time-out occurs while receiving from the remote system, a transition to the state exit is performed (if not specified otherwise). The default time-out for each state is 10 seconds; it can be changed as described below. The optional time-out field in each state definition can be used to assign a different time-out value to this state. Likewise, the .delay field can be used to specify a delay (measured in seconds) to be performed before the send-string is transmitted. Both fields are optional. Thus, ``,1.5'' means ``use the default time-out and a delay of 1.5 seconds''.

Each time the symbol `\<' or `\?' is encountered in the send-string field of a state definition, dial reads one input line from standard input and replaces the symbol with that line (not including the terminating newline). In case of `\?', the read is performed in CBREAK mode with all special characters as well as echo turned off. This is useful when passwords should be interpolated into the data sent to the remote machine, but should not appear directly in the script.

Pattern is a simple character string; `.' within a pattern matches any character. The special pattern `*' matches anything (useful for catch-all rules); the pattern `#' denotes timeout, that is, the corresponding next-state is entered when a time-out occurs. In output-string, the symbol `&' denotes the string that matched the corresponding pattern. This mechanism is used to print on standard output characters received from the remote system or diagnostic messages. The special interpretation of `.', `#', `*', `&', `$', `\<', and `\?' is suppressed when the symbol is preceded by `\' (backslash).

Send-string, pattern, and output-string can be surrounded by double-quotes. This is useful when blanks should be included or to denote an empty string. The symbol `\r' can be used to denote carriage return, `\n' stands for line feed. In addition, a `\' followed by one to three octal digits stands for the character whose ASCII code is given by those digits.

When dial is called, a transition to the first state listed in the script file is performed. A transition to the special state exit causes dial to drop the connection and terminate. A transition to the state user causes dial to enter interactive mode. In this mode, all typed characters are transmitted to the remote machine, while all characters received from the remote machine are sent to standard output (that is, dial acts as if you had been connected to the remote machine using tip(1)).

If no script file is given, or if the specified script-file does not contain any state definitions, dial performs a transition to the state user, that is, opens an interactive session.

If the special escape character (usually `~') followed by carriage return or space is typed in interactive mode, dial sends the prompt string (usually `:') to standard output and reads from standard input the name of a new state. If a valid state name has been entered, dial leaves the interactive mode and enters the given state.

If the escape character is followed by either `.' or the end-of-file character (usually `^D'), dial enters the state exit immediately, that is, closes the connection and terminates. Dial can be suspended by typing escape followed by the suspend process character (usually `^Z'). Escape followed by `!' forks a shell; escape followed by `?' prints a summary of available escape commands.

Lines in the script file of the form

keyword = value

are used to assign values to certain parameters. Valid keywords are timeout (the default time-out to be used), delay (the default delay), line (the line to be opened), escape (the escape character), and prompt (the prompt string). The value for line is overridden by the -lline option.  

EXAMPLES

The following simple script prints on standard output each character received from /dev/tty0. It terminates when a `.' is received or when a timeout of 0.5 second occurs.

# Simple example for a dial script:
line=tty0
loop "" .5
    exit \. "Done.\n"
    exit #  "Got time-out.\n"
    loop *  &
 

FILES

/usr/local               system-wide dial scripts

${DIALDIR} private dial scripts
/usr/spool/uucp/LCK..* lock file for uucp and tip
 

SEE ALSO

tip(1C)  

AUTHOR

Oliver Laumann  

BUGS

The number of characters actually matched by the pattern `*' is not deterministic.


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXAMPLES
FILES
SEE ALSO
AUTHOR
BUGS

This document was created by man2html, using the manual pages.
Time: 11:03:31 GMT, December 12, 2024