Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > C

cu(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

cu — call another (UNIX) system; terminal emulator

SYNOPSIS

cu [-s speed] [-l line] [-h] [-q] [-t] [-d level] [-e|-o] [-m] [-n] [telno |systemname |dir]

UNIX Standard Syntax

cu [-s speed] [-l line] [-h] [-q] [-t] [-d] [-e|-o] [-m] [-n] [telno |systemname |dir]

DESCRIPTION

cu calls up another system, which is usually a UNIX operating system, but can be a terminal or a non-UNIX operating system. cu manages all interaction between systems, including possible transfers of ASCII files.

Options

cu recognizes the following options and command-line arguments:

-sspeed

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

-lline

Specify 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 obtained from file /etc/uucp/Devices. When the -l and -s options are used simultaneously, cu searches /etc/uucp/Devices to determine whether the requested speed for the requested line is available. If so, the connection is made at the requested speed; otherwise, an error message is printed and the call is not made. The specified device is usually a directly connected asynchronous line (such as /dev/ttyapb). In this case, a telephone 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 telephone number must be provided.

-h

Emulate local echo, supporting calls to other computer systems that expect terminals to be set to half-duplex mode.

-q

Use ENQ/ACK handshake (remote system sends ENQ, cu sends ACK.)

-t

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

-dlevel

Print diagnostic traces. level is a number from 0-9, where higher levels produce more detail in the diagnostic messages.

-d

(UNIX Standard only, see standards(5).) Print diagnostic traces. The level is always 9.

-e (-o)

Generate even (odd) parity for data sent to the remote.

-m

Specify a direct line that has modem controls. Modem controls are ignored by cu.

-n

Cause the telephone number that cu dials to be requested interactively from the user rather than taking it from the command line.

telno

When using an automatic dialer, telno is the telephone number, with equal signs for secondary dial tone or minus signs for delays appropriately placed in the telno string.

systemname

A UUCP system name can be used instead of a telephone number (see uucp(1)); in this case, cu obtains an appropriate direct line or telephone number from /etc/uucp/Systems (including appropriate baud rate). cu dials each telephone number or direct line for systemname in the Systems file until a connection is made or all the entries are tried.

dir

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

After making the connection, cu runs as two processes:

  • transmit process reads data from the standard input and, except for lines beginning with ~, passes it to the remote system;

  • 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 to ensure that 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.

Transmit Process Commands

The transmit process interprets the following commands:

~., ~..

Terminate the conversation. On hard-wired lines, ~. sends several EOF characters to log out the session, whereas ~.. suppresses the EOF sequence. In general the remote hard-wired machine is unaware of the disconnect if ~.. is used. On dial-up connections, ~. and ~.. do not differ.

~!

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 otherwise compete for input.

~&cmd ...

Run cmd on the local system (via sh -c) and kill the receive process, restarting it later.

~|cmd

Pipe incoming data from the remote system through the standard input to cmd on the local system. To terminate, reset with either a ~& or ~| command.

~|

Resets the receive process following a ~|cmd command.

~$cmd ...

Run cmd locally and send its output to the remote system.

~%cd

Change the directory on the local system. Note: ~!cd causes the command to be run by a sub-shell, causing a return to the current directory upon completion.

~%take remote_source_file [local_destination_file]

Copy file remote_source_file from the remote system to file local_destination_file on the local system. If local_destination_file is not specified, the remote_source_file argument is used in both places.

~%put local_source_file [remote_destination_file]

Copy file local_source_file on local system to file remote_destination_file on remote system. If remote_destination_file is not specified, the local_source_file 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

Toggle between DC3/DC1 input control protocol and no input control. This is useful if the remote system does not respond properly to the DC3 and DC1 characters.

~%<file

Send the contents of the local file to the remote system using prompt handshaking. The specified file is read one 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 always appears 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 HP 3000 system running MPE. This is usually accomplished by running the MPE FCOPY utility 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 might be useful with other systems also, such as an HP 1000 running RTE.

~%setpt n

Specify the number of seconds to wait for a prompt before giving up. The default is 2 seconds. Specifying a timeout of 0 seconds disables handshaking; that is, handshake appears to complete immediately.

~%setps xy

Set the handshake prompt to the characters xy. The default is DC1. The prompt can be any one or two characters. To specify a control character for x or y, use the Ctrl-X form where a circumflex (ASCII 94) precedes the character, as in ^X. A null character can be specified with ^@. (A null first character in the prompt implies a "null" prompt, which always appears to be satisfied.) A circumflex 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 ~%> terminates it, whereas ~%> anotherfile terminates it and begins 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 appends 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.

~susp

Suspend the cu session. susp is the suspend character set in the terminal when cu was invoked (usually ^Z — see stty(1)). As in all other lines starting with tilde, a ~susp line must be terminated by pressing Return.

Receive Process

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 that the remote system support the echo and cat commands (see echo(1) and cat(1). Also, stty tabs mode should be set on the remote system if tabs are being copied without expansion. When connecting to a machine that uses the eighth bit as a parity bit, stty istrip mode should be set on the local system.

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, using the keyboard on system X, uname can be executed on Z, X, and Y as follows where lines 1, 3, and 5 are keyboard commands, and lines 2, 4, and 6 are system responses:

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.

EXTERNAL INFLUENCES

For information about the UNIX Standard environment, see standards(5).

Environment Variables

LANG determines the language in which messages are displayed.

If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, cu behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported.

DIAGNOSTICS

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

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 log in on a system connected by a direct line:

cu -l/dev/ttyXpX dir

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

cu -s1200 -l/dev/ttyXpX dir

To dial a system using a specific line:

cu -l/dev/culXpX 2015551212

To use a system name (yyyzzz):

cu yyyzzz

To connect directly to a modem:

cu -l/dev/culXX -m dir cu -l/dev/cu1XX -m dir

WARNINGS

cu buffers input internally.

AUTHOR

cu was developed by AT&T and HP.

FILES

/etc/uucp/Systems /etc/uucp/Devices /etc/uucp/Dialers /var/spool/locks/LCK..(tty-device) /dev/null

STANDARDS CONFORMANCE

cu: SVID2, SVID3, XPG2, XPG3, XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.