Provided by: sympathy_1.2.1+woking+cvs+git20171124-1_amd64 bug

NAME

       sympathy - client/server terminal emulator with logging

SYNOPSIS

       sympathy -t [ terminal_options ] [ display_options ]
       sympathy -s [ terminal_options ] [ server_options ]
       sympathy  [  -c  -s  ]  [  terminal_options  ]  [  server_options  ]  [ client_options ] [
       display_options ]
       sympathy -c [ client_options ] [ display_options ]
       sympathy -r id [ client_options ] [ display_options ]
       sympathy -C -d serialdev
       sympathy -ls
       sympathy -v

DESCRIPTION

       Sympathy  is  a  replacement  for  screen(1),  minicom(1)  and  consolidate(1).  It  is  a
       VT52/VT100/ANSI terminal emulator with some special features. In normal use sympathy would
       sit between a terminal device (a serial  port  or  a  pseudo-tty)  and  the  user's  usual
       terminal  emulator  (eg xterm(1)).  Sympathy renders data from the terminal device into an
       internal frame buffer and then expresses  changes  in  this  frame  buffer  to  the  outer
       terminal  emulator  using  a small subset of ANSI escape codes.  Sympathy always generates
       valid escape codes to the outer terminal,  and  will  reset  the  state  of  its  internal
       terminal emulator when it detects receive errors on the terminal device.

       Sympathy,  unlike  screen(1), takes care to preserve the scroll-back features of the outer
       terminal emulator: lines that scroll off the top of the internal frame buffer are scrolled
       off  the  top of the outer terminal emulator. When sympathy is used in client/server mode,
       some history is added to the outer terminal emulator when the client connects.

       Sympathy also supports automatic  baud-rate  detection,  and  advanced  logging  features.
       Sympathy  logs  whenever  any of the modem control lines change state, receive errors, and
       the contents of any line on the frame buffer as the cursor moves off it.

