Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat(1)

ct(1)

echo(1)

stty(1)

uname(1)

uucp(1)

CU(1)  —  HP-UX

NAME

cu − call another (UNIX) system; terminal emulator

SYNOPSIS

cu [−sspeed] [−lline] [−h] [−q] [−t] [−d] [−e|−o] [−m] [−n] telno │ systemname │ dir

DESCRIPTION

Cu calls up another system, which will usually be a UNIX operating system, but may be a terminal or a non-UNIX operating system.  It manages an interactive conversation with possible transfers of ASCII files.  Cu accepts the following options and arguments. 

−sspeed Specifies the transmission speed (110, 150, 300, 600, 1200, 2400, 3600, 4800, 7200, 9600, 19200).  The default value is 300. 

When using a direct-connect line, the −s option has no effect.  The first line which matches the −l option is used, and its speed is taken from L-devices. 

−lline Specifies a device name to use as the communication line. This can be used to override searching for the first available line having the right speed. When the -l option is used without the -s option, the speed of a line is taken from the file /usr/lib/uucp/L-devices.  When the -l and -s options are used simultaneously, cu will search the L-devices file to check if the requested speed for the requested line is available. If so, the connection will be made at the requested speed; otherwise an error message will be printed and the call will not be made.  The specified device is generally a directly connected asynchronous line (e.g., /dev/ttyab). In this case a phone number is not required but the string dir can be used to specify that a dialer is not required. If the specified device is associated with an auto dialer, a phone number must be provided. 

−h Emulates local echo, supporting calls to other computer systems which expect terminals to be set to half-duplex mode. 

−q Invokes the use of ENQ/ACK handshake. (Remote sends ENQ, cu sends ACK.) 

−t Used when dialing an ASCII terminal which has been set to auto answer.  Appropriate mapping of carriage-return to carriage-return-line-feed pairs is set. 

−d Causes diagnostic traces to be printed. 

−e(−o) Designates that even (odd) parity is to be generated for data sent to the remote. 

−m Designates a direct line which has modem controls. The modem controls are to be ignored by cu. 

−n Will request the phone number to be dialed from the user rather than taking it from the command line. 

 telno When using an automatic dialer, the argument is the telephone number with equal signs for secondary dial tone or minus signs for delays, at appropriate places. 

 systemname A uucp system name may be used rather than a phone number; in this case, cu will obtain an appropriate direct line or phone number from /usr/lib/uucp/L.sys (the appropriate baud rate is also read along with phone numbers).  Cu will try each phone number or direct line for systemname in the L.sys file until a connection is made or all the entries are tried. 

 dir Using dir ensures that cu will use the line specified by the -l option. 

After making the connection, cu runs as two processes: the transmit process reads data from the standard input and, except for lines beginning with ~, passes it to the remote system; the receive process accepts data from the remote system and, except for lines beginning with ~, passes it to the standard output.  Normally, an automatic DC3/DC1 protocol is used to control input from the remote so the buffer is not overrun.  Prompt handshaking can be used to control transfer of ASCII files to systems that have no type-ahead capability but require data to be sent only after a prompt is given.  This is described in detail below.  Lines beginning with ~ have special meanings. 

The transmit process interprets the following:

~. and ~..  terminate the conversation.  On a hardwired line (only), ~.  sends several EOF characters to log out the session; ~..  will suppress the EOF sequence.  In general the remote hardwired machine will be unaware of the disconnect if ~..  is used.  ~.  and ~..  do not differ for dialup connections. 

~!  escape to an interactive shell on the local system. 

~!cmd... run cmd on the local system (via sh −c). 

~& similar to ~!  but kill the receive process, restarting it upon return from the shell. This is useful for invoking sub-processes that read from the communication line, where the receive process would be otherwise competing for input. 

~&cmd... run cmd on the local system (via sh −c) and kill the receive process, restarting it later. 

~$cmd... run cmd locally and send its output to the remote system. 

~%cd change the directory on the local system.  NOTE: ~!cd will cause the command to be run by a sub-shell; probably not what was intended. 

~%take from [ to ]
copy file from (on the remote system) to file to on the local system.  If to is omitted, the from argument is used in both places. 

~%put from [ to ]
copy file from (on local system) to file to on remote system.  If to is omitted, the from argument is used in both places. 

~~... send the line ~... to the remote system. If you use cu on the remote system to access a third remote system, send ~~. to cause the second remote cu to exit. 

~%break transmit a BREAK to the remote system. 

