xref: /illumos-gate/usr/src/man/man1c/cu.1c (revision 6446bd46ed1b4e9f69da153665f82181ccaedad5)

Sun Microsystems, Inc. gratefully acknowledges The Open Group for
permission to reproduce portions of its copyrighted documentation.
Original documentation from The Open Group can be obtained online at
http://www.opengroup.org/bookstore/.

The Institute of Electrical and Electronics Engineers and The Open
Group, have given us permission to reprint portions of their
documentation.

In the following statement, the phrase ``this text'' refers to portions
of the system documentation.

Portions of this text are reprinted and reproduced in electronic form
in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
Standard for Information Technology -- Portable Operating System
Interface (POSIX), The Open Group Base Specifications Issue 6,
Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
Engineers, Inc and The Open Group. In the event of any discrepancy
between these versions and the original IEEE and The Open Group
Standard, the original IEEE and The Open Group Standard is the referee
document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html.

This notice shall appear on any product containing this material.

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]


Copyright 1989 AT&T
Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved.

CU 1C "May 11, 2001"
NAME
cu - call another UNIX system
SYNOPSIS

cu [-c device | -l line] [-s speed] [-b bits] [-h] [-n]
 [-t] [-d] [-o | -e] [-L] [-C] [-H]  telno | systemname
 [local-cmd]
DESCRIPTION

The command cu calls up another UNIX system, a terminal, or possibly a non-UNIX system. It manages an interactive conversation with possible transfers of files. It is convenient to think of cu as operating in two phases. The first phase is the connection phase in which the connection is established. cu then enters the conversation phase. The -d option is the only one that applies to both phases.

OPTIONS

cu accepts many options. The -c, -l, and -s options play a part in selecting the medium. The remaining options are used in configuring the line. -b bits

Forces bits to be the number of bits processed on the line. bits is either 7 or 8. This allows connection between systems with different character sizes. By default, the character size of the line is set to the same value as the current local terminal, but the character size setting is affected by LC_CTYPE also.

-c device

Forces cu to use only entries in the "Type" field (the first field in the /etc/uucp/Devices file) that match the user specified device, usually the name of a local area network.

-C

Runs the local-cmd specified at the end of the command line instead of entering interactive mode. The stdin and stdout of the command that is run refer to the remote connection.

-d

Prints diagnostic traces.

-e

Sets an EVEN data parity. This option designates that EVEN parity is to be generated for data sent to the remote system.

-h

Sets communication mode to half-duplex. This option emulates local echo in order to support calls to other computer systems that expect terminals to be set to half-duplex mode.

-H

Ignores one hangup. This allows the user to remain in cu while the remote machine disconnects and places a call back to the local machine. This option should be used when connecting to systems with callback or dialback modems. Once the callback occurs subsequent hangups will cause cu to terminate. This option can be specified more than once. For more information about dialback configuration, see remote(5) and System Administration Guide: IP Services

-l line

Specifies a device name to use as the communication line. This can be used to override the search that would otherwise take place 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 /etc/uucp/Devices file record in which line matches the second field (the Line field). When the -l and -s options are both used together, cu will search the /etc/uucp/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. In the general case where a specified device is a directly connected asynchronous line (for instance, /dev/term/a), a telephone number (telno) is not required. The specified device need not be in the /dev directory. If the specified device is associated with an auto dialer, a telephone number must be provided.

-L

Goes through the login chat sequence specified in the /etc/uucp/Systems file. For more information about the chat sequence, see System Administration Guide: IP Services

-n

Requests user prompt for telephone number. For added security, this option will prompt the user to provide the telephone number to be dialed, rather than taking it from the command line.

-o

Sets an ODD data parity. This option designates that ODD parity is to be generated for data sent to the remote system.

-s speed

Specifies the transmission speed (300, 1200, 2400, 4800, 9600, 19200, 38400). The default value is "Any" speed which will depend on the order of the lines in the /etc/uucp/Devices file.

-t

Dials a terminal which has been set to auto answer. Appropriate mapping of carriage-return to carriage-return-line-feed pairs is set.

OPERANDS

The following operands are supported: telno

When using an automatic dialler, specifies the telephone number with equal signs for secondary dial tone or minus signs placed appropriately for delays of 4 seconds.

systemname

Specifies a uucp system name, which can be used rather than a telephone number; in this case, cu will obtain an appropriate direct line or telephone number from a system file.

USAGE
"Connection Phase"

cu uses the same mechanism that uucp(1C) does to establish a connection. This means that it will use the uucp control files /etc/uucp/Devices and /etc/uucp/Systems. This gives cu the ability to choose from several different media to establish the connection. The possible media include telephone lines, direct connections, and local area networks (LAN). The /etc/uucp/Devices file contains a list of media that are available on your system. The /etc/uucp/Systems file contains information for connecting to remote systems, but it is not generally readable.

Note: cu determines which /etc/uucp/Systems and /etc/uucp/Devices files to use based upon the name used to invoke cu. In the simple case, this name will be "cu", but you could also have created a link to cu with another name, such as "pppcu", in which case cu would then look for a "service=pppcu" entry in the /etc/uucp/Sysfiles file to determine which /etc/uucp/Systems file to use.

The telno or systemname parameter from the command line is used to tell cu what system you wish to connect to. This parameter can be blank, a telephone number, a system name, or a LAN specific address. telephone number