OPTIONS

       major mode options:

       -C   clear lock files sympathy will remove inactive lockfiles  for  the  specified  serial
            device, and then exit.

       -c or -r id
            act  as  client  only: sympathy connects to a sympathy server process and injects the
            history into the outer terminal emulator, and connects the  user  with  the  terminal
            device.  One server process can support multiple client processes. This mode can also
            be used to obtain a dump of the current screen in HTML format (see  the  -H  option),
            inject  key-presses  (see  -I) or allow control via a dumb terminal (see -N).  The -r
            option connects to a server process socket called id, or if id is  an  integer  host-
            name.id  mimicking  the  behaviour of screen(1).  Sympathy searches for the socket in
            the following directories:  ~/.sympathy,  ~/sympathy,  /etc/sympathy,  /var/sympathy.
            With the -c option the socket must be specified with the -k option.

       [ -c -s ]
            act  as  both  client and server: sympathy forks. The child process becomes a server,
            and the original process becomes a client which then connects to the server. This  is
            the  default  major mode if no other is specified.  Since the default terminal device
            is a pseudo-tty, running sympathy with no arguments will  start  a  new  shell  in  a
            daemonised process and connect to it as a client from the original process, mimicking
            the behaviour of screen(1)

       -l or -ls
            show active sockets: sympathy will show active sockets,  ones  to  which  a  call  to
            connect(2)  succeeds, in ~/.sympathy. If the socket name begins with the host-name of
            the machine, and the call to connect(2) fails, then socket will be unlinked.

       -s   act as server only: sympathy opens the terminal device and renders into  an  internal
            frame  buffer,  listens  for  clients on the socket and logs activity. By default the
            server will fork into a daemon process but can be forced to remain in the  foreground
            with the -F option.

       -t   act  as  terminal  emulator only: sympathy opens the terminal device and outputs into
            the outer terminal emulator. When sympathy exits the device is closed and no  process
            remains.  In  this mode sympathy behaves like a traditional terminal emulator such as
            cu(1) or minicom(1).

       -v   show current version: sympathy will print the the version number of the code  it  was
            compiled from.

       -h   show help: sympathy will show brief usage instructions

       terminal_options:

       -d serialdev
            connect  to  terminal  device  serialdev, eg /dev/ttyS0.  By default sympathy doesn't
            lock the terminal device, but checks periodically for lock files of other  processes.
            If  sympathy  detects  another  lock  file  it displays Locked in the status line and
            refuses I/O on the device until the lock file is removed or becomes invalid.  To lock
            the  device  use the -K option.  Sympathy will in addition check that the name of the
            device does not  occur  in  /proc/cmdline  as  an  argument  to  the  console  kernel
            parameter.  The -d option is incompatible with the -p option.

       -p   connect  to  a pseudo-tty instead of a terminal device, and fork a login shell in it.
            The -p option is incompatible with the -d option. This is the default terminal device
            if  none is specified. The first non-option command line arugment is considered to be
            the a binary to run in the pseudo-tty, subsequent arguments are parsed to the binary.
            The  current  value of PATH is searched for the binary if it does not start with '/'.
            If no binary is specified then '/bin/sh' is called with argv[0] set to '-'.

       -K   lock the terminal device specified in the -d option.  Sympathy generates  lock  files
            in  a  staggering  variety  of formats and places. For locks based on the name of the
            device sympathy generates lock files for all devices with the same major and minor in
            /dev,  /dev/usb  and  /dev/tts,  it  uses  both  normal  and  lower case and replaces
            occurrences of `/' in the device name with both `.' and `_'.  Sympathy also generates
            locks  based  on  the  device  major  and  minor numbers, and for all lock file names
            generates them in any of the following directories that are writable: /var/lock/uucp,
            /var/spool/lock,   /var/spool/uucp,  /etc/locks,  /usr/spool/uucp,  /var/spool/locks,
            /usr/spool/lock, /usr/spool/locks, /usr/spool/uucp/LCK, /var/lock.   Lock  files  are
            assumed to be in HDB format.

       -b baud-rate
            set the baud-rate of the terminal device specified in the -d to baud-rate, if omitted
            the current baud-rate of the serial port will be used.

       -f   turn on flow control on the terminal device. This option adds CRTSCTS  to  sympathy's
            default c_cflags of CS8|CREAD|CLOCAL.

       -L logfile
            log  activity  to  the  file logfile. If logfile is `-' then log to stdout. Note that
            logging to stdout only makes sense with the -F  server_option.   Sympathy  will  also
            close and reopen its log file when it receives a SIGHUP, which with the -P allows the
            use of logrotate(8).

       -P pidfile
            write the pid of the server/terminal process to pidfile, which is  removed  on  clean
            exit.

       -R   rotate log files. When the log-file specified with the -L option grows large sympathy
            will rotate it and compress old log-files.

       -w width[xheight]
            set the initial size of the terminal emulator's frame buffer to be width  columns  by
            height  rows.  If height is omitted it defaults to 24, the default width is 80. These
            values may be overridden later by terminal escape sequences. If -p is also  specified
            the pseudo-tty will have its window size set to match.

       display_options:

       -u   attempt  to  render  Unicode  characters  in  the  internal frame buffer to the outer
            terminal emulator by using ISO-2202 sequences.  Sympathy currently only checks to see
            if  an  appropriate  character appears in the VT102 US character set, or in the VT102
            `special characters and line drawing' character set.  If  the  character  appears  in
            neither of these then it will be rendered on the outer terminal emulator as a `?'.

       -H   render the current state of the internal frame buffer to stdout as HTML, then quit.

       -N   don't  render  the  internal  frame  buffer  using ANSI characters, but instead write
            characters that would be written to the screen to stdout. Take characters from  stdin
            and  send them to the device. This feature is useful when you wish to use sympathy in
            conjunction with programs like expect(1).

       -B   Write the actual bytes read from the device to the logfile, rather than the  rendered
            version.

       client_options:

       -k socket
            set  the name in the file-system of the socket to which sympathy should connect. This
            option is mandatory unless the -s or -r options have also been given. If -s is  given
            then  it  will  default  to the socket which the forked server process opens. See the
            discussion of the -r option above, for information on how sympathy chooses  a  socket
            name if -r is specified.

       -I string
            Inject  string to the device as if it had been typed at the keyboard.  Each character
            in the string is treated as a key-press.  Sympathy recognizes various common  escapes
            for  control  characters.  Other  keys,  for  example  the  arrow keys, are mapped to
            character codes between 128 and 255, see src/keys.h for details.

       server_options:

       -F   tells the sympathy server process not to become  a  daemon  but  to  remain  the  the
            foreground. This option is incompatible with the -c -s major mode.

       -k socket
            set  the  name  in  the file-system of the socket on which sympathy should listen for
            clients. If this option is omitted sympathy will  create  a  socket  in  ~/.sympathy,
            creating  that  directory  if  necessary,  and  named  host-name.pid where pid is the
            process id of the sympathy process that created the socket.

       -n nlines
            sets the number of lines of history that the server process stores to nlines. When  a
            client  connects  nlines  of history are injected into the outer terminal emulator so
            that they can be seen when scrolling back. By default the server stores 200 lines  of
            history.

       -S   tells the sympathy server process to log errors to syslog.

OPERATION

       When  sympathy is relaying data to the outer terminal emulator a reverse video status line
       will be visible at the bottom of the screen. The status line shows pertinent  information.
       The  first  item  on the line reminds you what the current escape character is, the second
       indicates the terminal device to which sympathy is connected,  and  the  third  shows  the
       current baud-rate. Other messages are:

       Flow indicates that that RTS/CTS flow control is in operation on the terminal device.

       RTS  indicates that the terminal device is asserting the RTS line which indicates that the
            local system is ready to accept data from the remote system. If RTS/CTS flow  control
            is  in  operation then the operating system or hardware may de-assert RTS even if RTS
            is shown. See the section on SERIAL PORT THEORY for more information.

       CTS  indicates that the terminal device has detected that the local system's CTS  line  is
            being  asserted,  indicating that the remote system is ready to receive data from the
            local system. See the section on SERIAL PORT THEORY for more information.

       DTR  indicates that the terminal device is asserting the  DTR  line  indicating  that  the
            local  system  would  like the local DCE to establish a connection to the remote DCE.
            See the section on SERIAL PORT THEORY for more information.

       DSR  indicates that the terminal device has detected that the local system's DSR  line  is
            being  asserted,  indicating  that  the local DCE is ready. See the section on SERIAL
            PORT THEORY for more information.

       CD   indicates that the terminal device has detected that the local system's  CD  line  is
            being  asserted,  indicating  that  the local DCE has a connection to the remote DCE.
            See the section on SERIAL PORT THEORY for more information.

       RI   indicates that the terminal device has detected that the local system's  RI  line  is
            being  asserted,  indicating  that  the DCE has detected a ringing signal or incoming
            connexion.

       n clients
            shows the number of connected client processes. In  the  -t  major  mode,  this  will
            always be zero.

       Locked
            the  terminal  device was opened without the -K flag and another process is currently
            using it. I/O to the device is currently suspended until the process dies or  removes
            its lock file.

       n errs
            indicates  the  number  of  frames  received  by  the  terminal  device  with  errors
            (indicating the wrong parity, baud-rate or framing). The count resets  if  no  errors
            are detected by the device for 10 seconds.

       try higher
            Sympathy  thinks that you have set the wrong baud-rate and is unable to determine the
            correct one as the current baud-rate is lower than the  correct  baud-rate.  Use  the
            baud command to set a higher baud-rate (eg 115200) and sympathy will try again.

       try rateb
            Sympathy  thinks  that  you  have set the wrong baud-rate and thinks that the correct
            baud-rate is rate. Use the baud command to change the current baud-rate.

COMMANDS

       Commands are entered by sending  the  escape  character,  ascii(7)  STX,  from  the  outer
       terminal  emulator  (usually  by pressing CTRL-B), typing the command and pressing return.
       Whilst the command is entered the status line changes to `:' and rudimentary line  editing
       is  available.   Whilst  the command is entered the cursor does not move but remains where
       the terminal emulator has placed it. Pressing the escape character whilst in command  mode
       will  send  the  escape  character to the terminal and cancel command mode. Valid commands
       are:

       ansi   switch from VT102 behaviour to ANSI behaviour. The most  noticeable  difference  is
              the so-called `xn' glitch.

       noansi switch from ANSI behaviour to VT102 behaviour.

       baud nnnn
              set the current baud-rate to nnnn

       break  send the break signal by asserting the TX line for longer than a frame period.

       flow   enable RTS/CTS flow control

       noflow disable RTS/CTS flow control

       hangup de-assert DTR for one second.

       width nn
              set the current width of the screen to nn, and reset the terminal emulator.

       height nn
              set the current height of the screen to nn, and reset the terminal emulator.

       reset  reset the terminal emulator

       expand expand  the  size  of  the  screen  to  fit  the size of the current outer terminal
              emulator window

       quit   exit this instance of sympathy (disconnect from the server if present)

CHARACTER ENCODINGS

       For characters between 32 and 126 sympathy interprets them as would a  VT102  terminal  by
       following  the  subset  of  ISO-2202  that the VT102 supports. Characters 128 thru 255 are
       assumed to be in  UTF-8(7),  if  however  the  UTF-8  is  invalid  they  will  instead  be
       interpreted  as  characters  from  ISO_8859-1(7).  Character 155 (0x9b) when not part of a
       valid UTF-8 sequence will be interpreted as the one byte CSI character.

       For the outer terminal emulator sympathy by default issues the ESC % G sequence to  select
       UTF-8  mode  and emits valid UTF-8. If the outer terminal does not, however, support UTF-8
       use the -u switch to force sympathy to use the VT102 subset of ISO-2202.

LOG FILES

       Log files are made exclusively in the UTF-8 encoding. Each line in  the  log  file  starts
       with the date and time at which the entry was made - for example:

              Feb 27 23:24:42.509440

       Sympathy  logs  a  line  to  the  file  whenever  the cursor leaves the line. Additionally
       sympathy

       •  logs certain other events to the file:

       •  serial port parameter changes: baud-rate and flow control.

       •  serial port control line state changes.

       •  serial port line discipline errors.

       •  serial port errors.

       •  suggested baud rates and bit frequency analyses.

       •  transmission of breaks.

       •  sending of the hangup signal (dropping the DTR line).

       •  unknown or un-handled messages sent on the socket.

       •  connexion and disconnexion of clients.

       •  reception of SIGHUP.

       •  invalid UTF-8 sequences.

       •  terminal size changes

       •  un-handled terminal command sequences

       The log file is rotated when it gets too large if the -R option is specified, and the  log
       file is re-opened on receipt of a SIGHUP which together with the -P allows the use of of a
       program such as logrotate(8)

AUTOMATIC BAUD RATE ALGORITHM

       If sympathy detects a framing error on the serial port it displays the count of errors  on
       the status line, and logs the error.

              <tty reports error: \377 \000 \000>

       The  count  is  reset  to  zero after ten seconds have elapsed during which no errors have
       occurred.  Sympathy looks at bit patterns of the characters  received,  and  measures  the
       length (in units of the receiving UART's bit period) of any runs of '1's delimited by '0's
       and vice-versa. It then calculates the statistics on the length of these  runs,  and  logs
       these.

              <tty_bit_analyse: 0000000001  [0,0,0,0,0,0,110,0,0,80]>

       For  a  typical  stream  of ASCII data, the most common run length will be the correct bit
       period.  Sympathy uses this together with the current bit period  to  calculate  the  most
       probable  correct  baud-rate,  which  is displayed in the status line, and logged.  If the
       correct baudirate is higher than the current baud-rate then the most common bit  frequency
       will  be  '0' or '1' and the correct baud-rate cannot be determined. In this case sympathy
       will display and log the message 'try higher'.

              <tty_analyse:     80 errors, current rate 115200b, suggest 19200b>

       The algorithm only works well if the  data  stream  is  normal.  If  the  data  stream  is
       generated by the reception, at the wrong baud-rate, of characters emitted by sympathy then
       the algorithm will be biased towards suggesting that the baud-rate is too  low.  Noise  on
       the line will also result in sympathy concluding that the baud-rate is too low.

SIGNALS

       Sympathy reacts to a set of signals. You can use the -P option to easily determine the PID
       of the sympathy process to which you would like to send a signal.

       SIGINT  Sympathy will immediately try to  restore  the  outer  terminal  emulator  to  its
               original state and then exit.

       SIGHUP  Sympathy  will  close  and reopen the log-file specified with the -L option, which
               allows the use of programs like logrotate(8)

       SIGWINCH
               Sympathy will redraw the display in the outer terminal emulator so  that  it  will
               fit within the new display size.

       SIGCHLD Sympathy  will  wait  for children if some were born (for example from compressing
               rotated logs)

ENVIRONMENT

       sympathy uses the HOME environment variable to determine the default location for sockets.
       sympathy sets the value of TERM in pseudo-ttys spawned using the -p argument to `xterm'.
       Sympathy will use CSI ] 0 ; to set the window title to the name of the socket or device if
       TERM starts with xterm or rxvt.
       The PATH enviroment variable is searched for the binary to be run in the pseudo-tty.

