
NAME
protocol -- run shell and copy all input and output into a file

SYNOPSIS
% protocol file

DESCRIPTION
"protocol" is a somewhat limited  method  by  which  a  "protocol
file", or file containing all input and output at a terminal, can
be generated.  The file specified is  created  mode  0644  (read-
write for owner, read-only for everyone else) or zeroed if it al-
ready exists.  Then, the shell is run.  All commands typed in  at
the  keyboard  will  be sent to the shell and all output from the
shell will be returned to the terminal.  In addition,  all  input
and  output  will be saved in "file".  To terminate protocolling,
type a CTL-D.  Note that this will terminate  everything  run  by
"protocol" -- so if you are running the editor and type CTL-D you
will terminate both the editor and the shell being run by "proto-
col" and return to your login shell.

WARNINGS
"protocol" tends to be slow  because  there  are  actually  three
processes  running -- one to copy terminal input to the shell and
to "file", the shell itself, and one  to  copy  output  from  the
shell to "file" and the terminal.

"protocol" writes to "file" in the same order as you enter  data.
Thus,  if  you are typing commands while some program is printing
results on your terminal, the protocol file will contain the com-
mands  and output mixed together, approximately as it appeared on
your screen.  The moral of this is that "protocol" should only be
used with terminals (not input files) and you should wait for the
next prompt before you enter the next command.

Finally, some programs make special checks to  determine  whether
or  not  they  are  outputting to the terminal.  For example, APL
will echo all commands typed unless it is executed with "apl  -s"
while  the  editor  "ed"  will  suppress most of its messages and
prompts.  (To run "ed" with the usual messages, use  the  command
"ed -p".) C programs which use the standard I/O library (stdio.h)
should specify as the first statement:
        setbuf(stdout, 0);
to work properly with "protocol".

Unfortunately, most of these problems are hard  to  fix,  so  the
policy must be "let the user beware".

BUGS
Don't use with the Rand Editor (re) -- you'll regret it.