A telephone number is a string consisting of the tone dial characters (the digits 0 through 9, *, and #) plus the special characters = and -. The equal sign designates a secondary dial tone and the minus sign creates a 4 second delay.

system name

A system name is the name of any computer that uucp can call; the uuname(1C) command prints a list of these names.

LAN address

The documentation for your LAN will show the form of the LAN specific address.

If cu's default behavior is invoked (not using the -c or -l options), cu will use the telno or systemname parameter to determine which medium to use. If a telephone number is specified, cu will assume that you wish to use a telephone line and it will select an automatic call unit (ACU). Otherwise, cu will assume that it is a system name. cu will follow the uucp calling mechanism and use the /etc/uucp/Systems and /etc/uucp/Devices files to obtain the best available connection. Since cu will choose a speed that is appropriate for the medium that it selects, you may not use the -s option when this parameter is a system name.

The -c and -l options modify this default behavior. -c is most often used to select a LAN by specifying a Type field from the /etc/uucp/Devices file. You must include either a telno or systemname value when using the -c option. If the connection to systemname fails, a connection will be attempted using systemname as a LAN specific address. The -l option is used to specify a device associated with a direct connection. If the connection is truly a direct connection to the remote machine, then there is no need to specify a systemname. This is the only case where a telno or systemname parameter is unnecessary. On the other hand, there may be cases in which the specified device connects to a dialer, so it is valid to specify a telephone number. The -c and -l options should not be specified on the same command line.

"Conversation Phase"

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. Lines beginning with ~ have special meanings.

"Commands"

The transmit process interprets the following user initiated commands: ~.

Terminates the conversation.

~!

Escapes to an interactive shell on the local system.

~!cmd\|.\|.\|.

Runs cmd on the local system (via sh -c).

~$cmd\|.\|.\|.

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

~%cd

Changes 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\|]

Copies 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\|]

Copies file from (on local system) to file to on remote system. If to is omitted, the from argument is used in both places.

~~\|line

Sends the line ~ line to the remote system.

~%break

Transmits a BREAK to the remote system (which can also be specified as ~%b).

~%debug

Toggles the -d debugging option on or off (which can also be specified as ~%d).

~t

Prints the values of the termio structure variables for the user's terminal (useful for debugging).

~l

Prints the values of the termio structure variables for the remote communication line (useful for debugging).

~%ifc

Toggles between DC3/DC1 input control protocol and no input control. This is useful when the remote system does not respond properly to the DC3 and DC1 characters (can also be specified as \(ap%nostop).

~%ofc

Toggles the output flow control setting. When enabled, outgoing data may be flow controlled by the remote host (can also be specified as \(ap%noostop).

~%divert

Allows/disallows unsolicited diversions. That is, diversions not specified by ~%take.

~%old

Allows/disallows old style syntax for received diversions.

~%nostop

Same as ~%ifc.

The receive process normally copies data from the remote system to the standard output of the local system. It may also direct the output to local files.

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 these current control characters 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, and that the remote system must be using the Bourne shell, sh. Also, tabs mode (see stty(1)) should be set on the remote system if tabs are to be copied without expansion to spaces.

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 by using ~\|~. Executing a tilde command reminds the user of the local system uname. For example, uname can be executed on Z, X, and Y as follows:

uname
Z
~[X]!uname
X
~~[Y]!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

Example 1 Dialling a system

To dial a system whose telephone number is 9 1 201 555 1234 using 1200 baud (where dialtone is expected after the 9):

example% cu -s 1200 9=12015551234

If the speed is not specified, "Any" is the default value.

Example 2 Logging in to a system on a direct line

To login to a system connected by a direct line:

example% cu -l /dev/term/b

or

example% cu -l term/b

Example 3 Dialling a system with specific line and speed

To dial a system with a specific line and speed:

example% cu -s 1200 -l term/b

Example 4 Using a system name

To use a system name:

example% cu systemname
ENVIRONMENT VARIABLES

See environ(7) for descriptions of the following environment variables that affect the execution of cu: LC_CTYPE, LC_MESSAGES, and NLSPATH.

EXIT STATUS

The following exit values are returned: 0

Successful completion.

>0

An error occurred.

FILES
/etc/uucp/Devices

device file

/etc/uucp/Sysfiles

system file

/etc/uucp/Systems

system file

/var/spool/locks/*

lock file

SEE ALSO

cat (1), echo (1), stty (1), tip (1), uname (1), ct (1C), uucp (1C), uuname (1C), remote (5), attributes (7), environ (7)

System Administration Guide: IP Services

NOTES

The cu utility takes the default action upon receipt of signals, with the exception of: SIGHUP

Close the connection and terminate.

SIGINT

Forward to the remote system.

SIGQUIT

Forward to the remote system.

SIGUSR1

Terminate the cu process without the normal connection closing sequence.

The cu command does not do any integrity checking on data it transfers. Data fields with special cu characters may not be transmitted properly. Depending on the interconnection hardware, it may be necessary to use a ~. to terminate the conversion, even if stty 0 has been used. Non-printing characters are not dependably transmitted using either the ~%put or ~%take commands. ~%put and ~%take cannot be used over multiple links. Files must be moved one link at a time.

There is an artificial slowing of transmission by cu during the ~%put operation so that loss of data is unlikely. Files transferred using ~%take or ~%put must contain a trailing newline, otherwise, the operation will hang. Entering a Control-D command usually clears the hang condition.