By default, when you log in to Multics, your ability to edit command lines is very limited. The Multics FNP provides erase (#) and kill (@) characters allow you to, respectively, erase the last character typed (#) and kill the entire line (@).
The Multics Video System provides a much richer set of editing key bindings, which, by default, are a subset of the line editing key bindings in emacs. Here is list of a few of these key bindings:
- Control-a - go to beginning of line
- Control-e - go to end of line
- Control-f - forward character
- Control-b - backward character
- Control-d - forward delete character
- DEL - backward delete character
To enable the video system, you need to first set your Multics terminal type to one that supports the video system and then invoke the video system. Since at this point, the only way to connect to a Multics FNP channel is through the "TELNET" protocol and because most "telnet" implementations support the VT102 terminal type, the easiest way to invoke the video system is to use that terminal type, as follows:
stty -ttp vt102 r 12:33 0.961 33 wdc invoke r 12:33 0.961 33
Note: the Multics video system does not support command line history/recall. One Multics developer is working on adding this capability to Multics, and when it is available, we'll announce it.
Input Line History
In 1981, Lindsey Spratt wrote the audit_ I/O module to monitor input and/or output directed through a stream I/O switch. Each complete or partial line is captured in an audit file, along with its flow direction (input or output) and time stamp, as well as other basic performance measurement data. While such data may serve many purposes, an important application is as an input line history file.
When used with the tty_ I/O module, all input lines (or partial lines) (except those submitted as Emacs input) are captured in the audit file. The file may be defined as a scrolling cache holding the N most recent input lines; or as an infinite set of line entries in a multi-segment file.
A builtin qx-style editor can search for past input lines, for review and possible re-input at a later time. A line substition feature enables changes to the past input line prior to its re-input. Or the audit data may be printed or searched using the display_audit_file (daf) command.
The audit_ facility predates the Multics video system (c. 1987), with its window_io_ module. While audit_ may be used with either tty_ or window_io_, it is important to remember that the emacs-style editing provided by window_io_ can be used only when entering a totally new input line. There is currently no facility for doing emacs-style searching of past input lines, or editing them for re-input. (Gary Dixon is investigating that new functionality.)
If you plan to use the audit_ facility with the video system, be sure to start the video system (wdc invoke) before running the attach_audit command.
Setup for Input Line History (with tty_)
After login to an interactive process, the terminal I/O switches have the following configuration.
print_attach_table error_output syn_ user_i/o -inh close get_line get_chars user_output syn_ user_i/o -inh close get_line get_chars user_input syn_ user_i/o -inh close put_chars user_i/o tty_ -login_channel -suppress_dial_manager stream_input_output r 12:33 0.961 33
To add input line history, the following line could be placed in the interactive section of your start_up.ec script to setup a scrolling, 10000-line input history file:
&version 2 &trace &command off &if [equal &2 interactive] &then &do stty -ttp VT102_132C_50L &- setup for a 50-line terminal attach_audit -pn [hd]>[user name].history &+ -modes audit_file_size=10000,^audit_output &end &quit
This results in the following configuration:
pat audit_i/o.1637.7 tty_ -login_channel -suppress_dial_manager stream_input_output error_output syn_ user_i/o -inh close get_line get_chars user_output syn_ user_i/o -inh close get_line get_chars user_input syn_ user_i/o -inh close put_chars user_i/o audit_ audit_i/o.1637.7 -pn >user_dir_dir>SysEng>GDixon>GDixon.history stream_input_output r 12:37 0.961 33
In this configuration, only input lines are captured in a USER_NAME.history.audit file in the home directory. Input line qx-style editing is enabled for all input lines. Input from the terminal passes from tty_ through the audit_ I/O module, where it can be edited; or input can be in the form of audit editor requests that select a past input line for re-input.
To stop using audit_ by removing its I/O attachments, issue a detach_audit (dta) command.
To suspend use of audit_ for a short time, set the audit_suspend mode using the io_call command:
io modes user_i/o audit_suspend io_call: more_mode=scroll,more,ll=131,pl=77,^vertsp,can,erkl,esc,^rawo,^red,^ctl_char,^edited r 09:22 0.235 0
You can later resume use of audit_ by setting the ^audit_suspend mode:
io modes user_i/o ^audit_suspend io_call: more_mode=scroll,more,ll=131,pl=77,^vertsp,can,erkl,esc,^rawo,^red,^ctl_char,^edited r 09:27 0.235 0
Note that the modes displayed by io_call after setting audit_suspend are the modes from the underlying tty_ I/O module. Instead of its own modes, audit_ returns modes from its attached tty_ switch since most mode requests on the user_i/o switch expect modes from the tty_ I/O module. Use the audit_modes control to display audit_ mode settings.
io control user_i/o audit_modes audit modes: ^audit_input,^audit_output,^audit_edit,^audit_trace,^audit_meter,\c ^audit_transparent,audit_trigger=!,audit_file_size=unlimited,^audit_use_editor_prompt,\c audit_editor_prompt_string="audit editor^[(^d)^]:^2x". r 09:20 0.144 0
Editing the Current Input Line
The following example shows typing an input line to invoke the string command. The line ends with a request to enter the audit editor (!e).
string This is my input !e audit editor:
Several audit editing requests are given to change string command arguments in the edit buffer.
audit editor: p string This is my input audit editor: s/This/That/p string That is my input audit editor: s/$/./p string That is my input . audit editor: s/t /t/p string Thatis my input. audit editor: s/at/at /p string That is my input.
Finally, the edit buffer is returned to audit_ as the input line, and executed by the command processor. The string command prints its arguments, separated by a space.
audit editor: r That is my input. r 16:47 0.103 5
See the MPM Commands description for the attach_audit command, for more details on the audit editor. Or see audit_.gi.info.
Re-input a Prior Input Line
The audit editor also permits editing of prior commands. The following example shows typing a list (ls) command, then editing (adding a starname to) the last command entered for re-input.
ls Segments = 7, Lengths = 6. r w 1 GDixon.history.audit r w 1 GDixon.probe rew 1 GDixon.profile r w 1 GDixon.value r w 0 card_input.acs rew 1 start_up.ec rew 1 start_up.emacs r 08:31 0.180 0 p!E ls audit editor: s/$/ GDixon.**/p ls GDixon.** audit editor: r Segments = 4, Lengths = 4. r w 1 GDixon.history.audit r w 1 GDixon.probe rew 1 GDixon.profile r w 1 GDixon.value r 08:31 0.238 3
To re-edit the last command edited, use the l (lowercase L) selector:
lp!E ls GDixon.** audit editor: s/GD.*$/**.ec/pr ls **.ec Segments = 1, Lengths = 1. rew 1 start_up.ec r 08:32 0.182 3
The d/STR/ editing command restricts editing requests which follow on that line to only audit file lines tagged as a particular type. Of most interest for input line history are the IL (Input Line) and EL (Edited Line) tags. For example, the following editor request displays edited lines within the past 10 total lines of the audit file.
d/EL/-10,p!E ls GDixon.** ls GDixon.** ls **.ec EOF audit editor:
To list all edited lines matching a particular regular expression, you can use the display_audit_file (daf) command, even from inside the audit editor. The following shows display of all Edited Lines (class: EL) beginning with "rdc".
audit editor: ..daf -class EL -match rdc rdc call_entry_info_.pl1 -trace off rdc call_entry_info_ -trace off rdc call_entry_info_ -trace on
You could select one of these input lines for re-editing by searching backward using a regular expression:
audit editor: :</^rdc.*off$/p rdc call_entry_info_ -trace off audit editor: s/$/ -list/p rdc call_entry_info_ -trace off -list