CU(1C) CU(1C) NAME cu - call another UNIX system SYNOPSIS cu [options] [-s speed] -l line cu [options] [-s speed] [-l line] [-n] telno cu [options] systemname where options can be any of: [-h] [-d] [-o | -e] [-c class] DESCRIPTION cu 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: -sspeed Specifies the transmission speed (300, 1200, 2400, 4800, 9600); The default value is "Any" speed which will depend on the order of the lines in the /etc/uucp/Devices file. -lline 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. If the device is not found in the Devices file, an error message similar to NO DEVICES AVAILABLE is printed. The specified device is generally a directly connected asynchronous line (e.g., /dev/ttyd4) 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. A line also used by getty(1M) cannot be used with this option. A line in use by uugetty(1M) can be used, provided the same physical device name is used by both cu and uugetty. However, if uugetty(1M) is being used, there is likely to be an autodialing modem on the line, using an entry in the Dialers file like the Hayes24 entry, and ready to accept a telephone, telno, number from the cu command. Use of this option with systemname rather than telno will not give the desired result (see systemname below). -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. -d Causes diagnostic traces to be printed. -o Designates that odd parity is to be generated for data sent to the remote system. -n For added security, will prompt the user to provide the telephone number to be dialed rather than taking it from the command line. -e Designates that even parity is to be generated for data sent to the remote system. -cclass Specifies a modem "class" such as ACU or Direct found in the Dialers file. 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 /etc/uucp/Systems. Note that 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. Note that only the telephone number will be used from the /etc/uucp/Systems file; the chatting to log into the remote system will not be used since it is unlikely that an interactive user wants to start SLIP, PPP, or UUCP. 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. 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. ~^Z suspend the cu session. (^Z, control-Z, is the current job control suspend character (see csh(1) and stty(1)). ~%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. The shell commands below are sent to the remote machine to cause it to transmit the file. In fact, they are sent in a single line with semicolons (;) between each command. stty -echo if test -r arg1; then (echo '~>':arg2;cat arg1;echo '~>') else echo cant\'t open: arg1 fi stty echo ~%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. For both ~%take and put commands, as each block of the file is transferred, consecutive single digits are printed to the terminal. The shell command line below is sent to the remote machine to cause it to accept the data. Obviously, the shell on the remote machine must be /bin/sh or a shell that correctly interpret these commands. stty -echo;(cat - > arg2)||cat - >/dev/null;stty echo ~~ line send the line ~ line to the remote system. ~%break transmit 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). ~%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. The receive process normally copies data from the remote system to its standard output. The program accomplishes the ~%take command by initiating an output diversion to a file when a line from the remote begins with ~. Data from the remote is diverted (or appended, if >> is used) to file on the local system. The trailing ~> marks the end of 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 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. 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 To dial a system whose telephone number is 9 201 555 1212 using 1200 baud (where dialtone is expected after the 9): cu -s1200 9=12015551212 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 -s1200 -l ttyXX To dial a system using a specific line associated with an auto dialer: cu -l culXX 9=12015551212 To use a system name: cu systemname FILES /etc/uucp/Systems /etc/uucp/Devices /var/spool/locks/LCK..(tty-device) /dev/tty* SEE ALSO cat(1), duart(7), echo(1), stty(1), uucp(1C), uugetty(1M), uname(1). DIAGNOSTICS Exit code is zero for normal exit, otherwise, one. WARNINGS 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. cu between an IMBR1 and a penril modem will not return a login prompt immediately upon connection. A carriage return will return the prompt. The device names, dialers, and so forth in /etc/uucp/Devices must be correct. Because cu is suid-uucp, the device used, such as /dev/ttym3, must be readable and writable by the "user" uucp. BUGS There is an artificial slowing of transmission by cu during the ~%put operation so that loss of data is unlikely. Page 6