DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

cu(C)


cu -- call another UNIX/XENIX system

Syntax

cu [ -dht ] [ -l line ] [ -o | -e | -oe ] [ -s speed ] [ -x n ] telno

cu [ -dht ] [ -l line ] [ -o | -e | -oe ] [ -s speed ] [ -x n ] -n

cu [ -dht ] [ -o | -e | -oe ] [ -s speed ] [ -x n ] -l line [ dir ]

cu [ -dht ] [ -o | -e | -oe ] [ -x n ] systemname

Description

The cu command calls up another UNIX system, a terminal, or possibly a non-UNIX system. It manages an interactive conversation with possible transfers of ASCII files.

cu accepts the following options and arguments:


-s speed
Specifies the transmission speed (150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400). The default value is ``Any'' speed which will depend on the order of the lines in the /usr/lib/uucp/Devices file. A speed range can also be specified (for example, -s 1200-4800).

-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 Devices file. When the -l and -s options are both used together, cu will search the 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 (for example, /dev/ttyab) in which case 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. Use of this option with systemname rather than telno will not give the desired result (see systemname below).

-d
Enables diagnostic tracing.

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

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

-x n
Causes diagnostic traces to be printed; it produces a detailed output of the program execution on stderr. The debugging level, n, is a single digit in the range 0 to 9; -x 9 is the most useful value.

-n
For added security, -n will prompt the user to provide the telephone number to be dialed 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 placed appropriately for delays of 4 seconds.

systemname
A UUCP system name may be used rather than a telephone number. In this case, cu will obtain an appropriate direct line or telephone number from /usr/lib/uucp/Systems. Note: the systemname option should not be used in conjunction with the -l and -s options as cu will connect to the first available line for the system name specified, ignoring the requested line and speed.

dir
The keyword dir can be used with cu -l line, in order to talk directly to a modem on that line, instead of talking to another system via that modem. This can be useful when debugging or checking modem operation. Note: only users with write access to the Devices file are permitted to use cu -l line dir.

In addition, cu uses the following options to determine communications settings:


-o
the remote system expects or sends 7-bits with odd parity

-e
the remote system expects or sends 7-bits with even parity

-oe
the remote system expects or sends 7-bits, ignoring parity and sends 7-bits with either parity
By default, cu expects and sends 8-bit characters without parity. If the login prompt received appears to contain incorrect 8-bit characters, or a correct login is rejected, use the 7-bit options described above.

After making the connection, cu runs as two processes: the transmit process and the receive process. The transmit process reads data from standard input and, except for lines beginning with ``~'', passes the data to the remote system. The receive process accepts data from the remote system and, except for lines beginning with ``~'', passes the data to standard output.

Normally, an automatic XON/XOFF protocol is used to control input from the remote system so the buffer is not overrun.

Lines beginning with ``~'' have special meanings.

The transmit process interprets the following user-initiated commands:


~.
Terminate the conversation.

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

~!cmd ...
Run cmd on the local system (via sh -c).

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

~+cmd ...
Run cmd on the local system but take standard input from 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 there_name [ here_name ]
Copy file there_name on the remote system to file here_name on the local system. If here_name is omitted, the pathname there_name on the remote system is used by default.

~%put here_name [ there_name ]
Copy file here_name on the local system to file there_name on the remote system. If there_name is omitted, the pathname here_name on the local system is used by default.

For both ~%take and ~%put commands, as each block of the file is transferred, consecutive single digits are printed to the terminal


~~line
Send the line ~line to the remote system.

~%b
~%break
Transmit a BREAK to the remote system.

~%d
~%debug
Toggles the -x debugging level between 0 and 9.

~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).

~%nostop
Toggles between XON/XOFF input control protocol and no input control. This is useful in case the remote system is one which does not respond properly to the XON and XOFF characters.
The use of ~%put requires stty(C) and cat(C) 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(C) and cat on the remote system. Also, tabs mode (see stty(C)) should be set on the remote system if tabs are to be copied without expansion to spaces.

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

You can construct take and put commands that work between UNIX and non-UNIX systems by sending the appropriate characters to cu. To do this, you will need to know the equivalent of echo and cat on the non-UNIX system.

For example, to transfer a file named fred from a remote non-UNIX system to the file /tmp/fred on the local UNIX system, construct a command similar to the following:

   ~%
   echo '~>':/tmp/fred
   cat fred
   echo '~>'
This creates a file /tmp/fred on the local UNIX system, putting the characters ``~>'' into it, which tells cu to start receiving data into this file. The file fred is then sent to standard output on the remote machine, and cu therefore receives it. Finally, a ``~>'' is echoed into the file; this is a signal to cu to stop receiving input. (Remember to replace echo and cat with the equivalent commands for the non-UNIX system.)

You can also append the file from the remote machine to an existing file on the local system:

   ~%
   echo '~>>':/tmp/fred
   cat fred
   echo '~>'
This appends the remote file onto the end of the existing file /tmp/fred.

When cu is used on system1 to connect to system2 and subsequently used on system2 to connect to system3, commands on system2 can be executed by using ``~~''. Executing a tilde command reminds the user of the local system uname. For example, uname can be executed on systems 1, 2, and 3 as follows:

   uname
   system3
   ~!uname
   system1
   ~~!uname
   system2
In general, ``~'' causes the command to be executed on the original machine, and ``~~'' causes the command to be executed on the next machine in the chain.

Exit values

Exit code is zero for normal exit, otherwise, one.

Examples

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

cu -s 1200 9=2015551212

If the speed is not specified, ``Any'' is the default value.

To login to a system connected by a direct line:

cu -l /dev/ttyXX or cu -l ttyXX

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

cu -s 1200 -l ttyXX

To dial a system using a specific line associated with an auto dialer:

cu -l ttyXX 9=2015551212

To call up a system named jimmy:

cu jimmy

To talk directly to an ACU (connect directly with the modem and enter modem commands manually):

cu -l ttyXX dir

Warning

The cu command does not do any integrity checking on data it transfers. Data fields with special cu characters may not be transmitted properly.

Limitations

There is an artificial slowing of transmission by cu during the ~%put operation so that loss of data is unlikely. Depending on the interconnection hardware, it may be necessary to use a ``~.'' to terminate the conversion even if stty0 has been used. Non-printing characters are not dependably transmitted using either the ~%put or ~%take commands. cu between an IMBR1 and a penril modem will not return a login prompt immediately upon connection. A carriage return will return the prompt.

Files


/usr/spool/uucp/LCK..tty
lock file for tty device

See also

cat(C), ct(C), Devices(F), echo(C), stty(C), Systems(F), uname(C), uucp(C)

Standards conformance

cu is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003