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 process
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 7
317 .B ansi
318 switch from VT102 behaviour to ANSI behaviour. The most noticeable difference is 
319 the so called `xn' glitch.
320 .TP 7
321 .B noansi
322 switch from ANSI behaviour to VT102 behaviour.
323 .TP 7
324 .B baud \fInnnn\fB
325 set the current baud\-rate to nnnn
326 .TP 7
327 .B break
328 send the break signal by asserting the TX line for longer than a frame period.
329 .TP 7
330 .B flow
331 enable RTS/CTS flow control
332 .TP 7
333 .B noflow
334 disable RTS/CTS flow control
335 .TP 7
336 .B hangup
337 de-assert DTR for one second.
338 .TP 7
339 .B width \fInn\fB
340 set the current width of the screen to \fInn\fP, and reset the terminal emulator.
341 .TP 7
342 .B height \fInn\fB
343 set the current height of the screen to \fInn\fP, and reset the terminal emulator.
344 .TP 7
345 .B reset
346 reset the terminal emulator
347 .TP 7
348 .B quit
349 exit this instance of sympathy (disconnect from the server if present)
350 .SH CHARACTER ENCODINGS
351 For characters between 32 and 126 
352 .I sympathy
353 interprets them as would a VT102 terminal by following the subset of ISO-2202 that 
354 the VT102 supports. Characters 128 thru 255 are assumed to be in UTF\-8(7), if
355 however the UTF\-8 is invalid they will instead be interpreted as characters
356 from ISO_8859-1(7). Character 155 (0x9b) when not part of a valid UTF\-8 sequence
357 will be interpreted as the one byte CSI character.
358 .PP
359 For the outer terminal emulator sympathy by default issues the 
360 ESC % G sequence to select UTF\-8 mode and emits valid UTF-8. If the outer terminal
361 does not, however, support UTF\-8 use the \-\fBu\fP switch to force 
362 .I sympathy 
363 to use the VT102 subset of ISO-2202.
364 .SH LOG FILES
365 Log files are made exclusively in the UTF\-8 encoding. Each line in the log file
366 starts with the date and time at which the entry was made \- for example:
367 .IP
368 Feb 27 23:24:42.509440
369 .PP
370 .I Sympathy
371 logs a line to the file whenever the cursor leaves the line. Additionally sympathy
372 logs certain other events to the file. When the baud\-rate is changed 
373 .I sympathy
374 writes  <baud changed to 19200>. Whenever a modem control line changes state 
375 .I sympathy
376 appends <Modem lines changed: \fI+/\-line\fP ...> to the log. Where \fI+\fP
377 indicates that \fIline\fP was asserted and \fI-\fP indicates that it was de-asserted.
378 .I Sympathy 
379 writes a message of the form <size now nnnxnnn> whenever the screen size is
380 changed, either by escape sequences, or via a user command.
381 When the terminal device reports receive errors 
382 .I sympathy 
383 adds additional information to the log. It reports the character sequence reporting the error
384 .IP
385 <tty reports error: \\377 \\000 \\000>
386 .PP
387 the observed frequencies of the different bit periods
388 .IP 
389 <tty_bit_analyse: 0000000001  [0,0,0,0,0,0,110,0,0,80]>
390 .PP
391 and the conclusions of the baud\-rate guessing algorithm
392 .IP
393 <tty_analyse:     80 errors, current rate 115200b, suggest 19200b>
394 .PP
395 Invalid UTF\-8 sequences are also reported 
396 .IP
397 <invalid utf\-8 sequence: \\301>
398 .SH ENVIRONMENT
399 .I sympathy 
400 uses the \fBHOME\fP environment variable to determine the default
401 location for sockets.
402 .br
403 .I sympathy 
404 sets the value of \fBTERM\fP in pseudo-ttys spawned using the
405 \-\fBp\fP argument to `xterm'
406 .SH EMULATION
407 .I Sympathy
408 completely emulates a VT102 terminal (including the VT52 emulation). 
409 .I Sympathy 
410 also emulates a few extra sequences: the xterm(1) ESC ] ... sequences, and 
411 the ANSI CSI @ and CSI b sequences. The numeric keypad follows exactly the
412 sequences produced by an xterm rather than the exact VT102/VT220 sequences.
413 .I Sympathy
414 also recognises the ESC % G and the ESC % @ sequences to switch between ISO-2202
415 and UTF\-8 but ignores them (see CHARACTER ENCODING below)
416 .SH SERIAL PORT THEORY
417 A serial connexion was originally envisaged to connect a DTE (Data Terminal Equipment)
418 to a DCE (Data Circuit-terminating Equipment). The DCE (some sort of modem) would assert
419 the DTE's (the computer or terminal) DSR line to indicate it was ready. The DTE would
420 assert DTR to indicate to the DCE that it should attempt a connexion to the remote DCE.
421 Once a connexion was established the DCE would assert the DTE's CD pin. Data could then 
422 flow between the DTR and the remote DTE via the two DCEs. Flow control was provided
423 via the RTS and CTS lines. The DTE asserts RTS when it is capable of receiving new data,
424 and pauses its transmission of data when the CTS line is de-asserted. The local DCE
425 asserts CTS when the remote DCE detects RTS, and vice versa.
426 .PP
427 In modern usage the signals are slightly different, for a typical connexion using modems
428 DSR indicates that the modem is ready, a drop DTR is used to indicate to the
429 modem that it should break the connexion to the remote modem.  CD indicates that
430 the local modem is connected to the remote modem, and CTS and RTS behave as before. Connexion
431 is established by in-band signalling before CD is asserted.
432 .PP
433 For a \fBnull modem\fP cable local DSR and DTR are wired to remote CD, local
434 CTS to remote RTS, and local RTS to remote CTS. Thus asserting local DTR
435 asserts local DSR and remote CD, and asserting local RTS asserts remote CTS.
436 .PP
437 When RTS/CTS flow control is in operation and the receive buffer becomes full,
438 the operating system, or the hardware, de-asserts RTS, causing (via the DCEs or
439 the null modem cable) a de-assertion of remote CTS which in turn causes the
440 remote DTE to cease transmission.
441 .SH EXAMPLES
442 .PP 
443 using sympathy to mimic screen(1):
444 .IP
445 [foo@barhost ~]$ sympathy
446 .IP
447 .I Sympathy 
448 forks. The child becomes a daemon server and launches a new shell in a
449 pseudo-tty, the original process becomes a client and connects to the server
450 and shows the output. The user then uses the new shell and after some time
451 either hangs up on the client or issues CTRL\-B quit, and the client detaches from 
452 the server.
453 .IP
454 Later the user wishes to retrieve her session and to determine which sympathy
455 sessions are active and issues:
456 .IP
457 [foo@barhost ~]$ sympathy \-ls
458 .br
459         barhost.2456        (Active)
460 .br
461 [root@barhost ~]$ 
462 .IP
463 The user then issues:
464 .IP
465 [foo@barhost ~]$ sympathy \-r 2456
466 .IP
467 and is reconnected to her session.
468 .PP
469 using sympathy to mimic minicom(1):
470 .IP
471 .IP
472 [foo@barhost ~]$ sympathy \-t \-d /dev/modem \-b 9600 \-K
473 .IP
474 .I Sympathy
475 opens the device /dev/modem and locks it, sets the baud\-rate to 9600 baud and disables
476 flow control. A VT102 terminal emulator then displays the data from the modem. The user
477 quits the emulator by issuing CTRL\-B quit, which unlocks the modem and exits sympathy.
478 .PP
479 using sympathy to mimic consolidate(1):
480 .IP
481 .IP
482 [foo@barhost ~]$ sympathy \-s \-d /dev/ttyS13 \-b 19200 \-K \-k /root/sympathy/13 \-L /root/sympathy/13.log
483 .IP
484 .I Sympathy
485 becomes a daemon and detaches from the current tty. It then opens the device
486 /dev/ttyS13 and locks it, sets the baud\-rate to 19200 baud and disables flow
487 control. 
488 .I Sympathy
489 then listens for clients connecting on the socket \fI/root/sympathy/13\fP, whilst logging 
490 completed lines and changes in status to the file \fI/root/sympathy/13.log\fP.
491 .IP
492 A user wishing to see the current status of /dev/ttyS13 issues:
493 .IP
494 [foo@barhost ~]$ sympathy \-c \-k /root/sympathy/13 
495 .IP
496 and the last 200 lines of history are injected into the history of her outer
497 terminal emulator and she is connected to /dev/ttyS13. The user disconnects from the
498 server by issuing CTRL\-B quit.
499 .SH SEE ALSO
500 screen(1) minicom(1) consolidate(1)
501 .SH STANDARDS
502 ANSI X3.64, ISO-6429, ECMA-48, ISO-2202, ISO-8859, ISO-10646, Digital Equipment Corp. VT102.
503 .SH BUGS
504 .PD
505 .IP \(bu 3
506 The command editor and parser should support better line editing.
507 .IP \(bu 3
508 It should be possible to change the escape character.
509 .IP \(bu 3
510 When the \-\fBc\fP \-\fBs\fP major mode is used without the \-\fBk\fP option the pid
511 used in the socket is that of the client process and therefore not unique.
512 .IP \(bu 3
513 The HTML generated with the \-\fBH\fP option is ugly.
514 .IP \(bu 3
515 No useful error message is generated if opening the terminal device fails in  the
516 \-\fBc\fP \-\fBs\fP major mode.
517 .IP \(bu 3
518 No facility is made for rotation of the log files.
519 .SH AUTHOR
520 James McKenzie, james@fishsoup.dhs.org