chiark / gitweb /
*** empty log message ***
[sympathy.git] / sympathy.1
1 .TH sympathy 1  "%VERSIONSTAMP%" "%LONGVERSION%" "USER COMMANDS"
2 .\" $Id$
3 .SH NAME
4 sympathy \- client/server terminal emulator with logging
5 .SH SYNOPSIS
6 .B sympathy \-\fBt\fP
7 [
8 .B \fIterminal_options\fP
9 ] [
10 .B \fIdisplay_options\fP
11 ]
12 .br
13 .B sympathy \-\fBs\fP
14 [
15 .B \fIterminal_options\fP
16 ] [
17 .B \fIserver_options\fP
18 ]
19 .br
20 .B sympathy 
21 [
22 .B \-\fBc\fP \-\fBs\fP
23 ] [
24 .B \fIterminal_options\fP
25 ] [
26 .B \fIserver_options\fP
27 ] [
28 .B \fIclient_options\fP
29 ] [
30 .B \fIdisplay_options\fP
31 ]
32 .br
33 .B sympathy \-\fBc\fP
34 [
35 .B \fIclient_options\fP
36 ] [
37 .B \fIdisplay_options\fP
38
39 .br
40 .B sympathy \-\fBr\fP
41 id
42 [
43 .B \fIclient_options\fP
44 ] [
45 .B \fIdisplay_options\fP
46
47 .br
48 .B sympathy \-\fBv\fP
49 .br
50 .SH DESCRIPTION
51 .I Sympathy
52 is a replacement for screen(1), minicom(1) and consolidate(1). It
53 is a VT52/VT100/ANSI terminal emulator with some special features. In normal use
54 .I sympathy
55 would sit between a terminal device (a serial port or a pseudo-tty) and
56 the user's usual terminal emulator (eg xterm(1)). 
57 .I Sympathy
58 renders data from the terminal device into an internal frame buffer
59 and then expresses changes in this frame buffer to the outer terminal
60 emulator using a small subset of ANSI escape codes. 
61 .I Sympathy 
62 always generates valid escape codes to the outer terminal, and will 
63 reset the state of its internal terminal emulator when it detects
64 receive errors on the terminal device.
65 .PP
66 .I Sympathy\fP,
67 unlike screen(1), takes care to preserve the scroll-back features
68 of the outer terminal emulator: lines that scroll of the top of the internal 
69 frame buffer are scrolled off the top of the outer terminal emulator. When
70 sympathy is used in client/server mode, some history is added to the outer 
71 terminal emulator when the client connects.
72 .PP
73 .I Sympathy
74 also supports automatic baud\-rate detection, and advanced logging features.
75 .I Sympathy
76 logs whenever any of the modem control lines change state, receive errors,
77 and the contents
78 of any line on the frame buffer as the cursor moves off it.
79 .SH OPTIONS
80 .B \fImajor mode options\fP:
81 .TP 5
82 .B \-t
83 act as terminal emulator only:
84 .I sympathy
85 opens the terminal device and outputs into the outer terminal emulator, when sympathy exits the 
86 device is closed and no process remains. In this mode sympathy behaves like a traditional
87 terminal emulator such as cu(1) or minicom(1).
88 .TP 5
89 .B \-s
90 act as server only:
91 .I sympathy
92 opens the terminal device and renders into an internal frame buffer, listens for clients
93 on the socket and logs activity. By default the server will fork into a daemon processes
94 but can be forced to remain in the foreground with the \-\fBF\fP option.
95 .TP 5
96 .B \-c\fP or \fB\-r\fP \fIid\fP
97 act as client only:
98 .I sympathy
99 connects to a sympathy server process and injects the history into the outer terminal
100 emulator,
101 and connects the user with the terminal device. One server process can support multiple 
102 client processes. This mode can also be used to obtain a dump of the current screen
103 in HTML format (see the \-\fBH\fP option). The \-\fPr\fP option connects to a server
104 on the socket ~/.sympathy/\fIid\fP  or if \fIid\fP is an integer 
105 ~/.sympathy/\fIhost-name\fP.\fIid\fP mimicking the behaviour of screen(1). With the 
106 \-\fBc\fP option the socket must be specified with the \-\fBk\fP option.
107 .TP 5
108 .B \fP[\fB \-c \-s \fP]
109 act as both client and server:
110 .I sympathy
111 forks. The child process becomes a server, and the original process becomes a client
112 which then connects to the server. This is the default major mode if no other is specified. 
113 Since the default terminal device is a pseudo-tty, running 
114 .I sympathy
115 with no arguments will start a new shell in a daemonised process and connect to it
116 as a client from the original process, mimicking the behaviour of screen(1)
117 .TP 5 
118 .B \-l\fP or \fB\-ls
119 show active sockets:
120 .I sympathy 
121 will show active sockets, ones to which a call to connect(2) succeeds, 
122 in ~/.sympathy. If the socket name begins with the host-name of the machine, and
123 the call to connect(2) fails, then socket will be unlinked. 
124 .TP 5 
125 .B \-v
126 show current version:
127 .I sympathy 
128 will print the the version number of the code it was compiled from.
129 .TP 5
130 .B \-h
131 show help:
132 .I sympathy 
133 will show brief usage instructions
134 .PP
135 .B \fIterminal_options\fP:
136 .TP 5
137 .B \-d \fIserialdev\fP
138 connect to terminal device \fIserialdev\fP, eg /dev/ttyS0. 
139 By default 
140 .I sympathy
141 doesn't
142 lock the terminal device, but checks periodically for lock files of other processes. If 
143 sympathy detects another lock file it displays \fBLocked\fP in the status line 
144 and refuses I/O on the device until the lock file is removed or becomes invalid.
145 To lock the device use the \-\fBK\fP option. 
146 .I Sympathy 
147 will in addition check that the name of the device does not occur in /proc/cmdline
148 as an argument to the \fIconsole\fP kernel parameter. 
149 The \-\fBd\fP option is incompatible with the \-\fBp\fP option. 
150 .TP 5
151 .B \-p
152 connect to a pseudo-tty instead of a terminal device, and fork a login shell in
153 it. The \-\fBp\fP option is incompatible with the \-\fBd\fP option. This is the default 
154 terminal device if none is specified.
155 .TP 5
156 .B \-K
157 lock the terminal device specified in the \-\fBd\fP option. 
158 .I Sympathy
159 generates lock files in a staggering variety of formats and places. For locks
160 based on the name of the device sympathy generates lock files for all devices
161 with the same major and minor in /dev, /dev/usb and /dev/tts, it uses both normal
162 and lower case and replaces occurrences of `/' in the device name with both `.' and `_'.
163 .I Sympathy
164 also generates locks based on the device major and minor numbers, and for all lock file
165 names generates them in any of the following directories that are writable:
166 /var/lock/uucp, /var/spool/lock, /var/spool/uucp, /etc/locks, /usr/spool/uucp, 
167 /var/spool/locks, /usr/spool/lock, /usr/spool/locks, /usr/spool/uucp/LCK, /var/lock. 
168 Lock files are assumed to be in HDB format.
169 .TP 5
170 .B \-b \fIbaud-rate\fP
171 set the baud\-rate of the terminal device specified in the \-\fBd\fP to
172 \fIbaud-rate\fP, if omitted the current baud-rate of the serial port will be
173 used.
174 .TP 5
175 .B \-f
176 turn on flow control on the terminal device. This option adds \fICRTSCTS\fP to sympathy's default 
177 \fIc_cflag\fPs of \fICS8|CREAD|CLOCAL\fP.
178 .TP 5
179 .B \-L \fIlogfile\fP
180 log activity to the file \fIlogfile\fP. If \fIlogfile\fP is `-' then log to \fIstdout\fP. Note
181 that logging to \fIstdout\fP only makes sense with the \-\fBF\fP \fIserver_option\fP. 
182 .TP 5
183 .B \-w \fIwidth\fP[x\fIheight\fP]
184 set the initialise size of the terminal emulator's frame buffer to be \fIwidth\fP columns
185 by \fIheight\fP rows. If \fIheight\fP is omitted it defaults to 24, the default width
186 is 80. These values may
187 be overridden later by terminal escape sequences. If \-\fBp\fP is also specified
188 the pseudo-tty will have its window size set to match.
189 .PP
190 .B \fIdisplay_options\fP:
191 .TP 5
192 .B \-u
193 attempt to render Unicode characters in the internal frame buffer to the outer terminal 
194 emulator by using ISO-2202 sequences. 
195 .I Sympathy
196 currently only checks to see if an appropriate character appears in the VT102 
197 US character set, or in the VT102 `special characters and line drawing' character set.
198 If the character appears in neither of these then it will be rendered on the outer
199 terminal emulator as a `?'.
200 .TP 5
201 .B \-H
202 render the current state of the internal frame buffer to \fIstdout\fP as HTML, then quit.
203 .PP
204 .B \fIclient_options\fP:
205 .TP 5
206 .B \-k \fIsocket\fP
207 set the name in the file-system of the socket to which
208 .I sympathy
209 should connect. This option is \fBmandatory\fP unless the \-\fBs\fP or \-\fBr\fP options
210 have also been given. If \-\fBs\fP is given then it will default to the socket which
211 the forked server process opens. See the discussion of the \-\fPr\fP option above, for
212 information on how 
213 .I sympathy 
214 chooses a socket name if \-\fBr\fP is specified.
215 .PP
216 .B \fIserver_options\fP:
217 .TP 5
218 .B \-k \fIsocket\fP
219 set the name in the file-system of the socket on which
220 .I sympathy
221 should listen for clients. If this option is omitted 
222 .I sympathy 
223 will create a 
224 socket in ~/.sympathy, creating that directory if necessary, and named
225 \fIhost-name\fP.\fIpid\fP where \fIpid\fP is the process id of the 
226 .I sympathy
227 process that created the socket.
228 .TP 5
229 .B \-F
230 tells the 
231 .I sympathy
232 server process not to become a daemon but to remain the the foreground. This option is
233 incompatible with the \-\fBc\fP \-\fBs\fP major mode.
234 .TP 5
235 .B \-n \fInlines\fP
236 sets the number of lines of history that the server process stores to \fInlines\fP. When 
237 a client connects \fInlines\fP of history are injected into the outer terminal emulator
238 so that they can be seen when scrolling back. By default the server stores 200 lines of
239 history.
240 .SH OPERATION
241 When 
242 .I sympathy
243 is relaying data to the outer terminal emulator a reverse video status line 
244 will be visible at the bottom of the screen. The status line shows pertinent
245 information. The first item on the line reminds you what the current escape character
246 is, the second indicates the terminal device to which 
247 .I sympathy
248 is connected, and the third shows the current baud-rate. Other messages are:
249 .TP 5
250 .B Flow
251 indicates that that RTS/CTS flow control is in operation on the terminal device.
252 .TP 5
253 .B RTS
254 indicates that the terminal device is asserting the RTS line which indicates that 
255 the local system is ready to accept data from the remote system. If RTS/CTS
256 flow control is in operation then the operating system or hardware may
257 de-assert RTS even if RTS is shown. See the section on SERIAL PORT THEORY for
258 more information.
259 .TP 5
260 .B CTS
261 indicates that the terminal device has detected that the local system's CTS
262 line is being asserted, indicating that the remote system is ready to receive
263 data from the local system. See the section on SERIAL PORT THEORY for
264 more information.
265 .TP 5
266 .B DTR
267 indicates that the terminal device is asserting the DTR line indicating that the local
268 system would like the local DCE to establish a connection to the remote
269 DCE.  See the section on SERIAL PORT THEORY for more information.
270 .TP 5
271 .B DSR
272 indicates that the terminal device has detected that the local system's DSR line is
273 being asserted, indicating that the local DCE is ready. See the section on
274 SERIAL PORT THEORY for more information.
275 .TP 5
276 .B CD
277 indicates that the terminal device has detected that the local system's CD line is
278 being asserted, indicating that the local DCE has a connection to the remote DCE.
279 See the section on SERIAL PORT THEORY for more information.
280 .TP 5
281 .B RI
282 indicates that the terminal device has detected that the local system's RI line is
283 being asserted, indicating that the DCE has detected a ringing signal or incoming 
284 connexion.
285 .TP 5
286 .B n clients
287 shows the number of connected client processes. In the \-\fBt\fP major mode, this will 
288 always be zero.
289 .TP 5
290 .B Locked
291 the terminal device was opened without the \-\fbK\fP flag and another process is
292 currently using it. I/O to the device is currently suspended until the process dies
293 or removes its lock file.
294 .TP 5
295 .B n errs
296 indicates the number of frames received by the terminal device with errors (indicating 
297 the wrong parity, baud\-rate or framing). The count resets if no errors are
298 detected by the device for 10 seconds.
299 .TP 5
300 .B try higher
301 .I Sympathy
302 thinks that you have set the wrong baud\-rate and is unable to determine the correct
303 one as the current baud\-rate is lower than the correct baud\-rate. Use the \fBbaud\fP command
304 to set a higher baud\-rate (eg 115200) and sympathy will try again.
305 .TP 5
306 .B try \fIrate\fBb 
307 .I Sympathy
308 thinks that you have set the wrong baud\-rate and thinks that the correct baud\-rate is
309 \fIrate\fP. Use the \fBbaud\fP command to change the current baud\-rate.
310 .SH COMMANDS
311 Commands are entered by sending the escape character, ascii(7) STX, from the outer terminal 
312 emulator (usually by pressing CTRL\-B), typing the command and pressing return. Whilst the
313 command is entered the status line changes to `:' and rudimentary line editing is available.
314 Whilst the command is entered the cursor \fBdoes not move\fP but remains where the terminal
315 emulator has placed it. Valid commands are:
316 .TP 5
317 .B ansi
318 switch from VT102 behaviour to ANSI behaviour. The most noticeable difference is 
319 the so called `xn' glitch.
320 .TP 5
321 .B noansi
322 switch from ANSI behaviour to VT102 behaviour.
323 .TP 5
324 .B baud \fInnnn\fB
325 set the current baud\-rate to nnnn
326 .TP 5
327 .B break \fInnnn\fB
328 send the break signal by asserting the TX line for longer than a frame period.
329 .TP 5
330 .B flow
331 enable RTS/CTS flow control
332 .TP 5
333 .B noflow
334 disable RTS/CTS flow control
335 .TP 5
336 .B hangup
337 de-assert DTR for one second.
338 .TP 5
339 .B quit
340 exit this instance of sympathy (disconnect from the server if present)
341 .SH CHARACTER ENCODINGS
342 For characters between 32 and 126 
343 .I sympathy
344 interprets them as would a VT102 terminal by following the subset of ISO-2202 that 
345 the VT102 supports. Characters 128 thru 255 are assumed to be in UTF\-8(7), if
346 however the UTF\-8 is invalid they will instead be interpreted as characters
347 from ISO_8859-1(7). Character 155 (0x9b) when not part of a valid UTF\-8 sequence
348 will be interpreted as the one byte CSI character.
349 .PP
350 For the outer terminal emulator sympathy by default issues the 
351 ESC % G sequence to select UTF\-8 mode and emits valid UTF-8. If the outer terminal
352 does not, however, support UTF\-8 use the \-\fBu\fI switch to force 
353 .I sympathy 
354 to use the VT102 subset of ISO-2202.
355 .SH LOG FILES
356 Log files are made exclusively in the UTF\-8 encoding. Each line in the log file
357 starts with the date and time at which the entry was made \- for example:
358 .br
359 Feb 27 23:24:42.509440
360 .br
361 .I Sympathy
362 logs a line to the file whenever the cursor leaves the line. Additionally sympathy
363 logs certain other events to the file when the baud\-rate is changed 
364 .I sympathy
365 writes  <baud changed to 19200>. Whenever a modem control line changes state 
366 .I sympathy
367 appends <Modem lines changed: \fI+/-line\fP> to the log. Where \fI+\fP
368 indicates that \fIline\fP was asserted and \fI-\fP indicates that it was de-asserted.
369 When the terminal device reports receive errors 
370 .I sympathy 
371 adds additional information to the log. It reports the character sequence reporting the error
372 .IP
373 <tty reports error: \\377 \\000 \\000>
374 .PP
375 the observed frequencies of the different bit periods
376 .IP 
377 <tty_bit_analyse: 0000000001  [0,0,0,0,0,0,110,0,0,80]>
378 .PP
379 and the conclusions of the baud\-rate guessing algorithm
380 .IP
381 <tty_analyse:     80 errors, current rate 115200b, suggest 19200b>
382 .PP
383 Invalid UTF\-8 sequences are also reported 
384 .IP
385 <invalid utf\-8 sequence: \\301>
386 .SH ENVIRONMENT
387 .I sympathy uses the \fBHOME\fI environment variable to determine the default
388 location for sockets.  .br
389 .I sympathy sets the value of \fBTERM\fI in pseudo-ttys spawned using the
390 \-\fBp\fP argument to `xterm'
391 .SH EMULATION
392 .I Sympathy
393 completely emulates a VT102 terminal (including the VT52 emulation). 
394 .I Sympathy 
395 also emulates a few extra sequences: the xterm(1) CSI ] ... sequences, and 
396 the ANSI CSI @ and CSI b sequences. The numeric keypad follows exactly the
397 sequences produced by an xterm rather than the exact VT102/VT220 sequences.
398 .I Sympathy
399 also recognises the ESC % G and the ESC % @ sequences to switch between ISO-2202
400 and UTF\-8 but ignores them (see CHARACTER ENCODING below)
401 .SH SERIAL PORT THEORY
402 A serial connexion was originally envisaged to connect a DTE (Data Terminal Equipment)
403 to a DCE (Data Circuit-terminating Equipment). The DCE (some sort of modem) would assert
404 the DTE's (the computer or terminal) DSR line to indicate it was ready. The DTE would
405 assert DTR to indicate to the DCE that it should attempt a connexion to the remote DCE.
406 Once a connexion was established the DCE would assert the DTE's CD pin. Data could then 
407 flow between the DTR and the remote DTE via the two DCEs. Flow control was provided
408 via the RTS and CTS lines. The DTE asserts RTS when it is capable of receiving new data,
409 and pauses its transmission of data when the CTS line is de-asserted. The local DCE
410 asserts CTS when the remote DCE detects RTS, and vice versa.
411 .PP
412 In modern usage the signals are slightly different, for a typical connexion using modems
413 DSR indicates that the modem is ready, a drop DTR is used to indicate to the
414 modem that it should break the connexion to the remote modem.  CD indicates that
415 the local modem is connected to the remote modem, and CTS and RTS behave as before. Connexion
416 is established by in-band signalling before CD is asserted.
417 .PP
418 For a \fBnull modem\fP cable local DSR and DTR are wired to remote CD, local
419 CTS to remote RTS, and local RTS to remote CTS. Thus asserting local DTR
420 asserts local DSR and remote CD, and asserting local RTS asserts remote CTS.
421 .PP
422 When RTS/CTS flow control is in operation the operating system or the hardware
423 de-asserts RTS when its buffer becomes full causing (via the DCEs or the null
424 modem cable) a de-assertion of remote CTS which causes the remote to cease transmission.
425 .SH EXAMPLES
426 .PP 
427 using sympathy to mimic screen(1):
428 .IP
429 [foo@barhost ~]$ sympathy
430 .IP
431 .I Sympathy 
432 forks. The child becomes a daemon server and launches a new shell in a
433 pseudo-tty, the original process becomes a client and connects to the server
434 and shows the output. The user then uses the new shell and after some time
435 either hangs up on the client or issues CTRL\-B quit, and the client detaches from 
436 the server.
437 .IP
438 Later the user wishes to retrieve her session and to determine which sympathy
439 sessions are active issues:
440 .IP
441 [foo@barhost ~]$ sympathy \-ls
442 .br
443         barhost.2456        (Active)
444 .br
445 [root@barhost ~]$ 
446 .IP
447 The user then issues:
448 .IP
449 [foo@barhost ~]$ sympathy \-r 2456
450 .IP
451 and is reconnected to her session.
452 .PP
453 using sympathy to mimic minicom(1):
454 .IP
455 .IP
456 [foo@barhost ~]$ sympathy \-t \-d /dev/modem \-b 9600 \-K
457 .IP
458 .I Sympathy
459 opens the device /dev/modem and locks it, sets the baud\-rate to 9600 baud and disables
460 flow control. A VT102 terminal emulator then displays the data from the modem. The user
461 quits the emulator by issuing CTRL\-B quit, which unlocks the modem and exits sympathy.
462 .PP
463 using sympathy to mimic consolidate(1):
464 .IP
465 .IP
466 [foo@barhost ~]$ sympathy \-s \-d /dev/ttyS13 \-b 19200 \-K \-k /root/sympathy/13 \-L /root/sympathy/13.log
467 .IP
468 .I Sympathy
469 becomes a daemon and detaches from the current tty. It then opens the device
470 /dev/ttyS13 and locks it, sets the baud\-rate to 19200 baud and disables flow
471 control. 
472 .I Sympathy
473 then listens for clients connecting on the socket \-fI/root/sympathy/13-fP, whilst logging 
474 completed lines and changes in status to the file /root/sympathy/13.log.
475 .IP
476 A user wishing to see the current status of the /dev/ttyS13 issues:
477 .IP
478 [foo@barhost ~]$ sympathy \-c \-k /root/sympathy/13 
479 .IP
480 and the last 200 lines of history are injected into the history of her outer
481 terminal emulator and she is connected to /dev/ttyS13.
482 .SH SEE ALSO
483 screen(1) minicom(1) consolidate(1)
484 .SH STANDARDS
485 ANSI X3.64, ISO-6429, ECMA-48, ISO-2202, ISO-8859, ISO-10646, Digital Equipment Corp. VT102.
486 .SH BUGS
487 .PD
488 .IP \(bu 3
489 the command line editor and parser should support better line editing and report failed commands
490 .IP \(bu 3
491 when the \-\fBc\fP \-\fBs\fP major mode is used without the \-\fBk\fP option the pid
492 used in the socket is that of the client process and therefore not unique.
493 .IP \(bu 3
494 the HTML generated with the \-\fBH\fP option is ugly.
495 .IP \(bu 3
496 no useful error message is generated if opening the terminal device fails in  the
497 \-\fBc\fP \-\fBs\fP major mode.
498 .SH AUTHOR
499 James McKenzie, james@fishsoup.dhs.org