EMULATION

       Sympathy  completely  emulates  a VT102 terminal (including the VT52 emulation).  Sympathy
       also emulates a few extra sequences: the xterm(1) ESC ] ... sequences, and the ANSI CSI  @
       and CSI b sequences. The numeric keypad follows exactly the sequences produced by an xterm
       rather than the exact VT102/VT220 sequences.  Sympathy also recognises the ESC % G and the
       ESC  %  @  sequences  to switch between ISO-2202 and UTF-8 but ignores them (see CHARACTER
       ENCODING below)

SERIAL PORT THEORY

       A serial connexion was originally envisaged to connect a DTE (Data Terminal Equipment)  to
       a  DCE (Data Circuit-terminating Equipment). The DCE (some sort of modem) would assert the
       DTE's (the computer or terminal) DSR line to indicate it was ready. The DTE  would  assert
       DTR  to  indicate to the DCE that it should attempt a connexion to the remote DCE.  Once a
       connexion was established the DCE would assert the DTE's CD  pin.  Data  could  then  flow
       between the DTR and the remote DTE via the two DCEs. Flow control was provided via the RTS
       and CTS lines. The DTE asserts RTS when it is capable of receiving new  data,  and  pauses
       its  transmission of data when the CTS line is de-asserted. The local DCE asserts CTS when
       the remote DCE detects RTS, and vice versa.

       In modern usage the signals are slightly different, for a typical connexion  using  modems
       DSR indicates that the modem is ready, a drop DTR is used to indicate to the modem that it
       should break the connexion to the remote modem.  CD indicates  that  the  local  modem  is
       connected  to the remote modem, and CTS and RTS behave as before. Connexion is established
       by in-band signalling before CD is asserted.

       For a null modem cable local DSR and DTR are wired to remote CD, local CTS to remote  RTS,
       and local RTS to remote CTS. Thus asserting local DTR asserts local DSR and remote CD, and
       asserting local RTS asserts remote CTS.

       When RTS/CTS flow control is in  operation  and  the  receive  buffer  becomes  full,  the
       operating system, or the hardware, de-asserts RTS, causing (via the DCEs or the null modem
       cable) a de-assertion of remote  CTS  which  in  turn  causes  the  remote  DTE  to  cease
       transmission.

