recon -- escape sequence reconglomerator and tty connection redirector


recon [-ahlSux] [-ttimeout | -cchar-times] [-mmin-time]
     [-i<logfile1>] [-o<logfile2>] [-T<termtype>] [-pptyname]


recon functions as an escape sequence reconglomerator. It gives the invoking user a new pseudo-tty and passes input and output between this pty and the user's original tty. It recognizes the initial characters of function key command sequences when they occur in keyboard input and holds on to them until the entire command sequence has been accumulated or a sequence has been received that is not part of any known function key command sequence. The sequence is then passed to the process that is running on the pty. This allows applications that are sensitive to the timing of function key command sequences to receive an entire sequence without any delay between the characters that constitute the sequence.

When a specific tty is named with the -p option, recon can be used to redirect a user's connection to a specific pseudo-tty, This is useful for applications that require each user to use a consistant terminal device name.

Options and arguments

Append information to the <logfile> rather than overwriting it. Used with the -i and -o options. Note that, when specifying both the -i and -o options and using the same <logfile> for both, you must use -a or the input and output will overwrite each other.

Print a usage message.

Start up command_line as though it is a login shell. If command_line specifies a shell, this causes the shell to read its configuration files such as .profile.

Use a STREAMS pseudo-tty.

Write data from the -i and -o options to the <logfile> immediately without buffering by recon. This lets another process that is monitoring the log files see the tty input and/or output immediately. Unbuffered logging is less efficient, so use this option only when necessary.

Note that, when specifying both the -i and -o options to use the same <logfile>, you must use -u if you want the input and output to appear in the <logfile> in the same order as they appeared.

Turn on debugging. This causes recon to print internal diagnostics. It is not intended for normal use but may be useful if recon does not appear to be recognizing a function key of a particular terminal.

Use the specified non-STREAMS pty name (may be abbreviated). This pty must be free when recon executes.

Set the function key command sequence timeout, in milliseconds.

Set the function key command sequence timeout to be as long as it takes to receive char-times characters, according to the Baud rate the parent tty is set for. The default is 3.

Set a lower bound for the timeout selected by the -c option, in milliseconds. The default is 100.

-i<logfile1> and -o<logfile2>
Log all input (-i) or output (-o) to the specified <logfile>. "Input" is data sent to the application(s) run by recon as though it had been typed at a keyboard. Typically it is the real keyboard input typed by the user. "Output" is data output by the application being run by recon. The -o option is functionally equivalent to the script(TC) utility.

-i and -o can both be specified to log both input and output, and <logfile1> and <logfile2> can be the same filename. If you specify both -i and -o to use the same <logfile>, you should also use the -a option or the input and output will overwrite each other. The -u option is also adviseable so that the input and output will appear in the same order as they occurred. Note, however, that it may be difficult to differentiate between the input and output from the contents of the <logfile>.

Set the terminal type. If not specified, recon uses the terminal type specified by the TERM environment variable.

Command line (including options and arguments) for the process to be started by recon on the new pty. The options and arguments should be given as they would appear at a shell prompt for that command, separated with spaces, and without the whole command_line being enclosed in quotes. For example:
   recon vi /etc/motd
If no command_line is given, the shell specified by the user's SHELL environment variable is started.


recon can be started interactively from a shell prompt, or can be started from a user's .profile file, or can be used in a shell script. When started from a user's .profile file, recon is typically not given a command_line argument, so the user gets a shell prompt just as they normally would, but on a new pseudo-tty and with escape sequences reconglomerated. When started from a shell script, recon typically is given a command_line argument that specifies an application name and arguments. This is useful when the application has problems with broken-up escape sequences or requires a fixed tty name. When used interactively, recon can be used with or without a command_line argument.

When using the -p option, use the highest-numbered pty available to maximize the likelihood that the pty will be free when recon executes. Pseudo-ttys that are allocated automatically are usually allocated in numeric order from lowest to highest.

While recon is running, the parent tty is still in use, but the tty seen by applications is the pseudo-tty selected by recon or specified to it with the -p option.

If the -l option is used and no command_line is specified, the RECON_SHELL variable is added to the shell's environment. If RECON_SHELL is already in the environment, recon aborts immediately with an exit status of 2. This allows recon to be placed in a user's .profile file as follows:

   recon -l && exit 0
The recon -l line should be placed near the top of the .profile file so that the rest of the .profile commands are not executed more than once per login session. When the user logs in, .profile is read and recon -l is run, causing a new login shell to be started. When this sub-login shell reads its .profile file, it executes recon again, but recon sees RECON_SHELL in the environment and so exits with nonzero status. The nonzero exit status prevents the shell from executing the exit 0 statement. When the user exits the login session, the running recon exits with 0 status, causing the shell to execute the exit 0 statement and so preventing the user from getting another shell prompt.

If some initial characters of a function key command sequence are received and then no further input is received within a given period, the incomplete sequence is sent. This allows keyboard sequences that are prefixes of the command sequences used by certain terminal types (for example, the <Esc> key for an ANSI terminal) to be used. The timeout period is set with the -t or the -c and -m options. It should be set high enough that function key command sequences are always received intact by the application. If no timeout options are specified, recon calculates default timeouts based on the terminal connection speed. In most cases, the defaults should be appropriate.

Differences between versions

recon is provided only on SCO OpenServer Release 5.0.6 and later releases.

The -i, -o, -a, and -u options are supported only for Release Supplement 506A for SCO OpenServer Release 5.0.6 and later.

See also

gettydefs(F), login(M), script(TC), tee(C), tty(C)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003