~%nostop toggles between DC3/DC1 input control protocol and no input control.  This is useful in case the remote system is one which does not respond properly to the DC3 and DC1 characters. 

~%<file sends the contents of the local file to the remote system using prompt handshaking.  The specified file is read a line at a time, and each line is sent to the remote system when the prompt sequence is received.  If no prompt is received by the time the prompt timeout occurs, the line is sent anyway.  If the timeout is set to 0 seconds, or if the first character in the prompt sequence is a null character (^@), the handshake will always appear to be satisfied immediately, regardless of whether or not the remote system generates a prompt. This capability is intended mainly to facilitate transfer of ASCII files from HP-UX to an HP3000 system running MPE.  This is usually accomplished by running the MPE utility FCOPY, and giving the command "from=;to=destfile;new" and then running the cu input diversion to send the file to FCOPY, which saves it in "destfile." This facility may also be useful with other systems, an HP1000 running RTE, for example.

~%setpt n this specifies the number of seconds to wait for a prompt before giving up.  The default is 2 seconds.  Specifying a timeout of 0 seconds will disable handshaking, i.e., handshake will appear to complete immediately. 

~%setps xy set the handshake prompt to the characters xy. The default is DC1. The prompt may be any one or two characters.  A control character X, i.e., Control-X, is specified with a caret (ASCII 94) preceding the character, i.e., ^X.  A null character may be specified with ^@. (A null first character in the prompt implies a "null" prompt, which always appears to be satisfied.) A caret is specified by ^^.

~%>[>]file divert output from the remote system to the specified file until another ~%> command is given. When an output diversion is active, typing ~%> will terminate it, and ~%> anotherfile will terminate it and begin a new one. The output diversion remains active through a ~& subshell, but unpredictable results can occur if input/output diversions are intermixed with ~%take or ~%put.  The ~%>> command will append to the named file. Note that these commands, which are interpreted by the transmit process, are unrelated to the ~> commands described below, which are interpreted by the receive process. 

If the implementation supports HP-UX job control (see csh(1)), the following additional command is available:

~susp Suspend the cu session.  Susp is the suspend character that was in use when cu was invoked (usually ^Z) (see stty(1).) 

The receive process normally copies data from the remote system to its standard output.  A line from the remote that begins with ~> initiates an output diversion to a file.  The complete sequence is:

~>[>]:file
zero or more lines to be written to file
~>

Data from the remote is diverted (or appended, if >> is used) to file. The trailing ~> terminates the diversion. 

The use of ~%put requires stty(1) and cat(1) on the remote side. It also requires that the current erase and kill characters on the remote system be identical to the current ones on the local system. Backslashes are inserted at appropriate places.

The use of ~%take requires the existence of echo(1) and cat(1) on the remote system. Also, stty tabs mode should be set on the remote system if tabs are to be copied without expansion. 

When cu is used on system X to connect to system Y and subsequently used on system Y to connect to system Z, commands on system Y can be executed if ~~ is used. For example, uname can be executed on Z, X, and Y as follows: uname
Z
~!uname
X
~~!uname
Y

In general, ~ causes the command to be executed on the original machine; ~~ causes the command to be executed on the next machine in the chain. 

EXAMPLES

To dial a system whose number is 9 201 555 1212 using 1200 baud:

cu  -s1200   9=2015551212

If the speed is not specified, 300 is the default value. 

To login to a system connected by a direct line:

cu  -l/dev/ttyXX  dir

To dial a system with the specific line and a specific speed:

cu  -s1200  -l/dev/ttyXX  dir

To dial a system using a specific line:

cu  -l/dev/culXX  2015551212

To use a system name:

cu  YYYZZZ

To connect directly to a modem:

cu -l/dev/culXX -m dir

FILES

/usr/lib/uucp/L.sys
/usr/lib/uucp/L-devices
/usr/spool/uucp/LCK..(tty-device)
/dev/null

SEE ALSO

cat(1), ct(1), echo(1), stty(1), uname(1), uucp(1). 

DIAGNOSTICS

Exit code is zero for normal exit, non-zero (various values) otherwise. 

WARNINGS

Cu buffers input internally. 

There is an artificial slowing of transmission by cu during the ~%put operation so that loss of data is unlikely. 

AUTHOR

Cu was developed by AT&T and HP. 

INTERNATIONAL SUPPORT

8- and 16-bit data. 

Hewlett-Packard Company  —  Version B.1,  April 12, 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026