EXAMPLES

       using sympathy to mimic screen(1):

              [foo@barhost ~]$ sympathy

              Sympathy  forks.  The  child  becomes a daemon server and launches a new shell in a
              pseudo-tty, the original process becomes a client and connects to  the  server  and
              shows the output. The user then uses the new shell and after some time either hangs
              up on the client or issues CTRL-B quit, and the client detaches from the server.

              Later the user wishes to retrieve her  session  and  to  determine  which  sympathy
              sessions are active and issues:

              [foo@barhost ~]$ sympathy -ls
                      /home/foo/.sympathy/barhost.8843       (Active)
              [foo@barhost ~]$

              The user then issues:

              [foo@barhost ~]$ sympathy -r 8843

              and is reconnected to her session.

       using sympathy to mimic minicom(1):

              [foo@barhost ~]$ sympathy -t -d /dev/modem -b 9600 -K

              Sympathy  opens the device /dev/modem and locks it, sets the baud-rate to 9600 baud
              and disables flow control. A VT102 terminal emulator then displays  the  data  from
              the  modem.  The  user quits the emulator by issuing CTRL-B quit, which unlocks the
              modem and exits sympathy.

       using sympathy to mimic consolidate(1):

              [foo@barhost ~]$ sympathy -s -d /dev/ttyS13 -b  19200  -K  -k  /var/sympathy/13  -L
              /var/sympathy/13.log -R

              Sympathy  becomes  a  daemon  and  detaches from the current tty. It then opens the
              device /dev/ttyS13 and locks it, sets the baud-rate to 19200 baud and disables flow
              control.    Sympathy   then   listens   for   clients   connecting  on  the  socket
              /var/sympathy/13, whilst logging completed lines and changes in status to the  file
              /var/sympathy/13.log, rotating the log file when it gets too large.

              A user wishing to see the current status of /dev/ttyS13 issues:

              [foo@barhost ~]$ sympathy -c -k /var/sympathy/13
              or
              [foo@barhost ~]$ sympathy -r 13

              and  the  last  200  lines  of  history  are injected into the history of her outer
              terminal emulator and she is connected to /dev/ttyS13. The  user  disconnects  from
              the server by issuing CTRL-B quit.

       using sympathy to mimic script(1):

              [foo@barhost ~]$ sympathy -t -L typescript

              Sympathy  starts a shell in a ptty and logs completed lines to the file typescript.
              When the shell exits sympathy will terminate, or the user can  press  CTRL-B  which
              will close the ptty and send a hangup to its controlling process.

SEE ALSO

       screen(1) minicom(1) consolidate(1)

STANDARDS

       ANSI  X3.64,  ISO-6429,  ECMA-48,  ISO-2202,  ISO-8859, ISO-10646, Digital Equipment Corp.
       VT102.

BUGS

       •  The command editor and parser should support better line editing.

       •  It should be possible to change the escape character.

       •  The HTML generated with the -H option is ugly.

       •  No useful error message is generated if opening the terminal device fails in  the -c -s
          major mode.

AUTHOR

       James McKenzie, sympathy@madingley.org