Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

crash(1M)

csh(1)

sh(1)

stty(1)

terminfo(4)

term(5)



editread(5)                      DG/UX R4.11                     editread(5)


NAME
       editread - command line editor

DESCRIPTION
       Editread is an optional interface that you can use interactively in
       sh(1), csh(1), and crash(1M) for editing command lines.  Editread
       also offers a history facility that saves command lines for later
       recall, editing, and execution.  The editread history facility is
       separate from the C shell history facility; their functions are
       similar but their implementations and use are different.

       Editread is disabled by default.  To enable the facility, you need a
       file named .editreadrc in your home directory or current directory.
       You can create an empty file named .editreadrc, which causes the
       default editread values to be recognized.  Alternatively, you can
       copy /usr/lib/editreadrc.proto to $HOME/.editreadrc.  After you have
       a .editreadrc file, it will be in effect for all child processes of a
       parent process (but not for the parent itself).  Editread will be
       active the next time you log in.

       To find out the current values for the editread functions, use your
       reconfig key (<Ctrl-R> by default).  The following screen shows the
       default values.

      +----------------------------------------------------------------------+
      |E D I T R E A D   C O N F I G U R A T I O N   D I S P L A Y           |
      |                                                                      |
      |CURSOR CONTROL          LINE EDITING            HISTORY               |
      |                                                                      |
      |backward    = ^b        insert       = ^n       hist_display   = 23   |
      |forward     = ^f        insert_space = OFF      hist_save      = 100  |
      |goto_end    = ^e        erase        = DEL      hist_recall    = ESC  |
      |goto_end_ov =           word_erase   = ^t       hist_scan      = ^p   |
      |home        = ^a        kill         = ^u       hist_up        = UP   |
      |left        = LEFT      delete_end   = ^k       hist_down      = DOWN |
      |right       = RIGHT                                                   |
      |                                                                      |
      |PROCESS CONTROL         CONFIGURING EDITREAD    MISCELLANEOUS         |
      |                                                                      |
      |eof         = ^d        enable       = ON       prompt         = OFF  |
      |intr        = ^c        reconfig     = ^r       refresh        =      |
      |quit        = ^\                                verbatim       = ^v   |
      |susp        = ^z                                term           = ansi |
      +----------------------------------------------------------------------+
       Note:  The caret (^) in this configuration display represents the
       <Ctrl> key.

   Functions and Default Values
       Each function and its default value is described in the table below:

       +--------------------------------------------------------------------+
       |  Keyword                 Description                Default Value  |
       +--------------------------------------------------------------------+
       |                      Editread Configuration                        |
       +--------------------------------------------------------------------+
       |enable        Turns editread off or on.             ON              |
       |reconfig      Displays the current editread values  <Ctrl-R>        |
       |              and concludes a redefinition of a                     |
       |              single function or multiple                           |
       |              functions.                                            |
       +--------------------------------------------------------------------+
       |                          Cursor Control                            |
       +--------------------------------------------------------------------+
       |right         Moves the cursor one position to the  Right Arrow key |
       |              right.                                                |
       |left          Moves the cursor one position to the  Left Arrow key  |
       |              left.                                                 |
       |goto_end      Moves the cursor to the end of the    <Ctrl-E>        |
       |              line.                                                 |
       |goto_end_ov   Retrieves the previous command line   unassigned      |
       |              and appends it to the current                         |
       |              command line at the cursor position.                  |
       |home          Returns the cursor to the beginning   <Ctrl-A>        |
       |              of the line.                                          |
       |forward       Moves the cursor to the beginning of  <Ctrl-F>        |
       |              the next word.                                        |
       |backward      Moves the cursor backward to the      <Ctrl-B>        |
       |              space after the previous word.                        |
       +--------------------------------------------------------------------+
       |                           Line Editing                             |
       +--------------------------------------------------------------------+
       |erase         Erases a character one position to    <Del>           |
       |              the left of the cursor.                               |
       |word_erase    Deletes from the current cursor       <Ctrl-T>        |
       |              position through the end of the                       |
       |              word.                                                 |
       |delete_end    Deletes from the cursor position to   <Ctrl-K>        |
       |              the end of the line.                                  |
       |kill          Erases the entire line.               <Ctrl-U>        |
       |insert        Enables and disables (toggles)        <Ctrl-N>        |
       |              insert mode.                                          |
       |insert_space  When insert mode is in effect, a      OFF             |
       |              leading space always appears to the                   |
       |              left of the cursor.                                   |
       +----------------------------(
-
∈-
o
π-
t
-
i
π-
u
-
e
-
d
)
-
-----------------------------+ +------------------------------------------------------------------------+ | Keyword Description Default | +------------------------------------------------------------------------+ | History | +------------------------------------------------------------------------+ |hist_recall Displays the history list. <Esc> | |hist_scan Searches the history list for <Ctrl-P> | | a given regular expression and | | shows matches. | |hist_up Recalls the previous command Up Arrow key | | in the history list. | |hist_down Recalls the next command in Down Arrow key | | the history list. | |hist_save Sets the maximum number of 100 | | commands to be saved in | | history. | |hist_display Sets the number of commands to 23 | | be displayed at one time when | | you press the reconfig key. | |write_hist Is not a function you can write_hist file<reconfig> | | configure but a command you | | can use to write history | | commands to a file. | |read_hist Is not a function you can read_hist file<reconfig> | | configure but a command you | | can use to read a file | | containing a history list to | | the current history list. | +------------------------------------------------------------------------+ | Process Control | +------------------------------------------------------------------------+ |eof Sets the end-of-file <Ctrl-D> | | character. | |intr Sets the interrupt key. <Del> | |quit Sets the quit key. <Ctrl-\\> | |susp Sets the suspend key. <Ctrl-Z> | +------------------------------------------------------------------------+ | Miscellaneous | +------------------------------------------------------------------------+ |prompt Prints an editread prompt ($) OFF | | preceded by the current | | history number. | |refresh Refreshes the current line. unassigned | |verbatim Nullifies (escapes) the <Ctrl-V> | | meaning of a key to editread. | |term Identifies your terminal type. ansi | +------------------------------------------------------------------------+ Assigning Values to Functions You can reassign values to editread functions in a .editreadrc file (in either the home or current directory), in the EDITREAD environment variable, or interactively. The following order of precedence is followed when enabling editread: -- editread value set interactively, -- EDITREAD environment variable, -- .editreadrc in the current directory, -- .editreadrc in the home directory. Pressing the reconfig key (default is <Ctrl-R>) gives a display of the current editread values, which are comprised of the defaults, those set interactively, and those set in an .editreadrc file or the EDITREAD environment variable. Any keyboard key can be assigned to any editread function with the following exceptions. Functions enable, insert_space, and prompt take a toggle value, ON or OFF; two commands, hist_save and hist_display, take numeric values; and the term function takes a string value. To disable any function, set its value to OFF. On the configuration display, a blank setting implies a disabled condition. In addition to literal keyboard keys, you can set editread functions to mnemonic names. These names represent special keys that generate unprintable characters or that vary from terminal to terminal; for example, control characters, function keys, and cursor control keys. See the Special Keys section for a list of the available names and other related information. You reassign values to functions using this format: function-keyword = value [ function-keyword = value ] You can use any amount of spacing between keywords and values for readability. Interactive assignments are terminated with the reconfig key. When using the EDITREAD environment variable, put single quotation marks ('') around the entire list of function keywords and values. You can temporarily disable editread (for the remainder of a log-in session) by interactively assigning the OFF value to the enable function. Or, you can disable editread in one shell (such as the C shell) while keeping it enabled in the Bourne shell. To disable editread permanently, you can delete your .editreadrc file(s), delete or unset the EDITREAD environment variable, or set the enable function to OFF (either interactively, in the EDITREAD environment variable, or in a .editreadrc file). By default, the line-editing and control keys defined in editread are copied from your terminal's line discipline. For example, both editread and your terminal define <Del> as the erase key and <Ctrl- U>> as the kill (delete-line) key. If you redefine a key in editread, the change will be automatically propagated to your line discipline. Similarly, if you make a change to your line discipline with the stty(1) command, editread will reconfigure the appropriate function to match the line discipline change. Special Keys Editread recognizes the special keys listed in the two tables below. Some special keys are provided for all terminals and are part of the editread default values; these are listed in the first table. The remainder of the special keys are not available on all terminals; these are listed in the second table. For keys listed in the first table, you can always set an editread function to the mnemonic name of the key. For keys listed in the second table, however, you can use mnemonic names for only those keys supported by your terminal. Editread accesses the terminfo(4) database to determine which special keys your terminal supports. For more information, consult term(5) and terminfo(4). The following mnemonic names are provided for all terminals: ^C The control form of character C (<Ctrl-C>). CR The carriage return (enter) key. DEL The delete (<Ctrl-?>) key. DOWN The cursor down (down arrow) key. ESC The escape (<Ctrl-[>) key. HOME The home key. LEFT The cursor left (left arrow) key. NL The newline (linefeed) key. RIGHT The cursor right (right arrow) key. UP The cursor up (up arrow) key. The following mnemonic names are terminal dependent: BREAK The break key. BACKSPACE The backspace key. Fn Function key n, where n is between 0 and 63. DL The delete line key. IL The insert line key. DC The delete character key. IC The insert character (enter insert mode) key. EIC The end insert mode key. CLEAR The clear screen (erase) key. EOS The clear to end of screen key. EOL The clear to end of line key. SF The scroll forward (scroll down) key. SR The scroll backward (scroll up) key. NPAGE The next page key. PPAGE The previous page key. STAB The set tab key. CTAB The clear tab key. CATAB The clear all tabs key. ENTER The enter (send) key. SRESET The soft (partial) reset key. RESET The (hard) reset key. PRINT The print (copy) key. LL The home-down key. A1 The upper left keypad key. A3 The upper right keypad key. B2 The center keypad key. C1 The lower left keypad key. C3 The lower right keypad key. BTAB The back tab key. BEG The beginning (beg) key. CANCEL The cancel key. CLOSE The close key. COMMAND The command (cmd) key. COPY The copy key. CREATE The create key. END The end key. EXIT The exit key. FIND The find key. HELP The help key. MARK The mark key. MESSAGE The message key. MOVE The move key. NEXT The next object key. OPEN The open key. OPTIONS The options key. PREVIOUS The previous object key. REDO The redo key. REFERENCE The reference (ref) key. REFRESH The refresh key. REPLACE The replace key. RESTART The restart key. RESUME The resume key. SAVE The save key. SBEG The beginning (beg) key (shifted). SCANCEL The cancel key (shifted). SCOMMAND The command (cmd) key (shifted). SCOPY The copy key (shifted). SCREATE The create key (shifted). SDC The delete character key (shifted). SDL The delete line key (shifted). SELECT The select key. SEND The end key (shifted). SEOL The clear to end of line key (shifted). SEXIT The exit key (shifted). SFIND The find key (shifted). SHELP The help key (shifted). SHOME The home key (shifted). SIC The insert character (enter insert mode) key (shifted). SLEFT The cursor left (left arrow) key (shifted). SMESSAGE The message key (shifted). SMOVE The move key (shifted). SNEXT The next object key (shifted). SOPTIONS The options key (shifted). SPREVIOUS The previous object key (shifted). SPRINT The print (copy) key (shifted). SREDO The redo key (shifted). SREPLACE The replace key (shifted). SRIGHT The cursor right (right arrow) key (shifted). SRSUME The resume key (shifted). SSAVE The save key (shifted). SSUSPEND The suspend key (shifted). SUNDO The undo key (shifted). SUSPEND The suspend key. UNDO The undo key. EXAMPLES The first and second examples show interactive assignments. The third example shows the assignment of function-value pairs to the EDITREAD environment variable in the C shell. The final example shows the contents of a .editreadrc file. $ erase = ^?<Ctrl-R> $ intr=^c hist_recall=^z prompt = OFF<Ctrl-R> % setenv EDITREAD 'prompt=ON goto_end = OFF goto_end_ov = ^a'<NL> % cat .editreadrc<NL> erase = ^? intr = ^c hist_recall = Esc prompt = ON hist_disp = 12 reconfig=f1 FILES /usr/lib/editreadrc.proto Offers a prototype of a .editreadrc file. .editreadrc Is read to enable editread at login for each shell and for other programs using editread. Multiple .editreadrc files can reside in your file system. .profile Is read to initialize the Bourne shell at login; may contain key definitions. .login Is read to initialize the C shell at login; may contain key definitions. /usr/lib/terminfo/?/* Provides information about your terminal and keyboard. SEE ALSO crash(1M), csh(1), sh(1), stty(1), terminfo(4), term(5). NOTE Editread is intended only for interactive use. Editread can run out of internal dynamic memory before reaching the number of lines of history requested by the hist_save setting. If that happens, editread will, on an on-going basis, retain as many history lines as will fit in its internal memory pool. As each new line is entered, editread will discard as many of the oldest history line(s) as it needs to in order to save the most recent line. This may cause the actual number of saved history lines to vary. If editread is enabled when an xterm is put into the background, then there is a race condition that can cause the the xterm to have undefined quit and intr stty settings. This appears most often with a csh. The work around to this problem is to either disable editread or to invoke xterm in the following manner. xterm&; sleep 1 Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026