-->
Previous Table of Contents Next


From the DIP> prompt, you can run any dip command by typing it and pressing <Return>. The help command displays a list of the available commands. Invoking a command with incorrect arguments displays a brief usage statement for that command. Table 29.2 describes the commands available for use at the command-mode prompt or in dip scripts.

Table 29.2 Commands Available in dip

Command Description

chatkey keyword [code] Adds a keyword and error-level code to the set of error codes returned by the dial command. The chatkey command can be used to detect when your modem returns BUSY, VOICE, or other specific messages.
config [arguments] Allows you to directly manipulate the SLIP interface dip provides. This command normally is disabled because it’s a severe security risk. The source code file command.c must be modified slightly to enable this command.
databits bits Sets the number of bits that can be used as data in each byte. This accommodates 6- and 7-bit dial-up connections.
default Causes dip to set a default route in the kernel routing table pointed at the remote host.
dial num Dials the specified telephone number.
echo on|off Turns echo on or off. Echo on makes dip display what it’s sending to and receiving from the modem.
flush Throws away any responses from the modem that haven’t been read yet.
get $var Sets the variable $var to either the constant ask or remote constant specified, prompts the user for a value, or takes the next word from the serial line and assigns it to $var.
goto label Jumps to the specified label in the dip script.
help Displays a listing of available commands in command mode.
if $var op number Performs a conditional branch in a goto label script. $var must be one of $errlvl, $locip, or $rmtip. The number must be an integer, and the following operators are available and have their traditional C language meanings: ==, !=, <, >, <=, and >=.
init initstring Sets the initialization string sent to the modem by the reset command to initstring.
mode SLIP|CSLIP Sets the protocol mode for the connection and makes dip go into daemon mode. This command normally causes dip to go into daemon mode and not return control to the script or the DIP> command line.
modem HAYES Sets the modem type. Only the HAYES modem type is now supported. (HAYES must be capitalized.)
netmask mask Sets the netmask for the routes dip installs to mask.
parity E|O|N Sets the parity of the serial line: even, odd, or none.
password Prompts the user for a password and retrieves it in a secure manner. This command doesn’t echo the password as you type it.
print Echoes text to the console dip started on. Variables included in the text are replaced with their values.
port dev Sets the device dip uses.
quit Exits the dip program.
reset Sends the init string to the serial line.
send text Sends the specified text to the serial line. The traditional C-style backslash sequences are properly handled.
sleep num Delays processing for the specified number of seconds.
speed num Sets the serial line speed.
stopbits bits Sets the number of stop bits used by the serial port.
timeout num Sets the default timeout to the integer value num. This is measured in seconds.
term Makes dip go into terminal emulation mode. This allows you to interface directly with the serial link. Pressing <Ctrl+]> returns you to the DIP> prompt.
wait word num Makes dip wait for the specified word to arrive on the serial line with a timeout of num seconds.

dip also provides a number of variables for your use. Some, such as the local and remote IP addresses, can be set by you; others are read-only and are used for diagnostic and informational purposes. Each variable begins with a dollar sign and must be typed in lowercase letters. Table 29.3 lists these variables and their uses.

Table 29.3 Variables Provided by dip

Variable Description

$local The host name of the local machine.
$locip The IP address assigned to the local machine.
$remote The host name of the remote machine.
$rmtip The IP address of the remote machine.
$mtu The MTU value for the connection.
$modem The modem type being used (read-only).
$port The name of the serial device dip is using (read-only).
$speed The speed setting of the serial device (read-only).
$errlvl The result code of the last command (read-only) executed. Zero indicates success; any other value is an error.


TIP:  Setting the $local or $remote variable to a host name causes dip to resolve the host name to its IP address and store that in the respective IP address variable. This saves a step in the scripts you write.


NOTE:  You can’t set the read-only variables directly by using the get command.


Previous Table of Contents Next