1.\" $NetBSD: tip.1,v 1.27 2006/04/03 05:56:20 wiz Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)tip.1 8.4 (Berkeley) 4/18/94 31.\" 32.Dd April 2, 2006 33.Dt TIP 1 34.Os 35.Sh NAME 36.Nm tip , 37.Nm cu 38.Nd connect to a remote system 39.Sh SYNOPSIS 40.Nm 41.Op Fl nv 42.Fl Ns Ns Ar speed 43.Ar system\-name 44.Nm 45.Op Fl v 46.Fl Ns Ns Ar speed 47.Ar phone\-number 48.\" .Nm cu 49.\" .Ar phone\-number 50.\" .Op Fl t 51.\" .Op Fl s Ar speed 52.\" .Op Fl a Ar acu 53.\" .Op Fl l Ar line 54.\" .Op Fl # 55.Sh DESCRIPTION 56.Nm 57and 58.Nm cu 59are used to connect to another system over a serial link. 60In the era before modern networks, they were typically used to 61connect to a modem in order to dial in to a remote host. 62They are now frequently used for tasks such as attaching to the 63serial console of another machine for administrative or 64debugging purposes. 65.Pp 66The options are as follows: 67.Bl -tag -width 4n 68.It Fl a Ar acu 69Set the acu. 70.It Fl e 71For 72.Nm cu , 73use even parity. 74.It Fl h 75For 76.Nm cu , 77echo characters locally (half-duplex mode). 78.It Fl l Ar line 79For 80.Nm cu , 81specify the line to use. 82Either of the forms like 83.Pa tty00 84or 85.Pa /dev/tty00 86are permitted. 87.It Fl n 88No escape (disable tilde). 89.It Fl o 90For 91.Nm cu , 92use odd parity. 93.It Fl s Ar speed 94For 95.Nm cu , 96set the speed of the connection. 97Defaults to 9600. 98.It Fl t 99For 100.Nm cu , 101connect via a hard-wired connection to a host on a dial-up line. 102.It Fl v 103Set verbose mode. 104.El 105.Pp 106For 107.Nm cu , 108if both 109.Fl e 110and 111.Fl o 112are given, then no parity is used. 113This is the default behaviour. 114.Pp 115If 116.Ar speed 117is specified it will override any baudrate specified in the system 118description being used. 119.Pp 120If neither 121.Ar speed 122nor 123.Ar system-name 124are specified, 125.Ar system-name 126will be set to the value of the 127.Ev HOST 128environment variable. 129.Pp 130If 131.Ar speed 132is specified but 133.Ar system-name 134is not, 135.Ar system-name 136will be set to a value of 137.Dq tip 138with 139.Ar speed 140appended. 141e.g.\& 142.Ic tip -1200 143will set 144.Ar system-name 145to 146.Dq tip1200 . 147.Pp 148Typed characters are normally transmitted directly to the remote 149machine (which does the echoing as well). 150A tilde (`~') appearing 151as the first character of a line is an escape signal; the following 152are recognized: 153.Bl -tag -width flag 154.It Ic \&~^D No or Ic \&~ . 155Drop the connection and exit 156(you may still be logged in on the 157remote machine). 158.It Ic \&~c Op Ar name 159Change directory to 160.Ar name 161(no argument 162implies change to your home directory). 163.It Ic \&~! 164Escape to a shell (exiting the shell will 165return you to tip). 166.It Ic \&~\*[Gt] 167Copy file from local to remote. 168.Nm 169prompts for the name of a local file to transmit. 170.It Ic \&~\*[Lt] 171Copy file from remote to local. 172.Nm 173prompts first for the name of the file to be sent, then for 174a command to be executed on the remote machine. 175.It Ic \&~p Ar from Op Ar to 176Send a file to a remote 177.Ux 178host. 179The put command causes the remote 180.Ux 181system to run the command string ``cat \*[Gt] 'to''', while 182.Nm 183sends it the ``from'' 184file. 185If the ``to'' file isn't specified the ``from'' file name is used. 186This command is actually a 187.Ux 188specific version of the ``~\*[Gt]'' command. 189.It Ic \&~t Ar from Op Ar to 190Take a file from a remote 191.Ux 192host. 193As in the put command the ``to'' file 194defaults to the ``from'' file name if it isn't specified. 195The remote host 196executes the command string ``cat 'from';echo ^A'' to send the file to 197.Nm . 198.It Ic \&~| 199Pipe the output from a remote command to a local 200.Ux 201process. 202The command string sent to the local 203.Ux 204system is processed by the shell. 205.It Ic \&~$ 206Pipe the output from a local 207.Ux 208process to the remote host. 209The command string sent to the local 210.Ux 211system is processed by the shell. 212.It Ic \&~C 213Fork a child process on the local system to perform special protocols 214such as \s-1XMODEM\s+1. 215The child program will be run with the following 216arrangement of file descriptors: 217.nf 218.in +1i 2190 \*[Lt]-\*[Gt] remote tty in 2201 \*[Lt]-\*[Gt] remote tty out 2212 \*[Lt]-\*[Gt] local tty out 222.in -1i 223.fi 224.It Ic \&~+ 225Synonym for \&~C, provided for compatibility with other versions of 226.Nm cu . 227.It Ic \&~# 228Send a 229.Dv BREAK 230to the remote system. 231For systems which don't support the 232necessary 233.Ar ioctl 234call the break is simulated by a sequence of line speed changes 235and 236.Dv DEL 237characters. 238.It Ic \&~s 239Set a variable (see the discussion below). 240.It Ic \&~^Z 241Stop 242.Nm 243(only available with job control). 244.It Ic \&~^Y 245Stop only the ``local side'' of 246.Nm 247(only available with job control); 248the ``remote side'' of 249.Nm , 250the side that displays output from the remote host, is left running. 251.It Ic \&~? 252Get a summary of the tilde escapes 253.El 254.Pp 255.Nm 256uses the file 257.Pa /etc/remote 258to find how to reach a particular 259system and to find out how it should operate while talking 260to the system; 261refer to 262.Xr remote 5 263for a full description. 264Each system has a default baud rate with which to 265establish a connection. 266If this value is not suitable, the baud rate 267to be used may be specified on the command line, e.g. 268.Ql "tip -300 mds" . 269.Pp 270When 271.Nm 272establishes a connection it sends out a 273connection message to the remote system; the default value, if any, 274is defined in 275.Pa /etc/remote 276(see 277.Xr remote 5 ) . 278.Pp 279When 280.Nm 281prompts for an argument (e.g. during setup of 282a file transfer) the line typed may be edited with the standard 283erase and kill characters. 284A null line in response to a prompt, 285or an interrupt, will abort the dialogue and return you to the 286remote machine. 287.Pp 288.Nm 289guards against multiple users connecting to a remote system 290by opening modems and terminal lines with exclusive access, 291and by honoring the locking protocol used by 292.Xr uucico 8 . 293.Pp 294During file transfers 295.Nm 296provides a running count of the number of lines transferred. 297When using the ~\*[Gt] and ~\*[Lt] commands, the ``eofread'' and ``eofwrite'' 298variables are used to recognize end-of-file when reading, and 299specify end-of-file when writing (see below). 300File transfers normally depend on tandem mode for flow control. 301If the remote 302system does not support tandem mode, ``echocheck'' may be set 303to indicate 304.Nm 305should synchronize with the remote system on the echo of each 306transmitted character. 307.Pp 308When 309.Nm 310must dial a phone number to connect to a system it will print 311various messages indicating its actions. 312.Nm 313supports the 314.Tn DEC DN Ns -11 315and 316Racal-Vadic 831 auto-call-units; 317the 318.Tn DEC DF Ns \&02 319and 320.Tn DF Ns \&03 , 321Ventel 212+, Racal-Vadic 3451, and 322Bizcomp 1031 and 1032 integral call unit/modems. 323.Ss VARIABLES 324.Nm 325maintains a set of 326.Ar variables 327which control its operation. 328Some of these variables are read-only to normal users (root is allowed 329to change anything of interest). 330Variables may be displayed 331and set through the ``s'' escape. 332The syntax for variables is patterned 333after 334.Xr vi 1 335and 336.Xr Mail 1 . 337Supplying ``all'' 338as an argument to the set command displays all variables readable by 339the user. 340Alternatively, the user may request display of a particular 341variable by attaching a `?' to the end. 342For example ``escape?'' displays 343the current escape character. 344.Pp 345Variables are numeric, string, character, or boolean values. 346Boolean 347variables are set merely by specifying their name; they may be reset 348by prepending a `!' to the name. 349Other variable types are set by 350concatenating an `=' and the value. 351The entire assignment must not 352have any blanks in it. 353A single set command may be used to interrogate 354as well as set a number of variables. 355Variables may be initialized at run time by placing set commands 356(without the ``~s'' prefix in a file 357.Pa .tiprc 358in one's home directory). 359The 360.Fl v 361option causes 362.Nm 363to display the sets as they are made. 364Certain common variables have abbreviations. 365The following is a list of common variables, 366their abbreviations, and their default values. 367.Bl -tag -width Ar 368.It Ar beautify 369(bool) Discard unprintable characters when a session is being scripted; 370abbreviated 371.Ar be . 372.It Ar baudrate 373(num) The baud rate at which the connection was established; 374abbreviated 375.Ar ba . 376.It Ar dialtimeout 377(num) When dialing a phone number, the time (in seconds) 378to wait for a connection to be established; abbreviated 379.Ar dial . 380.It Ar echocheck 381(bool) Synchronize with the remote host during file transfer by 382waiting for the echo of the last character transmitted; default is 383.Ar off . 384.It Ar eofread 385(str) The set of characters which signify an end-of-transmission 386during a ~\*[Lt] file transfer command; abbreviated 387.Ar eofr . 388.It Ar eofwrite 389(str) The string sent to indicate end-of-transmission during 390a ~\*[Gt] file transfer command; abbreviated 391.Ar eofw . 392.It Ar eol 393(str) The set of characters which indicate an end-of-line. 394.Nm 395will recognize escape characters only after an end-of-line. 396.It Ar escape 397(char) The command prefix (escape) character; abbreviated 398.Ar es ; 399default value is `~'. 400.It Ar exceptions 401(str) The set of characters which should not be discarded 402due to the beautification switch; abbreviated 403.Ar ex ; 404default value is ``\et\en\ef\eb''. 405.It Ar force 406(char) The character used to force literal data transmission; 407abbreviated 408.Ar fo ; 409default value is `^P'. 410.It Ar framesize 411(num) The amount of data (in bytes) to buffer between file system 412writes when receiving files; abbreviated 413.Ar fr . 414.It Ar host 415(str) The name of the host to which you are connected; abbreviated 416.Ar ho . 417.It Ar prompt 418(char) The character which indicates an end-of-line on the remote 419host; abbreviated 420.Ar pr ; 421default value is `\en'. 422This value is used to synchronize during 423data transfers. 424The count of lines transferred during a file transfer 425command is based on receipt of this character. 426.It Ar raise 427(bool) Upper case mapping mode; abbreviated 428.Ar ra ; 429default value is 430.Ar off . 431When this mode is enabled, all lower case letters will be mapped to 432upper case by 433.Nm 434for transmission to the remote machine. 435.It Ar raisechar 436(char) The input character used to toggle upper case mapping mode; 437abbreviated 438.Ar rc ; 439default value is `^A'. 440.It Ar record 441(str) The name of the file in which a session script is recorded; 442abbreviated 443.Ar rec ; 444default value is ``tip.record''. 445.It Ar script 446(bool) Session scripting mode; abbreviated 447.Ar sc ; 448default is 449.Ar off . 450When 451.Ar script 452is 453.Li true , 454.Nm 455will record everything transmitted by the remote machine in 456the script record file specified in 457.Ar record . 458If the 459.Ar beautify 460switch is on, only printable 461.Tn ASCII 462characters will be included in 463the script file (those characters between 040 and 0177). 464The 465variable 466.Ar exceptions 467is used to indicate characters which are an exception to the normal 468beautification rules. 469.It Ar tabexpand 470(bool) Expand tabs to spaces during file transfers; abbreviated 471.Ar tab ; 472default value is 473.Ar false . 474Each tab is expanded to 8 spaces. 475.It Ar tandem 476(bool) Use XON/XOFF flow control to throttle data from the remote host; 477abbreviated 478.Ar ta . 479The default value is 480.Ar true 481unless the 482.Ar nt 483capability has been specified in 484.Pa /etc/remote , 485in which case the default value is 486.Ar false . 487.It Ar verbose 488(bool) Verbose mode; abbreviated 489.Ar verb ; 490default is 491.Ar true . 492When verbose mode is enabled, 493.Nm 494prints messages while dialing, shows the current number 495of lines transferred during a file transfer operations, 496and more. 497.El 498.Sh ENVIRONMENT 499.Nm 500uses the following environment variables: 501.Bl -tag -width Fl 502.It Ev SHELL 503(str) The name of the shell to use for the ~! command; default 504value is ``/bin/sh'', or taken from the environment. 505.It Ev HOME 506(str) The home directory to use for the ~c command; default 507value is taken from the environment. 508.It Ev HOST 509Check for a default host if none specified. 510.El 511.Pp 512The variables 513.Ev ${REMOTE} 514and 515.Ev ${PHONES} 516are also exported. 517.Sh FILES 518.Bl -tag -width /var/spool/lock/LCK..* -compact 519.It Pa /etc/remote 520Global system descriptions. 521.It Pa /etc/phones 522Global phone number data base. 523.It ${REMOTE} 524Private system descriptions. 525.It ${PHONES} 526Private phone numbers. 527.It ~/.tiprc 528Initialization file. 529.It Pa tip.record 530Record file. 531.El 532.Sh DIAGNOSTICS 533Diagnostics are, hopefully, self explanatory. 534.Sh SEE ALSO 535.Xr phones 5 , 536.Xr remote 5 537.Sh HISTORY 538The 539.Nm 540command appeared in 541.Bx 4.2 . 542.Sh BUGS 543The full set of variables is undocumented and should, probably, be 544pared down. 545