NAME
termnet - Simple Telnet replacement
SYNOPSIS
termnet [ options ] [ host/port ] [ chat-sequences ]
DESCRIPTION
This man page documents the termnet program. This command is a simple
telnet replacement. It does not implement for the complete telnet
protocol, but does provide a few nifty features of it’s own.
Especially when used with the termnetd terminal server daemon.
The following features are available:
Telnet compatible (it can used to connect to telnetd).
Live setting of a device’s baud rate and port
configuration when connected to the termnetd terminal server
daemon.
Simple scripting using chat-like sequences.
OPTIONS
-7 Emulate 7 bit even parity data. This will calculate an even
parity bit on the least significant 7 bits of each outgoing
character and append it to the charater. It will also strip the
8th (MSb) bit from the incomming data before displaying it.
-b baud-rate
Sets the initial baud-rate of the device.
-c Do not drop the connection after running the chat sequences
either presented on the command line or performed through the -f
option.
-e Provide local echoing of the characters entered from the
keyboard.
-f script-file
Run through the script specified by script-file.
-o out-file
Sends all output to the file specified.
-p port-settings
Configures the port as specified by port settings. See the PORT
command below for further information.
COMMANDS
Commands may be given from within a script or by entering the command
line mode using the escape character which is presently set to
´^]´. At this time, unlike with Telnet, the escape character cannot be
changed.
The following commands are available:
$ [unix-command]
Executes the unix-command it’s stdio redirected to the socket.
Sadly, this does not run programs like sz and rz, though it
is handily for down-loading ASCII files or the like. A space
must be present between the $ and the command.
! [unix-command]
Executes the unix-command and sends it’s output to the output
file (normally stdout). A space must be present between the !
and the command.
BAUD [baudrate]
If baudrate is present, the baud rate of the port is set to
that. Otherwise the current baudrate of the port is displayed.
The following baudrates are accepted:
50
75
110
134
200
300
600
1200
2400
9600
19200
38400
Accepted by Linux Only:
57600
115200
230400
CHAT chat-file
This command executes the chat-file specified. See the
section CHAT Scripts for further information.
DEVC Displays the name of the physical device that is connected.
ECHO [string]
Echoes string to the output.
ECHO ON|OFF
Turns the local echoing of characters input from the keyboard
on or off.
EXIT Closes the connection and exits the program.
PAUSE secs
Causes the interpretation of commands to be paused for secs
seconds. Most useful in chat scripts.
PORT [port-settings]
If port-settings is present, the port will be configured
to them. Otherwise, the current settings will be displayed.
The settings are specified by a string of one or more of the
following concatenated together with no intervening spaces:
8 8 Bits / Character
7 7 Bits / Character
6 6 Bits / Character
5 5 Bits / Character
N No Parity
E Even Parity
O Odd Parity
C0 No H/W Flow Control
C1 H/W Flow Control
S0 No S/W Flow Control
S1 S/W Flow Control
CHAT SCRIPTS
The chat scripts are composed of a sequence of send strings followed
by expect strings. The program will first send a string then wait for
the expected string to be received. Commands my be injected into the
sequence at any point be surrounding the entire command with ´‘´
quotes. The biggest weakness is that there are no time limits on how
long the program will wait for the expected string. Fortunately the
keyboard is fully active while they are being executed.
EXAMPLE SCRIPT
The following is an example of a chat script. In practice I keep this
script in the file /usr/lib/ppp/connect-work. It logs me into my
computer as a special user that sets my computer to call me back to
establish a PPP link between my computer at home and my computer at
work.
"atdt19725551212\r"
"ogin"
"et\r" "assword"
"MyPassword\r" "+++"
"+++" "OK"
"ath0\r" "OK"
This simple script dials out the number, then waits for ´ogin´ then
logs in as the user ´et´ giving the required password when requested.
At that point it waits to see a ´+++´ from the login script, and
forces the modem to go into the command mode with the ´+++´ and
hangs it up with the ´ath0´ command.
Though the quotes are not required, I find they make the scripts much
easier to read. Also, if the script is on the command line, you have
to be mindful of the substitutions that may occur from the shell.
SEE ALSO
termnetd(1), ttyd(1), termios(2)
AUTHOR
Joe Croft <joe@croftj.net>