EX(1)                      POSIX Programmer's Manual                     EX(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       ex -- text editor

SSYYNNOOPPSSIISS
       ex [[-rR]] [[-s|-v]] [[-c _c_o_m_m_a_n_d]] [[-t _t_a_g_s_t_r_i_n_g]] [[-w _s_i_z_e]] [[_f_i_l_e...]]

DDEESSCCRRIIPPTTIIOONN
       The _e_x utility is a line-oriented text editor. There are two other
       modes of the editor--open and visual--in which screen-oriented editing
       is available. This is described more fully by the _e_x ooppeenn and vviissuuaall
       commands and in _v_i.

       If an operand is ''--'', the results are unspecified.

       This section uses the term _e_d_i_t _b_u_f_f_e_r to describe the current working
       text. No specific implementation is implied by this term. All editing
       changes are performed on the edit buffer, and no changes to it shall
       affect any file until an editor command writes the file.

       Certain terminals do not have all the capabilities necessary to support
       the complete _e_x definition, such as the full-screen editing commands
       (_v_i_s_u_a_l _m_o_d_e or _o_p_e_n _m_o_d_e).  When these commands cannot be supported on
       such terminals, this condition shall not produce an error message such
       as ``not an editor command'' or report a syntax error. The
       implementation may either accept the commands and produce results on
       the screen that are the result of an unsuccessful attempt to meet the
       requirements of this volume of POSIX.1-2017 or report an error
       describing the terminal-related deficiency.

OOPPTTIIOONNSS
       The _e_x utility shall conform to the Base Definitions volume of
       POSIX.1-2017, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s, except for the
       unspecified usage of ''--'', and that ''++'' may be recognized as an option
       delimiter as well as ''--''.

       The following options shall be supported:

       --cc _c_o_m_m_a_n_d
                 Specify an initial command to be executed in the first edit
                 buffer loaded from an existing file (see the EXTENDED
                 DESCRIPTION section).  Implementations may support more than
                 a single --cc option. In such implementations, the specified
                 commands shall be executed in the order specified on the
                 command line.

       --rr        Recover the named files (see the EXTENDED DESCRIPTION
                 section).  Recovery information for a file shall be saved
                 during an editor or system crash (for example, when the
                 editor is terminated by a signal which the editor can catch),
                 or after the use of an _e_x pprreesseerrvvee command.

                 A _c_r_a_s_h in this context is an unexpected failure of the
                 system or utility that requires restarting the failed system
                 or utility. A system crash implies that any utilities running
                 at the time also crash. In the case of an editor or system
                 crash, the number of changes to the edit buffer (since the
                 most recent pprreesseerrvvee command) that will be recovered is
                 unspecified.

                 If no _f_i_l_e operands are given and the --tt option is not
                 specified, all other options, the _E_X_I_N_I_T variable, and any
                 ..eexxrrcc files shall be ignored; a list of all recoverable files
                 available to the invoking user shall be written, and the
                 editor shall exit normally without further action.

       --RR        Set rreeaaddoonnllyy edit option.

       --ss        Prepare _e_x for batch use by taking the following actions:

                  *  Suppress writing prompts and informational (but not
                     diagnostic) messages.

                  *  Ignore the value of _T_E_R_M and any implementation default
                     terminal type and assume the terminal is a type incapable
                     of supporting open or visual modes; see the vviissuuaall
                     command and the description of _v_i.

                  *  Suppress the use of the _E_X_I_N_I_T environment variable and
                     the reading of any ..eexxrrcc file; see the EXTENDED
                     DESCRIPTION section.

                  *  Suppress autoindentation, ignoring the value of the
                     aauuttooiinnddeenntt edit option.

       --tt _t_a_g_s_t_r_i_n_g
                 Edit the file containing the specified _t_a_g_s_t_r_i_n_g; see _c_t_a_g_s.
                 The tags feature represented by --tt _t_a_g_s_t_r_i_n_g and the ttaagg
                 command is optional. It shall be provided on any system that
                 also provides a conforming implementation of _c_t_a_g_s;
                 otherwise, the use of --tt produces undefined results. On any
                 system, it shall be an error to specify more than a single --tt
                 option.

       --vv        Begin in visual mode (see _v_i).

       --ww _s_i_z_e   Set the value of the _w_i_n_d_o_w editor option to _s_i_z_e.

OOPPEERRAANNDDSS
       The following operand shall be supported:

       _f_i_l_e      A pathname of a file to be edited.

SSTTDDIINN
       The standard input consists of a series of commands and input text, as
       described in the EXTENDED DESCRIPTION section. The implementation may
       limit each line of standard input to a length of {LINE_MAX}.

       If the standard input is not a terminal device, it shall be as if the
       --ss option had been specified.

       If a read from the standard input returns an error, or if the editor
       detects an end-of-file condition from the standard input, it shall be
       equivalent to a SIGHUP asynchronous event.

IINNPPUUTT FFIILLEESS
       Input files shall be text files or files that would be text files
       except for an incomplete last line that is not longer than {LINE_MAX}-1
       bytes in length and contains no NUL characters. By default, any
       incomplete last line shall be treated as if it had a trailing
       <newline>.  The editing of other forms of files may optionally be
       allowed by _e_x implementations.

       The ..eexxrrcc files and source files shall be text files consisting of _e_x
       commands; see the EXTENDED DESCRIPTION section.

       By default, the editor shall read lines from the files to be edited
       without interpreting any of those lines as any form of editor command.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _e_x:

       _C_O_L_U_M_N_S   Override the system-selected horizontal screen size. See the
                 Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8,
                 _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s for valid values and results when it is
                 unset or null.

       _E_X_I_N_I_T    Determine a list of _e_x commands that are executed on editor
                 start-up. See the EXTENDED DESCRIPTION section for more
                 details of the initialization phase.

       _H_O_M_E      Determine a pathname of a directory that shall be searched
                 for an editor start-up file named ..eexxrrcc; see the EXTENDED
                 DESCRIPTION section.

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2017, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_O_L_L_A_T_E
                 Determine the locale for the behavior of ranges, equivalence
                 classes, and multi-character collating elements within
                 regular expressions.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments and input
                 files), the behavior of character classes within regular
                 expressions, the classification of characters as uppercase or
                 lowercase letters, the case conversion of letters, and the
                 detection of word boundaries.

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _L_I_N_E_S     Override the system-selected vertical screen size, used as
                 the number of lines in a screenful and the vertical screen
                 size in visual mode.  See the Base Definitions volume of
                 POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s for valid
                 values and results when it is unset or null.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

       _P_A_T_H      Determine the search path for the shell command specified in
                 the _e_x editor commands !!, sshheellll, rreeaadd, and wwrriittee, and the
                 open and visual mode command !!; see the description of
                 command search and execution in _S_e_c_t_i_o_n _2_._9_._1_._1, _C_o_m_m_a_n_d
                 _S_e_a_r_c_h _a_n_d _E_x_e_c_u_t_i_o_n.

       _S_H_E_L_L     Determine the preferred command line interpreter for use as
                 the default value of the sshheellll edit option.

       _T_E_R_M      Determine the name of the terminal type. If this variable is
                 unset or null, an unspecified default terminal type shall be
                 used.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       The following term is used in this and following sections to specify
       command and asynchronous event actions:

       _c_o_m_p_l_e_t_e _w_r_i_t_e
                 A complete write is a write of the entire contents of the
                 edit buffer to a file of a type other than a terminal device,
                 or the saving of the edit buffer caused by the user executing
                 the _e_x pprreesseerrvvee command. Writing the contents of the edit
                 buffer to a temporary file that will be removed when the
                 editor exits shall not be considered a complete write.

       The following actions shall be taken upon receipt of signals:

       SIGINT    If the standard input is not a terminal device, _e_x shall not
                 write the file or return to command or text input mode, and
                 shall exit with a non-zero exit status.

                 Otherwise, if executing an open or visual text input mode
                 command, _e_x in receipt of SIGINT shall behave identically to
                 its receipt of the <ESC> character.

                 Otherwise:

                  1. If executing an _e_x text input mode command, all input
                     lines that have been completely entered shall be resolved
                     into the edit buffer, and any partially entered line
                     shall be discarded.

                  2. If there is a currently executing command, it shall be
                     aborted and a message displayed. Unless otherwise
                     specified by the _e_x or _v_i command descriptions, it is
                     unspecified whether any lines modified by the executing
                     command appear modified, or as they were before being
                     modified by the executing command, in the buffer.

                     If the currently executing command was a motion command,
                     its associated command shall be discarded.

                  3. If in open or visual command mode, the terminal shall be
                     alerted.

                  4. The editor shall then return to command mode.

       SIGCONT   The screen shall be refreshed if in open or visual mode.

       SIGHUP    If the edit buffer has been modified since the last complete
                 write, _e_x shall attempt to save the edit buffer so that it
                 can be recovered later using the --rr option or the _e_x rreeccoovveerr
                 command. The editor shall not write the file or return to
                 command or text input mode, and shall terminate with a non-
                 zero exit status.

       SIGTERM   Refer to SIGHUP.

       The action taken for all other signals is unspecified.

SSTTDDOOUUTT
       The standard output shall be used only for writing prompts to the user,
       for informational messages, and for writing lines from the file.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       The output from _e_x shall be text files.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       Only the _e_x mode of the editor is described in this section. See _v_i for
       additional editing capabilities available in _e_x.

       When an error occurs, _e_x shall write a message. If the terminal
       supports a standout mode (such as inverse video), the message shall be
       written in standout mode. If the terminal does not support a standout
       mode, and the edit option eerrrroorrbbeellllss is set, an alert action shall
       precede the error message.

       By default, _e_x shall start in command mode, which shall be indicated by
       a :: prompt; see the pprroommpptt command. Text input mode can be entered by
       the aappppeenndd, iinnsseerrtt, or cchhaannggee commands; it can be exited (and command
       mode re-entered) by typing a <period> (''..'')  alone at the beginning of
       a line.

   IInniittiiaalliizzaattiioonn iinn eexx aanndd vvii
       The following symbols are used in this and following sections to
       specify locations in the edit buffer:

       _a_l_t_e_r_n_a_t_e _a_n_d _c_u_r_r_e_n_t _p_a_t_h_n_a_m_e_s
             Two pathnames, named _c_u_r_r_e_n_t and _a_l_t_e_r_n_a_t_e, are maintained by the
             editor. Any _e_x commands that take filenames as arguments shall
             set them as follows:

              1. If a _f_i_l_e argument is specified to the _e_x eeddiitt, eexx, or
                 rreeccoovveerr commands, or if an _e_x ttaagg command replaces the
                 contents of the edit buffer.

                  a. If the command replaces the contents of the edit buffer,
                     the current pathname shall be set to the _f_i_l_e argument or
                     the file indicated by the tag, and the alternate pathname
                     shall be set to the previous value of the current
                     pathname.

                  b. Otherwise, the alternate pathname shall be set to the
                     _f_i_l_e argument.

              2. If a _f_i_l_e argument is specified to the _e_x nneexxtt command:

                  a. If the command replaces the contents of the edit buffer,
                     the current pathname shall be set to the first _f_i_l_e
                     argument, and the alternate pathname shall be set to the
                     previous value of the current pathname.

              3. If a _f_i_l_e argument is specified to the _e_x ffiillee command, the
                 current pathname shall be set to the _f_i_l_e argument, and the
                 alternate pathname shall be set to the previous value of the
                 current pathname.

              4. If a _f_i_l_e argument is specified to the _e_x rreeaadd and wwrriittee
                 commands (that is, when reading or writing a file, and not to
                 the program named by the sshheellll edit option), or a _f_i_l_e
                 argument is specified to the _e_x xxiitt command:

                  a. If the current pathname has no value, the current
                     pathname shall be set to the _f_i_l_e argument.

                  b. Otherwise, the alternate pathname shall be set to the
                     _f_i_l_e argument.

             If the alternate pathname is set to the previous value of the
             current pathname when the current pathname had no previous value,
             then the alternate pathname shall have no value as a result.

       _c_u_r_r_e_n_t _l_i_n_e
             The line of the edit buffer referenced by the cursor. Each
             command description specifies the current line after the command
             has been executed, as the _c_u_r_r_e_n_t _l_i_n_e _v_a_l_u_e.  When the edit
             buffer contains no lines, the current line shall be zero; see
             _A_d_d_r_e_s_s_i_n_g _i_n _e_x.

       _c_u_r_r_e_n_t _c_o_l_u_m_n
             The current display line column occupied by the cursor. (The
             columns shall be numbered beginning at 1.) Each command
             description specifies the current column after the command has
             been executed, as the _c_u_r_r_e_n_t _c_o_l_u_m_n value. This column is an
             _i_d_e_a_l column that is remembered over the lifetime of the editor.
             The actual display line column upon which the cursor rests may be
             different from the current column; see the cursor positioning
             discussion in _C_o_m_m_a_n_d _D_e_s_c_r_i_p_t_i_o_n_s _i_n _v_i.

       _s_e_t _t_o _n_o_n_-_<_b_l_a_n_k_>
             A description for a current column value, meaning that the
             current column shall be set to the last display line column on
             which is displayed any part of the first non-<blank> of the line.
             If the line has no non-<blank> non-<newline> characters, the
             current column shall be set to the last display line column on
             which is displayed any part of the last non-<newline> character
             in the line. If the line is empty, the current column shall be
             set to column position 1.

       The length of lines in the edit buffer may be limited to {LINE_MAX}
       bytes. In open and visual mode, the length of lines in the edit buffer
       may be limited to the number of characters that will fit in the
       display. If either limit is exceeded during editing, an error message
       shall be written. If either limit is exceeded by a line read in from a
       file, an error message shall be written and the edit session may be
       terminated.

       If the editor stops running due to any reason other than a user
       command, and the edit buffer has been modified since the last complete
       write, it shall be equivalent to a SIGHUP asynchronous event. If the
       system crashes, it shall be equivalent to a SIGHUP asynchronous event.

       During initialization (before the first file is copied into the edit
       buffer or any user commands from the terminal are processed) the
       following shall occur:

        1. If the environment variable _E_X_I_N_I_T is set, the editor shall execute
           the _e_x commands contained in that variable.

        2. If the _E_X_I_N_I_T variable is not set, and all of the following are
           true:

            a. The _H_O_M_E environment variable is not null and not empty.

            b. The file ..eexxrrcc in the directory referred to by the _H_O_M_E
               environment variable:

                i.  Exists

               ii.  Is owned by the same user ID as the real user ID of the
                    process or the process has appropriate privileges

               iii. Is not writable by anyone other than the owner

           the editor shall execute the _e_x commands contained in that file.

        3. If and only if all of the following are true:

            a. The current directory is not referred to by the _H_O_M_E
               environment variable.

            b. A command in the _E_X_I_N_I_T environment variable or a command in
               the ..eexxrrcc file in the directory referred to by the _H_O_M_E
               environment variable sets the editor option eexxrrcc.

            c. The ..eexxrrcc file in the current directory:

                i.  Exists

               ii.  Is owned by the same user ID as the real user ID of the
                    process, or by one of a set of implementation-defined user
                    IDs

               iii. Is not writable by anyone other than the owner

           the editor shall attempt to execute the _e_x commands contained in
           that file.

       Lines in any ..eexxrrcc file that are blank lines shall be ignored. If any
       ..eexxrrcc file exists, but is not read for ownership or permission reasons,
       it shall be an error.

       After the _E_X_I_N_I_T variable and any ..eexxrrcc files are processed, the first
       file specified by the user shall be edited, as follows:

        1. If the user specified the --tt option, the effect shall be as if the
           _e_x ttaagg command was entered with the specified argument, with the
           exception that if tag processing does not result in a file to edit,
           the effect shall be as described in step 3. below.

        2. Otherwise, if the user specified any command line _f_i_l_e arguments,
           the effect shall be as if the _e_x eeddiitt command was entered with the
           first of those arguments as its _f_i_l_e argument.

        3. Otherwise, the effect shall be as if the _e_x eeddiitt command was
           entered with a nonexistent filename as its _f_i_l_e argument. It is
           unspecified whether this action shall set the current pathname. In
           an implementation where this action does not set the current
           pathname, any editor command using the current pathname shall fail
           until an editor command sets the current pathname.

       If the --rr option was specified, the first time a file in the initial
       argument list or a file specified by the --tt option is edited, if
       recovery information has previously been saved about it, that
       information shall be recovered and the editor shall behave as if the
       contents of the edit buffer have already been modified. If there are
       multiple instances of the file to be recovered, the one most recently
       saved shall be recovered, and an informational message that there are
       previous versions of the file that can be recovered shall be written.
       If no recovery information about a file is available, an informational
       message to this effect shall be written, and the edit shall proceed as
       usual.

       If the --cc option was specified, the first time a file that already
       exists (including a file that might not exist but for which recovery
       information is available, when the --rr option is specified) replaces or
       initializes the contents of the edit buffer, the current line shall be
       set to the last line of the edit buffer, the current column shall be
       set to non-<blank>, and the _e_x commands specified with the --cc option
       shall be executed. In this case, the current line and current column
       shall not be set as described for the command associated with the
       replacement or initialization of the edit buffer contents. However, if
       the --tt option or a ttaagg command is associated with this action, the --cc
       option commands shall be executed and then the movement to the tag
       shall be performed.

       The current argument list shall initially be set to the filenames
       specified by the user on the command line. If no filenames are
       specified by the user, the current argument list shall be empty. If the
       --tt option was specified, it is unspecified whether any filename
       resulting from tag processing shall be prepended to the current
       argument list. In the case where the filename is added as a prefix to
       the current argument list, the current argument list reference shall be
       set to that filename. In the case where the filename is not added as a
       prefix to the current argument list, the current argument list
       reference shall logically be located before the first of the filenames
       specified on the command line (for example, a subsequent _e_x nneexxtt
       command shall edit the first filename from the command line). If the --tt
       option was not specified, the current argument list reference shall be
       to the first of the filenames on the command line.

   AAddddrreessssiinngg iinn eexx
       Addressing in _e_x relates to the current line and the current column;
       the address of a line is its 1-based line number, the address of a
       column is its 1-based count from the beginning of the line. Generally,
       the current line is the last line affected by a command. The current
       line number is the address of the current line. In each command
       description, the effect of the command on the current line number and
       the current column is described.

       Addresses are constructed as follows:

        1. The character ''..''  (period) shall address the current line.

        2. The character ''$$'' shall address the last line of the edit buffer.

        3. The positive decimal number _n shall address the _nth line of the
           edit buffer.

        4. The address ""''xx"" refers to the line marked with the mark name
           character ''xx'', which shall be a lowercase letter from the portable
           character set, the backquote character, or the single-quote
           character. It shall be an error if the line that was marked is not
           currently present in the edit buffer or the mark has not been set.
           Lines can be marked with the _e_x mmaarrkk or kk commands, or the _v_i mm
           command.

        5. A regular expression enclosed by <slash> characters (''//'') shall
           address the first line found by searching forwards from the line
           following the current line toward the end of the edit buffer and
           stopping at the first line for which the line excluding the
           terminating <newline> matches the regular expression. As stated in
           _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n_s _i_n _e_x, an address consisting of a null regular
           expression delimited by <slash> characters (""////"") shall address the
           next line for which the line excluding the terminating <newline>
           matches the last regular expression encountered. In addition, the
           second <slash> can be omitted at the end of a command line. If the
           wwrraappssccaann edit option is set, the search shall wrap around to the
           beginning of the edit buffer and continue up to and including the
           current line, so that the entire edit buffer is searched. Within
           the regular expression, the sequence ""\\//"" shall represent a literal
           <slash> instead of the regular expression delimiter.

        6. A regular expression enclosed in <question-mark> characters (''??'')
           shall address the first line found by searching backwards from the
           line preceding the current line toward the beginning of the edit
           buffer and stopping at the first line for which the line excluding
           the terminating <newline> matches the regular expression. An
           address consisting of a null regular expression delimited by
           <question-mark> characters (""????"") shall address the previous line
           for which the line excluding the terminating <newline> matches the
           last regular expression encountered. In addition, the second
           <question-mark> can be omitted at the end of a command line. If the
           wwrraappssccaann edit option is set, the search shall wrap around from the
           beginning of the edit buffer to the end of the edit buffer and
           continue up to and including the current line, so that the entire
           edit buffer is searched. Within the regular expression, the
           sequence ""\\??"" shall represent a literal <question-mark> instead of
           the RE delimiter.

        7. A <plus-sign> (''++'') or a <hyphen-minus> (''--'') followed by a decimal
           number shall address the current line plus or minus the number. A
           ''++'' or ''--'' not followed by a decimal number shall address the
           current line plus or minus 1.

       Addresses can be followed by zero or more address offsets, optionally
       <blank>-separated.  Address offsets are constructed as follows:

        1. A ''++'' or ''--'' immediately followed by a decimal number shall add
           (subtract) the indicated number of lines to (from) the address. A
           ''++'' or ''--'' not followed by a decimal number shall add (subtract) 1
           to (from) the address.

        2. A decimal number shall add the indicated number of lines to the
           address.

       It shall not be an error for an intermediate address value to be less
       than zero or greater than the last line in the edit buffer. It shall be
       an error for the final address value to be less than zero or greater
       than the last line in the edit buffer.

       Commands take zero, one, or two addresses; see the descriptions of
       _1_a_d_d_r and _2_a_d_d_r in _C_o_m_m_a_n_d _D_e_s_c_r_i_p_t_i_o_n_s _i_n _e_x.  If more than the
       required number of addresses are provided to a command that requires
       zero addresses, it shall be an error. Otherwise, if more than the
       required number of addresses are provided to a command, the addresses
       specified first shall be evaluated and then discarded until the maximum
       number of valid addresses remain.

       Addresses shall be separated from each other by a <comma> ('',,'') or a
       <semicolon> ('';;'').  If no address is specified before or after a
       <comma> or <semicolon> separator, it shall be as if the address of the
       current line was specified before or after the separator. In the case
       of a <semicolon> separator, the current line (''..'')  shall be set to the
       first address, and only then will the next address be calculated. This
       feature can be used to determine the starting line for forwards and
       backwards searches (see rules 5. and 6.).

       A <percent-sign> (''%%'') shall be equivalent to entering the two
       addresses ""11,,$$"".

       Any delimiting <blank> characters between addresses, address
       separators, or address offsets shall be discarded.

   CCoommmmaanndd LLiinnee PPaarrssiinngg iinn eexx
       The following symbol is used in this and following sections to describe
       parsing behavior:

       _e_s_c_a_p_e    If a character is referred to as ``<backslash>-escaped'' or
                 ``<control>-V-escaped'', it shall mean that the character
                 acquired or lost a special meaning by virtue of being
                 preceded, respectively, by a <backslash> or <control>-V
                 character. Unless otherwise specified, the escaping character
                 shall be discarded at that time and shall not be further
                 considered for any purpose.

       Command-line parsing shall be done in the following steps. For each
       step, characters already evaluated shall be ignored; that is, the
       phrase ``leading character'' refers to the next character that has not
       yet been evaluated.

        1. Leading <colon> characters shall be skipped.

        2. Leading <blank> characters shall be skipped.

        3. If the leading character is a double-quote character, the
           characters up to and including the next non-<backslash>-escaped
           <newline> shall be discarded, and any subsequent characters shall
           be parsed as a separate command.

        4. Leading characters that can be interpreted as addresses shall be
           evaluated; see _A_d_d_r_e_s_s_i_n_g _i_n _e_x.

        5. Leading <blank> characters shall be skipped.

        6. If the next character is a <vertical-line> character or a
           <newline>:

            a. If the next character is a <newline>:

                i.  If _e_x is in open or visual mode, the current line shall be
                    set to the last address specified, if any.

               ii.  Otherwise, if the last command was terminated by a
                    <vertical-line> character, no action shall be taken; for
                    example, the command ""||||<<nneewwlliinnee>>"" shall execute two
                    implied commands, not three.

               iii. Otherwise, step 6.b. shall apply.

            b. Otherwise, the implied command shall be the pprriinntt command. The
               last ##, pp, and ll flags specified to any _e_x command shall be
               remembered and shall apply to this implied command.  Executing
               the _e_x nnuummbbeerr, pprriinntt, or lliisstt command shall set the remembered
               flags to ##, nothing, and ll, respectively, plus any other flags
               specified for that execution of the nnuummbbeerr, pprriinntt, or lliisstt
               command.

               If _e_x is not currently performing a gglloobbaall or vv command, and no
               address or count is specified, the current line shall be
               incremented by 1 before the command is executed. If
               incrementing the current line would result in an address past
               the last line in the edit buffer, the command shall fail, and
               the increment shall not happen.

            c. The <newline> or <vertical-line> character shall be discarded
               and any subsequent characters shall be parsed as a separate
               command.

        7. The command name shall be comprised of the next character (if the
           character is not alphabetic), or the next character and any
           subsequent alphabetic characters (if the character is alphabetic),
           with the following exceptions:

            a. Commands that consist of any prefix of the characters in the
               command name ddeelleettee, followed immediately by any of the
               characters ''ll'', ''pp'', ''++'', ''--'', or ''##'' shall be interpreted as a
               ddeelleettee command, followed by a <blank>, followed by the
               characters that were not part of the prefix of the ddeelleettee
               command. The maximum number of characters shall be matched to
               the command name ddeelleettee; for example, ""ddeell"" shall not be
               treated as ""ddee"" followed by the flag ll.

            b. Commands that consist of the character ''kk'', followed by a
               character that can be used as the name of a mark, shall be
               equivalent to the mark command followed by a <blank>, followed
               by the character that followed the ''kk''.

            c. Commands that consist of the character ''ss'', followed by
               characters that could be interpreted as valid options to the ss
               command, shall be the equivalent of the ss command, without any
               pattern or replacement values, followed by a <blank>, followed
               by the characters after the ''ss''.

        8. The command name shall be matched against the possible command
           names, and a command name that contains a prefix matching the
           characters specified by the user shall be the executed command. In
           the case of commands where the characters specified by the user
           could be ambiguous, the executed command shall be as follows:

                         +---+--------++---+-------++---+-------+
                         |aa  | aappppeenndd ||nn  | nneexxtt  ||tt  | tt     |
                         |cc  | cchhaannggee ||pp  | pprriinntt ||uu  | uunnddoo  |
                         |cchh | cchhaannggee ||pprr | pprriinntt ||uunn | uunnddoo  |
                         |ee  | eeddiitt   ||rr  | rreeaadd  ||vv  | vv     |
                         |mm  | mmoovvee   ||rree | rreeaadd  ||ww  | wwrriittee |
                         |mmaa | mmaarrkk   ||ss  | ss     ||   |       |
                         +---+--------++---+-------++---+-------+
           Implementation extensions with names causing similar ambiguities
           shall not be checked for a match until all possible matches for
           commands specified by POSIX.1-2008 have been checked.

        9. If the command is a !!  command, or if the command is a rreeaadd command
           followed by zero or more <blank> characters and a !!, or if the
           command is a wwrriittee command followed by one or more <blank>
           characters and a !!, the rest of the command shall include all
           characters up to a non-<backslash>-escaped <newline>.  The
           <newline> shall be discarded and any subsequent characters shall be
           parsed as a separate _e_x command.

       10. Otherwise, if the command is an eeddiitt, eexx, or nneexxtt command, or a
           vviissuuaall command while in open or visual mode, the next part of the
           command shall be parsed as follows:

            a. Any ''!!''  character immediately following the command shall be
               skipped and be part of the command.

            b. Any leading <blank> characters shall be skipped and be part of
               the command.

            c. If the next character is a ''++'', characters up to the first
               non-<backslash>-escaped <newline> or non-<backslash>-escaped
               <blank> shall be skipped and be part of the command.

            d. The rest of the command shall be determined by the steps
               specified in paragraph 12.

       11. Otherwise, if the command is a gglloobbaall, ooppeenn, ss, or vv command, the
           next part of the command shall be parsed as follows:

            a. Any leading <blank> characters shall be skipped and be part of
               the command.

            b. If the next character is not an alphanumeric, double-quote,
               <newline>, <backslash>, or <vertical-line> character:

                i.  The next character shall be used as a command delimiter.

               ii.  If the command is a gglloobbaall, ooppeenn, or vv command, characters
                    up to the first non-<backslash>-escaped <newline>, or
                    first non-<backslash>-escaped delimiter character, shall
                    be skipped and be part of the command.

               iii. If the command is an ss command, characters up to the first
                    non-<backslash>-escaped <newline>, or second
                    non-<backslash>-escaped delimiter character, shall be
                    skipped and be part of the command.

            c. If the command is a gglloobbaall or vv command, characters up to the
               first non-<backslash>-escaped <newline> shall be skipped and be
               part of the command.

            d. Otherwise, the rest of the command shall be determined by the
               steps specified in paragraph 12.

       12. Otherwise:

            a. If the command was a mmaapp, uunnmmaapp, aabbbbrreevviiaattee, or uunnaabbbbrreevviiaattee
               command, characters up to the first non-<control>-V-escaped
               <newline>, <vertical-line>, or double-quote character shall be
               skipped and be part of the command.

            b. Otherwise, characters up to the first non-<backslash>-escaped
               <newline>, <vertical-line>, or double-quote character shall be
               skipped and be part of the command.

            c. If the command was an aappppeenndd, cchhaannggee, or iinnsseerrtt command, and
               the step 12.b. ended at a <vertical-line> character, any
               subsequent characters, up to the next non-<backslash>-escaped
               <newline> shall be used as input text to the command.

            d. If the command was ended by a double-quote character, all
               subsequent characters, up to the next non-<backslash>-escaped
               <newline>, shall be discarded.

            e. The terminating <newline> or <vertical-line> character shall be
               discarded and any subsequent characters shall be parsed as a
               separate _e_x command.

       Command arguments shall be parsed as described by the Synopsis and
       Description of each individual _e_x command. This parsing shall not be
       <blank>-sensitive, except for the !!  argument, which must follow the
       command name without intervening <blank> characters, and where it would
       otherwise be ambiguous. For example, _c_o_u_n_t and _f_l_a_g arguments need not
       be <blank>-separated because ""dd2222pp"" is not ambiguous, but _f_i_l_e
       arguments to the _e_x nneexxtt command must be separated by one or more
       <blank> characters. Any <blank> in command arguments for the
       aabbbbrreevviiaattee, uunnaabbbbrreevviiaattee, mmaapp, and uunnmmaapp commands can be <control>-V-
       escaped, in which case the <blank> shall not be used as an argument
       delimiter. Any <blank> in the command argument for any other command
       can be <backslash>-escaped, in which case that <blank> shall not be
       used as an argument delimiter.

       Within command arguments for the aabbbbrreevviiaattee, uunnaabbbbrreevviiaattee, mmaapp, and
       uunnmmaapp commands, any character can be <control>-V-escaped.  All such
       escaped characters shall be treated literally and shall have no special
       meaning. Within command arguments for all other _e_x commands that are
       not regular expressions or replacement strings, any character that
       would otherwise have a special meaning can be <backslash>-escaped.
       Escaped characters shall be treated literally, without special meaning
       as shell expansion characters or ''!!'', ''%%'', and ''##'' expansion
       characters. See _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n_s _i_n _e_x and _R_e_p_l_a_c_e_m_e_n_t _S_t_r_i_n_g_s _i_n _e_x
       for descriptions of command arguments that are regular expressions or
       replacement strings.

       Non-<backslash>-escaped ''%%'' characters appearing in _f_i_l_e arguments to
       any _e_x command shall be replaced by the current pathname; unescaped ''##''
       characters shall be replaced by the alternate pathname. It shall be an
       error if ''%%'' or ''##'' characters appear unescaped in an argument and
       their corresponding values are not set.

       Non-<backslash>-escaped ''!!''  characters in the arguments to either the
       _e_x !!  command or the open and visual mode !!  command, or in the
       arguments to the _e_x rreeaadd command, where the first non-<blank> after the
       command name is a ''!!''  character, or in the arguments to the _e_x wwrriittee
       command where the command name is followed by one or more <blank>
       characters and the first non-<blank> after the command name is a ''!!''
       character, shall be replaced with the arguments to the last of those
       three commands as they appeared after all unescaped ''%%'', ''##'', and ''!!''
       characters were replaced. It shall be an error if ''!!''  characters
       appear unescaped in one of these commands and there has been no
       previous execution of one of these commands.

       If an error occurs during the parsing or execution of an _e_x command:

        *  An informational message to this effect shall be written. Execution
           of the _e_x command shall stop, and the cursor (for example, the
           current line and column) shall not be further modified.

        *  If the _e_x command resulted from a map expansion, all characters
           from that map expansion shall be discarded, except as otherwise
           specified by the mmaapp command.

        *  Otherwise, if the _e_x command resulted from the processing of an
           _E_X_I_N_I_T environment variable, a ..eexxrrcc file, a ::ssoouurrccee command, a --cc
           option, or a ++_c_o_m_m_a_n_d specified to an _e_x eeddiitt, eexx, nneexxtt, or vviissuuaall
           command, no further commands from the source of the commands shall
           be executed.

        *  Otherwise, if the _e_x command resulted from the execution of a
           buffer or a gglloobbaall or vv command, no further commands caused by the
           execution of the buffer or the gglloobbaall or vv command shall be
           executed.

        *  Otherwise, if the _e_x command was not terminated by a <newline>, all
           characters up to and including the next non-<backslash>-escaped
           <newline> shall be discarded.

   IInnppuutt EEddiittiinngg iinn eexx
       The following symbol is used in this and the following sections to
       specify command actions:

       _w_o_r_d      In the POSIX locale, a word consists of a maximal sequence of
                 letters, digits, and underscores, delimited at both ends by
                 characters other than letters, digits, or underscores, or by
                 the beginning or end of a line or the edit buffer.

       When accepting input characters from the user, in either _e_x command
       mode or _e_x text input mode, _e_x shall enable canonical mode input
       processing, as defined in the System Interfaces volume of POSIX.1-2017.

       If in _e_x text input mode:

        1. If the nnuummbbeerr edit option is set, _e_x shall prompt for input using
           the line number that would be assigned to the line if it is
           entered, in the format specified for the _e_x nnuummbbeerr command.

        2. If the aauuttooiinnddeenntt edit option is set, _e_x shall prompt for input
           using aauuttooiinnddeenntt characters, as described by the aauuttooiinnddeenntt edit
           option.  aauuttooiinnddeenntt characters shall follow the line number, if
           any.

       If in _e_x command mode:

        1. If the pprroommpptt edit option is set, input shall be prompted for using
           a single ''::'' character; otherwise, there shall be no prompt.

       The input characters in the following sections shall have the following
       effects on the input line.

   SSccrroollll
       _S_y_n_o_p_s_i_s:

                     eof

       See the description of the _s_t_t_y _e_o_f character in _s_t_t_y.

       If in _e_x command mode:

              If the _e_o_f character is the first character entered on the line,
              the line shall be evaluated as if it contained two characters: a
              <control>-D and a <newline>.

              Otherwise, the _e_o_f character shall have no special meaning.

       If in _e_x text input mode:

              If the cursor follows an aauuttooiinnddeenntt character, the aauuttooiinnddeenntt
              characters in the line shall be modified so that a part of the
              next text input character will be displayed on the first column
              in the line after the previous sshhiiffttwwiiddtthh edit option column
              boundary, and the user shall be prompted again for input for the
              same line.

              Otherwise, if the cursor follows a ''00'', which follows an
              aauuttooiinnddeenntt character, and the ''00'' was the previous text input
              character, the ''00'' and all aauuttooiinnddeenntt characters in the line
              shall be discarded, and the user shall be prompted again for
              input for the same line.

              Otherwise, if the cursor follows a ''^^'', which follows an
              aauuttooiinnddeenntt character, and the ''^^'' was the previous text input
              character, the ''^^'' and all aauuttooiinnddeenntt characters in the line
              shall be discarded, and the user shall be prompted again for
              input for the same line. In addition, the aauuttooiinnddeenntt level for
              the next input line shall be derived from the same line from
              which the aauuttooiinnddeenntt level for the current input line was
              derived.

              Otherwise, if there are no aauuttooiinnddeenntt or text input characters
              in the line, the _e_o_f character shall be discarded.

              Otherwise, the _e_o_f character shall have no special meaning.

   <<nneewwlliinnee>>
       _S_y_n_o_p_s_i_s:

                     <newline>
                     <control>-J

       If in _e_x command mode:

              Cause the command line to be parsed; <control>-J shall be mapped
              to the <newline> for this purpose.

       If in _e_x text input mode:

              Terminate the current line. If there are no characters other
              than aauuttooiinnddeenntt characters on the line, all characters on the
              line shall be discarded.

              Prompt for text input on a new line after the current line. If
              the aauuttooiinnddeenntt edit option is set, an appropriate number of
              aauuttooiinnddeenntt characters shall be added as a prefix to the line as
              described by the _e_x aauuttooiinnddeenntt edit option.

   <<bbaacckkssllaasshh>>
       _S_y_n_o_p_s_i_s:

                     <backslash>

       Allow the entry of a subsequent <newline> or <control>-J as a literal
       character, removing any special meaning that it may have to the editor
       during text input mode. The <backslash> character shall be retained and
       evaluated when the command line is parsed, or retained and included
       when the input text becomes part of the edit buffer.

   <<ccoonnttrrooll>>--VV
       _S_y_n_o_p_s_i_s:

                     <control>-V

       Allow the entry of any subsequent character as a literal character,
       removing any special meaning that it may have to the editor during text
       input mode. The <control>-V character shall be discarded before the
       command line is parsed or the input text becomes part of the edit
       buffer.

       If the ``literal next'' functionality is performed by the underlying
       system, it is implementation-defined whether a character other than
       <control>-V performs this function.

   <<ccoonnttrrooll>>--WW
       _S_y_n_o_p_s_i_s:

                     <control>-W

       Discard the <control>-W, and the word previous to it in the input line,
       including any <blank> characters following the word and preceding the
       <control>-W.  If the ``word erase'' functionality is performed by the
       underlying system, it is implementation-defined whether a character
       other than <control>-W performs this function.

   CCoommmmaanndd DDeessccrriippttiioonnss iinn eexx
       The following symbols are used in this section to represent command
       modifiers. Some of these modifiers can be omitted, in which case the
       specified defaults shall be used.

       _1_a_d_d_r     A single line address, given in any of the forms described in
                 _A_d_d_r_e_s_s_i_n_g _i_n _e_x; the default shall be the current line
                 (''..''), unless otherwise specified.

                 If the line address is zero, it shall be an error, unless
                 otherwise specified in the following command descriptions.

                 If the edit buffer is empty, and the address is specified
                 with a command other than ==, aappppeenndd, iinnsseerrtt, ooppeenn, ppuutt, rreeaadd,
                 or vviissuuaall, or the address is not zero, it shall be an error.

       _2_a_d_d_r     Two addresses specifying an inclusive range of lines. If no
                 addresses are specified, the default for _2_a_d_d_r shall be the
                 current line only (""..,,..""), unless otherwise specified in the
                 following command descriptions. If one address is specified,
                 _2_a_d_d_r shall specify that line only, unless otherwise
                 specified in the following command descriptions.

                 It shall be an error if the first address is greater than the
                 second address.

                 If the edit buffer is empty, and the two addresses are
                 specified with a command other than the !!, wwrriittee, wwqq, or xxiitt
                 commands, or either address is not zero, it shall be an
                 error.

       _c_o_u_n_t     A positive decimal number. If _c_o_u_n_t is specified, it shall be
                 equivalent to specifying an additional address to the
                 command, unless otherwise specified by the following command
                 descriptions. The additional address shall be equal to the
                 last address specified to the command (either explicitly or
                 by default) plus _c_o_u_n_t-1.

                 If this would result in an address greater than the last line
                 of the edit buffer, it shall be corrected to equal the last
                 line of the edit buffer.

       _f_l_a_g_s     One or more of the characters ''++'', ''--'', ''##'', ''pp'', or ''ll''
                 (ell). The flag characters can be <blank>-separated, and in
                 any order or combination. The characters ''##'', ''pp'', and ''ll''
                 shall cause lines to be written in the format specified by
                 the pprriinntt command with the specified _f_l_a_g_s.

                 The lines to be written are as follows:

                  1. All edit buffer lines written during the execution of the
                     _e_x &&, ~~, lliisstt, nnuummbbeerr, ooppeenn, pprriinntt, ss, vviissuuaall, and zz
                     commands shall be written as specified by _f_l_a_g_s.

                  2. After the completion of an _e_x command with a flag as an
                     argument, the current line shall be written as specified
                     by _f_l_a_g_s, unless the current line was the last line
                     written by the command.

                 The characters ''++'' and ''--'' cause the value of the current
                 line after the execution of the _e_x command to be adjusted by
                 the offset address as described in _A_d_d_r_e_s_s_i_n_g _i_n _e_x.  This
                 adjustment shall occur before the current line is written as
                 described in 2. above.

                 The default for _f_l_a_g_s shall be none.

       _b_u_f_f_e_r    One of a number of named areas for holding text. The named
                 buffers are specified by the alphanumeric characters of the
                 POSIX locale. There shall also be one ``unnamed'' buffer.
                 When no buffer is specified for editor commands that use a
                 buffer, the unnamed buffer shall be used.  Commands that
                 store text into buffers shall store the text as it was before
                 the command took effect, and shall store text occurring
                 earlier in the file before text occurring later in the file,
                 regardless of how the text region was specified. Commands
                 that store text into buffers shall store the text into the
                 unnamed buffer as well as any specified buffer.

                 In _e_x commands, buffer names are specified as the name by
                 itself. In open or visual mode commands the name is preceded
                 by a double-quote (''""'') character.

                 If the specified buffer name is an uppercase character, and
                 the buffer contents are to be modified, the buffer shall be
                 appended to rather than being overwritten. If the buffer is
                 not being modified, specifying the buffer name in lowercase
                 and uppercase shall have identical results.

                 There shall also be buffers named by the numbers 1 through 9.
                 In open and visual mode, if a region of text including
                 characters from more than a single line is being modified by
                 the _v_i cc or dd commands, the motion character associated with
                 the cc or dd commands specifies that the buffer text shall be
                 in line mode, or the commands %%, ``, //, ??, ((, )), NN, nn, {{, or }}
                 are used to define a region of text for the cc or dd commands,
                 the contents of buffers 1 through 8 shall be moved into the
                 buffer named by the next numerically greater value, the
                 contents of buffer 9 shall be discarded, and the region of
                 text shall be copied into buffer 1. This shall be in addition
                 to copying the text into a user-specified buffer or unnamed
                 buffer, or both. Numeric buffers can be specified as a source
                 buffer for open and visual mode commands; however, specifying
                 a numeric buffer as the write target of an open or visual
                 mode command shall have unspecified results.

                 The text of each buffer shall have the characteristic of
                 being in either line or character mode. Appending text to a
                 non-empty buffer shall set the mode to match the
                 characteristic of the text being appended. Appending text to
                 a buffer shall cause the creation of at least one additional
                 line in the buffer. All text stored into buffers by _e_x
                 commands shall be in line mode. The _e_x commands that use
                 buffers as the source of text specify individually how
                 buffers of different modes are handled. Each open or visual
                 mode command that uses buffers for any purpose specifies
                 individually the mode of the text stored into the buffer and
                 how buffers of different modes are handled.

       _f_i_l_e      Command text used to derive a pathname. The default shall be
                 the current pathname, as defined previously, in which case,
                 if no current pathname has yet been established it shall be
                 an error, except where specifically noted in the individual
                 command descriptions that follow.  If the command text
                 contains any of the characters ''~~'', ''{{'', ''[['', ''**'', ''??'', ''$$'',
                 ''""'', backquote, single-quote, and <backslash>, it shall be
                 subjected to the process of ``shell expansions'', as
                 described below; if more than a single pathname results and
                 the command expects only one, it shall be an error.

                 The process of shell expansions in the editor shall be done
                 as follows. The _e_x utility shall pass two arguments to the
                 program named by the shell edit option; the first shall be
                 --cc, and the second shall be the string ""eecchhoo"" and the command
                 text as a single argument. The standard output and standard
                 error of that command shall replace the command text.

       !!         A character that can be appended to the command name to
                 modify its operation, as detailed in the individual command
                 descriptions. With the exception of the _e_x rreeaadd, wwrriittee, and !!
                 commands, the ''!!''  character shall only act as a modifier if
                 there are no <blank> characters between it and the command
                 name.

       _r_e_m_e_m_b_e_r_e_d _s_e_a_r_c_h _d_i_r_e_c_t_i_o_n
                 The _v_i commands NN and nn begin searching in a forwards or
                 backwards direction in the edit buffer based on a remembered
                 search direction, which is initially unset, and is set by the
                 _e_x gglloobbaall, vv, ss, and ttaagg commands, and the _v_i // and ??
                 commands.

   AAbbbbrreevviiaattee
       _S_y_n_o_p_s_i_s:

                     ab[[_b_r_e_v_i_a_t_e]][[_l_h_s _r_h_s]]

       If _l_h_s and _r_h_s are not specified, write the current list of
       abbreviations and do nothing more.

       Implementations may restrict the set of characters accepted in _l_h_s or
       _r_h_s, except that printable characters and <blank> characters shall not
       be restricted. Additional restrictions shall be implementation-defined.

       In both _l_h_s and _r_h_s, any character may be escaped with a <control>-V,
       in which case the character shall not be used to delimit _l_h_s from _r_h_s,
       and the escaping <control>-V shall be discarded.

       In open and visual text input mode, if a non-word or <ESC> character
       that is not escaped by a <control>-V character is entered after a word
       character, a check shall be made for a set of characters matching _l_h_s,
       in the text input entered during this command. If it is found, the
       effect shall be as if _r_h_s was entered instead of _l_h_s.

       The set of characters that are checked is defined as follows:

        1. If there are no characters inserted before the word and non-word or
           <ESC> characters that triggered the check, the set of characters
           shall consist of the word character.

        2. If the character inserted before the word and non-word or <ESC>
           characters that triggered the check is a word character, the set of
           characters shall consist of the characters inserted immediately
           before the triggering characters that are word characters, plus the
           triggering word character.

        3. If the character inserted before the word and non-word or <ESC>
           characters that triggered the check is not a word character, the
           set of characters shall consist of the characters that were
           inserted before the triggering characters that are neither <blank>
           characters nor word characters, plus the triggering word character.

       It is unspecified whether the _l_h_s argument entered for the _e_x
       aabbbbrreevviiaattee and uunnaabbbbrreevviiaattee commands is replaced in this fashion.
       Regardless of whether or not the replacement occurs, the effect of the
       command shall be as if the replacement had not occurred.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   AAppppeenndd
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] a[[ppend]][[!]]

       Enter _e_x text input mode; the input text shall be placed after the
       specified line. If line zero is specified, the text shall be placed at
       the beginning of the edit buffer.

       This command shall be affected by the nnuummbbeerr and aauuttooiinnddeenntt edit
       options; following the command name with ''!!''  shall cause the
       aauuttooiinnddeenntt edit option setting to be toggled for the duration of this
       command only.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last input line; if no lines were input, set
       to the specified line, or to the first line of the edit buffer if a
       line of zero was specified, or zero if the edit buffer is empty.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   AArrgguummeennttss
       _S_y_n_o_p_s_i_s:

                     ar[[_g_s]]

       Write the current argument list, with the current argument-list entry,
       if any, between ''[['' and '']]'' characters.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   CChhaannggee
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] c[[hange]][[!]][[_c_o_u_n_t]]

       Enter _e_x text input mode; the input text shall replace the specified
       lines. The specified lines shall be copied into the unnamed buffer,
       which shall become a line mode buffer.

       This command shall be affected by the nnuummbbeerr and aauuttooiinnddeenntt edit
       options; following the command name with ''!!''  shall cause the
       aauuttooiinnddeenntt edit option setting to be toggled for the duration of this
       command only.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last input line; if no lines were input, set
       to the line before the first address, or to the first line of the edit
       buffer if there are no lines preceding the first address, or to zero if
       the edit buffer is empty.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   CChhaannggee DDiirreeccttoorryy
       _S_y_n_o_p_s_i_s:

                     chd[[ir]][[!]][[_d_i_r_e_c_t_o_r_y]]
                     cd[[!]][[_d_i_r_e_c_t_o_r_y]]

       Change the current working directory to _d_i_r_e_c_t_o_r_y.

       If no _d_i_r_e_c_t_o_r_y argument is specified, and the _H_O_M_E environment
       variable is set to a non-null and non-empty value, _d_i_r_e_c_t_o_r_y shall
       default to the value named in the _H_O_M_E environment variable. If the
       _H_O_M_E environment variable is empty or is undefined, the default value
       of _d_i_r_e_c_t_o_r_y is implementation-defined.

       If no ''!!''  is appended to the command name, and the edit buffer has
       been modified since the last complete write, and the current pathname
       does not begin with a ''//'', it shall be an error.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   CCooppyy
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] co[[py]] _1_a_d_d_r [[_f_l_a_g_s]]
                     [[_2_a_d_d_r]] t _1_a_d_d_r [[_f_l_a_g_s]]

       Copy the specified lines after the specified destination line; line
       zero specifies that the lines shall be placed at the beginning of the
       edit buffer.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line copied.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   DDeelleettee
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] d[[elete]][[_b_u_f_f_e_r]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       Delete the specified lines into a buffer (defaulting to the unnamed
       buffer), which shall become a line-mode buffer.

       Flags can immediately follow the command name; see _C_o_m_m_a_n_d _L_i_n_e _P_a_r_s_i_n_g
       _i_n _e_x.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the line following the deleted lines, or to the
       last line in the edit buffer if that line is past the end of the edit
       buffer, or to zero if the edit buffer is empty.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   EEddiitt
       _S_y_n_o_p_s_i_s:

                     e[[dit]][[!]][[+_c_o_m_m_a_n_d]][[_f_i_l_e]]
                     ex[[!]][[+_c_o_m_m_a_n_d]][[_f_i_l_e]]

       If no ''!!''  is appended to the command name, and the edit buffer has
       been modified since the last complete write, it shall be an error.

       If _f_i_l_e is specified, replace the current contents of the edit buffer
       with the current contents of _f_i_l_e, and set the current pathname to
       _f_i_l_e.  If _f_i_l_e is not specified, replace the current contents of the
       edit buffer with the current contents of the file named by the current
       pathname. If for any reason the current contents of the file cannot be
       accessed, the edit buffer shall be empty.

       The ++_c_o_m_m_a_n_d option shall be <blank>-delimited; <blank> characters
       within the ++_c_o_m_m_a_n_d can be escaped by preceding them with a <backslash>
       character. The ++_c_o_m_m_a_n_d shall be interpreted as an _e_x command
       immediately after the contents of the edit buffer have been replaced
       and the current line and column have been set.

       If the edit buffer is empty:

       _C_u_r_r_e_n_t _l_i_n_e: Set to 0.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to 1.

       Otherwise, if executed while in _e_x command mode or if the ++_c_o_m_m_a_n_d
       argument is specified:

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line of the edit buffer.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

       Otherwise, if _f_i_l_e is omitted or results in the current pathname:

       _C_u_r_r_e_n_t _l_i_n_e: Set to the first line of the edit buffer.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

       Otherwise, if _f_i_l_e is the same as the last file edited, the line and
       column shall be set as follows; if the file was previously edited, the
       line and column may be set as follows:

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last value held when that file was last
       edited. If this value is not a valid line in the new edit buffer, set
       to the first line of the edit buffer.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: If the current line was set to the last value held when
       the file was last edited, set to the last value held when the file was
       last edited.  Otherwise, or if the last value is not a valid column in
       the new edit buffer, set to non-<blank>.

       Otherwise:

       _C_u_r_r_e_n_t _l_i_n_e: Set to the first line of the edit buffer.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   FFiillee
       _S_y_n_o_p_s_i_s:

                     f[[ile]][[_f_i_l_e]]

       If a _f_i_l_e argument is specified, the alternate pathname shall be set to
       the current pathname, and the current pathname shall be set to _f_i_l_e.

       Write an informational message. If the file has a current pathname, it
       shall be included in this message; otherwise, the message shall
       indicate that there is no current pathname. If the edit buffer contains
       lines, the current line number and the number of lines in the edit
       buffer shall be included in this message; otherwise, the message shall
       indicate that the edit buffer is empty. If the edit buffer has been
       modified since the last complete write, this fact shall be included in
       this message. If the rreeaaddoonnllyy edit option is set, this fact shall be
       included in this message. The message may contain other unspecified
       information.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   GGlloobbaall
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] g[[lobal]] /_p_a_t_t_e_r_n/ [[_c_o_m_m_a_n_d_s]]
                     [[_2_a_d_d_r]] v /_p_a_t_t_e_r_n/ [[_c_o_m_m_a_n_d_s]]

       The optional ''!!''  character after the gglloobbaall command shall be the same
       as executing the vv command.

       If _p_a_t_t_e_r_n is empty (for example, ""////"") or not specified, the last
       regular expression used in the editor command shall be used as the
       _p_a_t_t_e_r_n.  The _p_a_t_t_e_r_n can be delimited by <slash> characters (shown in
       the Synopsis), as well as any non-alphanumeric or non-<blank> other
       than <backslash>, <vertical-line>, <newline>, or double-quote.

       If no lines are specified, the lines shall default to the entire file.

       The gglloobbaall and vv commands are logically two-pass operations. First,
       mark the lines within the specified lines for which the line excluding
       the terminating <newline> matches (gglloobbaall) or does not match (vv or
       gglloobbaall!!)  the specified pattern. Second, execute the _e_x commands given
       by _c_o_m_m_a_n_d_s, with the current line (''..'')  set to each marked line. If
       an error occurs during this process, or the contents of the edit buffer
       are replaced (for example, by the _e_x ::eeddiitt command) an error message
       shall be written and no more commands resulting from the execution of
       this command shall be processed.

       Multiple _e_x commands can be specified by entering multiple commands on
       a single line using a <vertical-line> to delimit them, or one per line,
       by escaping each <newline> with a <backslash>.

       If no commands are specified:

        1. If in _e_x command mode, it shall be as if the pprriinntt command were
           specified.

        2. Otherwise, no command shall be executed.

       For the aappppeenndd, cchhaannggee, and iinnsseerrtt commands, the input text shall be
       included as part of the command, and the terminating <period> can be
       omitted if the command ends the list of commands. The ooppeenn and vviissuuaall
       commands can be specified as one of the commands, in which case each
       marked line shall cause the editor to enter open or visual mode. If
       open or visual mode is exited using the _v_i QQ command, the current line
       shall be set to the next marked line, and open or visual mode
       reentered, until the list of marked lines is exhausted.

       The gglloobbaall, vv, and uunnddoo commands cannot be used in _c_o_m_m_a_n_d_s.  Marked
       lines may be deleted by commands executed for lines occurring earlier
       in the file than the marked lines. In this case, no commands shall be
       executed for the deleted lines.

       If the remembered search direction is not set, the gglloobbaall and vv
       commands shall set it to forward.

       The aauuttoopprriinntt and aauuttooiinnddeenntt edit options shall be inhibited for the
       duration of the gg or vv command.

       _C_u_r_r_e_n_t _l_i_n_e: If no commands executed, set to the last marked line.
       Otherwise, as specified for the executed _e_x commands.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: If no commands are executed, set to non-<blank>;
       otherwise, as specified for the individual _e_x commands.

   IInnsseerrtt
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] i[[nsert]][[!]]

       Enter _e_x text input mode; the input text shall be placed before the
       specified line. If the line is zero or 1, the text shall be placed at
       the beginning of the edit buffer.

       This command shall be affected by the nnuummbbeerr and aauuttooiinnddeenntt edit
       options; following the command name with ''!!''  shall cause the
       aauuttooiinnddeenntt edit option setting to be toggled for the duration of this
       command only.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last input line; if no lines were input, set
       to the line before the specified line, or to the first line of the edit
       buffer if there are no lines preceding the specified line, or zero if
       the edit buffer is empty.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   JJooiinn
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] j[[oin]][[!]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       If _c_o_u_n_t is specified:

              If no address was specified, the jjooiinn command shall behave as if
              _2_a_d_d_r were the current line and the current line plus _c_o_u_n_t (.,.
              + _c_o_u_n_t).

              If one address was specified, the jjooiinn command shall behave as
              if _2_a_d_d_r were the specified address and the specified address
              plus _c_o_u_n_t (_a_d_d_r,_a_d_d_r + _c_o_u_n_t).

              If two addresses were specified, the jjooiinn command shall behave
              as if an additional address, equal to the last address plus
              _c_o_u_n_t -1 (_a_d_d_r_1,_a_d_d_r_2,_a_d_d_r_2 + _c_o_u_n_t -1), was specified.

              If this would result in a second address greater than the last
              line of the edit buffer, it shall be corrected to be equal to
              the last line of the edit buffer.

       If no _c_o_u_n_t is specified:

              If no address was specified, the jjooiinn command shall behave as if
              _2_a_d_d_r were the current line and the next line (.,. +1).

              If one address was specified, the jjooiinn command shall behave as
              if _2_a_d_d_r were the specified address and the next line (_a_d_d_r,_a_d_d_r
              +1).

       Join the text from the specified lines together into a single line,
       which shall replace the specified lines.

       If a ''!!''  character is appended to the command name, the jjooiinn shall be
       without modification of any line, independent of the current locale.

       Otherwise, in the POSIX locale, set the current line to the first of
       the specified lines, and then, for each subsequent line, proceed as
       follows:

        1. Discard leading <space> characters from the line to be joined.

        2. If the line to be joined is now empty, delete it, and skip steps 3
           through 5.

        3. If the current line ends in a <blank>, or the first character of
           the line to be joined is a ''))'' character, join the lines without
           further modification.

        4. If the last character of the current line is a ''..'', join the lines
           with two <space> characters between them.

        5. Otherwise, join the lines with a single <space> between them.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the first line specified.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   LLiisstt
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] l[[ist]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       This command shall be equivalent to the _e_x command:


           [[_2_a_d_d_r]] p[[rint]][[_c_o_u_n_t]] l[[_f_l_a_g_s]]

       See _P_r_i_n_t.

   MMaapp
       _S_y_n_o_p_s_i_s:

                     map[[!]][[_l_h_s _r_h_s]]

       If _l_h_s and _r_h_s are not specified:

        1. If ''!!''  is specified, write the current list of text input mode
           maps.

        2. Otherwise, write the current list of command mode maps.

        3. Do nothing more.

       Implementations may restrict the set of characters accepted in _l_h_s or
       _r_h_s, except that printable characters and <blank> characters shall not
       be restricted. Additional restrictions shall be implementation-defined.
       In both _l_h_s and _r_h_s, any character can be escaped with a <control>-V,
       in which case the character shall not be used to delimit _l_h_s from _r_h_s,
       and the escaping <control>-V shall be discarded.

       If the character ''!!''  is appended to the mmaapp command name, the mapping
       shall be effective during open or visual text input mode rather than
       ooppeenn or vviissuuaall command mode. This allows _l_h_s to have two different mmaapp
       definitions at the same time: one for command mode and one for text
       input mode.

       For command mode mappings:

              When the _l_h_s is entered as any part of a _v_i command in open or
              visual mode (but not as part of the arguments to the command),
              the action shall be as if the corresponding _r_h_s had been
              entered.

              If any character in the command, other than the first, is
              escaped using a <control>-V character, that character shall not
              be part of a match to an _l_h_s.

              It is unspecified whether implementations shall support mmaapp
              commands where the _l_h_s is more than a single character in
              length, where the first character of the _l_h_s is printable.

              If _l_h_s contains more than one character and the first character
              is ''##'', followed by a sequence of digits corresponding to a
              numbered function key, then when this function key is typed it
              shall be mapped to _r_h_s.  Characters other than digits following
              a ''##'' character also represent the function key named by the
              characters in the _l_h_s following the ''##'' and may be mapped to
              _r_h_s.  It is unspecified how function keys are named or what
              function keys are supported.

       For text input mode mappings:

              When the _l_h_s is entered as any part of text entered in open or
              visual text input modes, the action shall be as if the
              corresponding _r_h_s had been entered.

              If any character in the input text is escaped using a
              <control>-V character, that character shall not be part of a
              match to an _l_h_s.

              It is unspecified whether the _l_h_s text entered for subsequent
              mmaapp or uunnmmaapp commands is replaced with the _r_h_s text for the
              purposes of the screen display; regardless of whether or not the
              display appears as if the corresponding _r_h_s text was entered,
              the effect of the command shall be as if the _l_h_s text was
              entered.

       If only part of the _l_h_s is entered, it is unspecified how long the
       editor will wait for additional, possibly matching characters before
       treating the already entered characters as not matching the _l_h_s.

       The _r_h_s characters shall themselves be subject to remapping, unless
       otherwise specified by the rreemmaapp edit option, except that if the
       characters in _l_h_s occur as prefix characters in _r_h_s, those characters
       shall not be remapped.

       On block-mode terminals, the mapping need not occur immediately (for
       example, it may occur after the terminal transmits a group of
       characters to the system), but it shall achieve the same results as if
       it occurred immediately.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   MMaarrkk
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] ma[[rk]] _c_h_a_r_a_c_t_e_r
                     [[_1_a_d_d_r]] k _c_h_a_r_a_c_t_e_r

       Implementations shall support _c_h_a_r_a_c_t_e_r values of a single lowercase
       letter of the POSIX locale and the backquote and single-quote
       characters; support of other characters is implementation-defined.

       If executing the _v_i mm command, set the specified mark to the current
       line and 1-based numbered character referenced by the current column,
       if any; otherwise, column position 1.

       Otherwise, set the specified mark to the specified line and 1-based
       numbered first non-<blank> non-<newline> in the line, if any;
       otherwise, the last non-<newline> in the line, if any; otherwise,
       column position 1.

       The mark shall remain associated with the line until the mark is reset
       or the line is deleted. If a deleted line is restored by a subsequent
       uunnddoo command, any marks previously associated with the line, which have
       not been reset, shall be restored as well. Any use of a mark not
       associated with a current line in the edit buffer shall be an error.

       The marks `` and '' shall be set as described previously, immediately
       before the following events occur in the editor:

        1. The use of ''$$'' as an _e_x address

        2. The use of a positive decimal number as an _e_x address

        3. The use of a search command as an _e_x address

        4. The use of a mark reference as an _e_x address

        5. The use of the following open and visual mode commands:
           <control>-], %%, ((, )), [[, ]], {{, }}

        6. The use of the following open and visual mode commands: '', GG, HH, LL,
           MM, zz if the current line will change as a result of the command

        7. The use of the open and visual mode commands: //, ??, NN, ``, nn if the
           current line or column will change as a result of the command

        8. The use of the _e_x mode commands: zz, uunnddoo, gglloobbaall, vv

       For rules 1., 2., 3., and 4., the `` and '' marks shall not be set if the
       _e_x command is parsed as specified by rule 6.a. in _C_o_m_m_a_n_d _L_i_n_e _P_a_r_s_i_n_g
       _i_n _e_x.

       For rules 5., 6., and 7., the `` and '' marks shall not be set if the
       commands are used as motion commands in open and visual mode.

       For rules 1., 2., 3., 4., 5., 6., 7., and 8., the `` and '' marks shall
       not be set if the command fails.

       The `` and '' marks shall be set as described previously, each time the
       contents of the edit buffer are replaced (including the editing of the
       initial buffer), if in open or visual mode, or if in eexx mode and the
       edit buffer is not empty, before any commands or movements (including
       commands or movements specified by the --cc or --tt options or the ++_c_o_m_m_a_n_d
       argument) are executed on the edit buffer. If in open or visual mode,
       the marks shall be set as if executing the _v_i mm command; otherwise, as
       if executing the _e_x mmaarrkk command.

       When changing from eexx mode to open or visual mode, if the `` and '' marks
       are not already set, the `` and '' marks shall be set as described
       previously.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   MMoovvee
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] m[[ove]] _1_a_d_d_r [[_f_l_a_g_s]]

       Move the specified lines after the specified destination line. A
       destination of line zero specifies that the lines shall be placed at
       the beginning of the edit buffer. It shall be an error if the
       destination line is within the range of lines to be moved.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last of the moved lines.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   NNeexxtt
       _S_y_n_o_p_s_i_s:

                     n[[ext]][[!]][[+_c_o_m_m_a_n_d]][[_f_i_l_e ...]]

       If no ''!!''  is appended to the command name, and the edit buffer has
       been modified since the last complete write, it shall be an error,
       unless the file is successfully written as specified by the aauuttoowwrriittee
       option.

       If one or more files is specified:

        1. Set the argument list to the specified filenames.

        2. Set the current argument list reference to be the first entry in
           the argument list.

        3. Set the current pathname to the first filename specified.

       Otherwise:

        1. It shall be an error if there are no more filenames in the argument
           list after the filename currently referenced.

        2. Set the current pathname and the current argument list reference to
           the filename after the filename currently referenced in the
           argument list.

       Replace the contents of the edit buffer with the contents of the file
       named by the current pathname. If for any reason the contents of the
       file cannot be accessed, the edit buffer shall be empty.

       This command shall be affected by the aauuttoowwrriittee and wwrriitteeaannyy edit
       options.

       The ++_c_o_m_m_a_n_d option shall be <blank>-delimited; <blank> characters can
       be escaped by preceding them with a <backslash> character. The ++_c_o_m_m_a_n_d
       shall be interpreted as an _e_x command immediately after the contents of
       the edit buffer have been replaced and the current line and column have
       been set.

       _C_u_r_r_e_n_t _l_i_n_e: Set as described for the eeddiitt command.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set as described for the eeddiitt command.

   NNuummbbeerr
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] nu[[mber]][[_c_o_u_n_t]][[_f_l_a_g_s]]
                     [[_2_a_d_d_r]] #[[_c_o_u_n_t]][[_f_l_a_g_s]]

       These commands shall be equivalent to the _e_x command:


           [[_2_a_d_d_r]] p[[rint]][[_c_o_u_n_t]] #[[_f_l_a_g_s]]

       See _P_r_i_n_t.

   OOppeenn
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] o[[pen]] /_p_a_t_t_e_r_n/ [[_f_l_a_g_s]]

       This command need not be supported on block-mode terminals or terminals
       with insufficient capabilities. If standard input, standard output, or
       standard error are not terminal devices, the results are unspecified.

       Enter open mode.

       The trailing delimiter can be omitted from _p_a_t_t_e_r_n at the end of the
       command line. If _p_a_t_t_e_r_n is empty (for example, ""////"") or not specified,
       the last regular expression used in the editor shall be used as the
       pattern. The pattern can be delimited by <slash> characters (shown in
       the Synopsis), as well as any alphanumeric, or non-<blank> other than
       <backslash>, <vertical-line>, <newline>, or double-quote.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the specified line.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   PPrreesseerrvvee
       _S_y_n_o_p_s_i_s:

                     pre[[serve]]

       Save the edit buffer in a form that can later be recovered by using the
       --rr option or by using the _e_x rreeccoovveerr command. After the file has been
       preserved, a mail message shall be sent to the user. This message shall
       be readable by invoking the _m_a_i_l_x utility. The message shall contain
       the name of the file, the time of preservation, and an _e_x command that
       could be used to recover the file. Additional information may be
       included in the mail message.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   PPrriinntt
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] p[[rint]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       Write the addressed lines. The behavior is unspecified if the number of
       columns on the display is less than the number of columns required to
       write any single character in the lines being written.

       Non-printable characters, except for the <tab>, shall be written as
       implementation-defined multi-character sequences.

       If the ## flag is specified or the nnuummbbeerr edit option is set, each line
       shall be preceded by its line number in the following format:


           "%6d  ", <_l_i_n_e _n_u_m_b_e_r>

       If the ll flag is specified or the lliisstt edit option is set:

        1. The characters listed in the Base Definitions volume of
           POSIX.1-2017, _T_a_b_l_e _5_-_1, _E_s_c_a_p_e _S_e_q_u_e_n_c_e_s _a_n_d _A_s_s_o_c_i_a_t_e_d _A_c_t_i_o_n_s
           shall be written as the corresponding escape sequence.

        2. Non-printable characters not in the Base Definitions volume of
           POSIX.1-2017, _T_a_b_l_e _5_-_1, _E_s_c_a_p_e _S_e_q_u_e_n_c_e_s _a_n_d _A_s_s_o_c_i_a_t_e_d _A_c_t_i_o_n_s
           shall be written as one three-digit octal number (with a preceding
           <backslash>) for each byte in the character (most significant byte
           first).

        3. The end of each line shall be marked with a ''$$'', and literal ''$$''
           characters within the line shall be written with a preceding
           <backslash>.

       Long lines shall be folded; the length at which folding occurs is
       unspecified, but should be appropriate for the output terminal,
       considering the number of columns of the terminal.

       If a line is folded, and the ll flag is not specified and the lliisstt edit
       option is not set, it is unspecified whether a multi-column character
       at the folding position is separated; it shall not be discarded.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last written line.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged if the current line is unchanged; otherwise,
       set to non-<blank>.

   PPuutt
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] pu[[t]][[_b_u_f_f_e_r]]

       Append text from the specified buffer (by default, the unnamed buffer)
       to the specified line; line zero specifies that the text shall be
       placed at the beginning of the edit buffer. Each portion of a line in
       the buffer shall become a new line in the edit buffer, regardless of
       the mode of the buffer.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line entered into the edit buffer.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   QQuuiitt
       _S_y_n_o_p_s_i_s:

                     q[[uit]][[!]]

       If no ''!!''  is appended to the command name:

        1. If the edit buffer has been modified since the last complete write,
           it shall be an error.

        2. If there are filenames in the argument list after the filename
           currently referenced, and the last command was not a qquuiitt, wwqq, xxiitt,
           or ZZZZ (see _E_x_i_t) command, it shall be an error.

       Otherwise, terminate the editing session.

   RReeaadd
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] r[[ead]][[!]][[_f_i_l_e]]

       If ''!!''  is not the first non-<blank> to follow the command name, a copy
       of the specified file shall be appended into the edit buffer after the
       specified line; line zero specifies that the copy shall be placed at
       the beginning of the edit buffer. The number of lines and bytes read
       shall be written. If no _f_i_l_e is named, the current pathname shall be
       the default. If there is no current pathname, then _f_i_l_e shall become
       the current pathname. If there is no current pathname or _f_i_l_e operand,
       it shall be an error. Specifying a _f_i_l_e that is not of type regular
       shall have unspecified results.

       Otherwise, if _f_i_l_e is preceded by ''!!'', the rest of the line after the
       ''!!''  shall have ''%%'', ''##'', and ''!!''  characters expanded as described in
       _C_o_m_m_a_n_d _L_i_n_e _P_a_r_s_i_n_g _i_n _e_x.

       The _e_x utility shall then pass two arguments to the program named by
       the shell edit option; the first shall be --cc and the second shall be
       the expanded arguments to the rreeaadd command as a single argument. The
       standard input of the program shall be set to the standard input of the
       _e_x program when it was invoked. The standard error and standard output
       of the program shall be appended into the edit buffer after the
       specified line.

       Each line in the copied file or program output (as delimited by
       <newline> characters or the end of the file or output if it is not
       immediately preceded by a <newline>), shall be a separate line in the
       edit buffer. Any occurrences of <carriage-return> and <newline> pairs
       in the output shall be treated as single <newline> characters.

       The special meaning of the ''!!''  following the rreeaadd command can be
       overridden by escaping it with a <backslash> character.

       _C_u_r_r_e_n_t _l_i_n_e: If no lines are added to the edit buffer, unchanged.
       Otherwise, if in open or visual mode, set to the first line entered
       into the edit buffer. Otherwise, set to the last line entered into the
       edit buffer.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   RReeccoovveerr
       _S_y_n_o_p_s_i_s:

                     rec[[over]][[!]] _f_i_l_e

       If no ''!!''  is appended to the command name, and the edit buffer has
       been modified since the last complete write, it shall be an error.

       If no _f_i_l_e operand is specified, then the current pathname shall be
       used. If there is no current pathname or _f_i_l_e operand, it shall be an
       error.

       If no recovery information has previously been saved about _f_i_l_e, the
       rreeccoovveerr command shall behave identically to the eeddiitt command, and an
       informational message to this effect shall be written.

       Otherwise, set the current pathname to _f_i_l_e, and replace the current
       contents of the edit buffer with the recovered contents of _f_i_l_e.  If
       there are multiple instances of the file to be recovered, the one most
       recently saved shall be recovered, and an informational message that
       there are previous versions of the file that can be recovered shall be
       written. The editor shall behave as if the contents of the edit buffer
       have already been modified.

       _C_u_r_r_e_n_t _f_i_l_e: Set as described for the eeddiitt command.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set as described for the eeddiitt command.

   RReewwiinndd
       _S_y_n_o_p_s_i_s:

                     rew[[ind]][[!]]

       If no ''!!''  is appended to the command name, and the edit buffer has
       been modified since the last complete write, it shall be an error,
       unless the file is successfully written as specified by the aauuttoowwrriittee
       option.

       If the argument list is empty, it shall be an error.

       The current argument list reference and the current pathname shall be
       set to the first filename in the argument list.

       Replace the contents of the edit buffer with the contents of the file
       named by the current pathname. If for any reason the contents of the
       file cannot be accessed, the edit buffer shall be empty.

       This command shall be affected by the aauuttoowwrriittee and wwrriitteeaannyy edit
       options.

       _C_u_r_r_e_n_t _l_i_n_e: Set as described for the eeddiitt command.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set as described for the eeddiitt command.

   SSeett
       _S_y_n_o_p_s_i_s:

                     se[[t]][[_o_p_t_i_o_n[[=[[_v_a_l_u_e]]]] ...]][[no_o_p_t_i_o_n ...]][[_o_p_t_i_o_n? ...]][[all]]

       When no arguments are specified, write the value of the tteerrmm edit
       option and those options whose values have been changed from the
       default settings; when the argument _a_l_l is specified, write all of the
       option values.

       Giving an option name followed by the character ''??''  shall cause the
       current value of that option to be written. The ''??''  can be separated
       from the option name by zero or more <blank> characters. The ''??''  shall
       be necessary only for Boolean valued options. Boolean options can be
       given values by the form sseett _o_p_t_i_o_n to turn them on or sseett nnoo_o_p_t_i_o_n to
       turn them off; string and numeric options can be assigned by the form
       sseett _o_p_t_i_o_n=_v_a_l_u_e.  Any <blank> characters in strings can be included as
       is by preceding each <blank> with an escaping <backslash>.  More than
       one option can be set or listed by a single set command by specifying
       multiple arguments, each separated from the next by one or more <blank>
       characters.

       See _E_d_i_t _O_p_t_i_o_n_s _i_n _e_x for details about specific options.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   SShheellll
       _S_y_n_o_p_s_i_s:

                     sh[[ell]]

       Invoke the program named in the sshheellll edit option with the single
       argument --ii (interactive mode). Editing shall be resumed when the
       program exits.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   SSoouurrccee
       _S_y_n_o_p_s_i_s:

                     so[[urce]] _f_i_l_e

       Read and execute _e_x commands from _f_i_l_e.  Lines in the file that are
       blank lines shall be ignored.

       _C_u_r_r_e_n_t _l_i_n_e: As specified for the individual _e_x commands.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: As specified for the individual _e_x commands.

   SSuubbssttiittuuttee
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] s[[ubstitute]][[/_p_a_t_t_e_r_n/_r_e_p_l/[[_o_p_t_i_o_n_s]][[_c_o_u_n_t]][[_f_l_a_g_s]]]]
                     [[_2_a_d_d_r]] &[[_o_p_t_i_o_n_s]][[_c_o_u_n_t]][[_f_l_a_g_s]]]]
                     [[_2_a_d_d_r]] ~[[_o_p_t_i_o_n_s]][[_c_o_u_n_t]][[_f_l_a_g_s]]]]

       Replace the first instance of the pattern _p_a_t_t_e_r_n by the string _r_e_p_l on
       each specified line. (See _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n_s _i_n _e_x and _R_e_p_l_a_c_e_m_e_n_t
       _S_t_r_i_n_g_s _i_n _e_x.)  Any non-alphabetic, non-<blank> delimiter other than
       <backslash>, ''||'', <newline>, or double-quote can be used instead of
       ''//''.  <backslash> characters can be used to escape delimiters,
       <backslash> characters, and other special characters.

       The trailing delimiter can be omitted from _p_a_t_t_e_r_n or from _r_e_p_l at the
       end of the command line. If both _p_a_t_t_e_r_n and _r_e_p_l are not specified or
       are empty (for example, ""////""), the last ss command shall be repeated. If
       only _p_a_t_t_e_r_n is not specified or is empty, the last regular expression
       used in the editor shall be used as the pattern. If only _r_e_p_l is not
       specified or is empty, the pattern shall be replaced by nothing.  If
       the entire replacement pattern is ''%%'', the last replacement pattern to
       an ss command shall be used.

       Entering a <carriage-return> in _r_e_p_l (which requires an escaping
       <backslash> in _e_x mode and an escaping <control>-V in open or _v_i mode)
       shall split the line at that point, creating a new line in the edit
       buffer. The <carriage-return> shall be discarded.

       If _o_p_t_i_o_n_s includes the letter ''gg'' (gglloobbaall), all non-overlapping
       instances of the pattern in the line shall be replaced.

       If _o_p_t_i_o_n_s includes the letter ''cc'' (ccoonnffiirrmm), then before each
       substitution the line shall be written; the written line shall reflect
       all previous substitutions. On the following line, <space> characters
       shall be written beneath the characters from the line that are before
       the _p_a_t_t_e_r_n to be replaced, and ''^^'' characters written beneath the
       characters included in the _p_a_t_t_e_r_n to be replaced. The _e_x utility shall
       then wait for a response from the user. An affirmative response shall
       cause the substitution to be done, while any other input shall not make
       the substitution. An affirmative response shall consist of a line with
       the affirmative response (as defined by the current locale) at the
       beginning of the line. This line shall be subject to editing in the
       same way as the _e_x command line.

       If interrupted (see the ASYNCHRONOUS EVENTS section), any modifications
       confirmed by the user shall be preserved in the edit buffer after the
       interrupt.

       If the remembered search direction is not set, the ss command shall set
       it to forward.

       In the second Synopsis, the && command shall repeat the previous
       substitution, as if the && command were replaced by:


           s/_p_a_t_t_e_r_n/_r_e_p_l/

       where _p_a_t_t_e_r_n and _r_e_p_l are as specified in the previous ss, &&, or ~~
       command.

       In the third Synopsis, the ~~ command shall repeat the previous
       substitution, as if the ''~~'' were replaced by:


           s/_p_a_t_t_e_r_n/_r_e_p_l/

       where _p_a_t_t_e_r_n shall be the last regular expression specified to the
       editor, and _r_e_p_l shall be from the previous substitution (including &&
       and ~~) command.

       These commands shall be affected by the _L_C___M_E_S_S_A_G_E_S environment
       variable.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line in which a substitution occurred,
       or, unchanged if no substitution occurred.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   SSuussppeenndd
       _S_y_n_o_p_s_i_s:

                     su[[spend]][[!]]
                     st[[op]][[!]]

       Allow control to return to the invoking process; _e_x shall suspend
       itself as if it had received the SIGTSTP signal. The suspension shall
       occur only if job control is enabled in the invoking shell (see the
       description of _s_e_t --mm).

       These commands shall be affected by the aauuttoowwrriittee and wwrriitteeaannyy edit
       options.

       The current ssuusspp character (see _s_t_t_y) shall be equivalent to the
       ssuussppeenndd command.

   TTaagg
       _S_y_n_o_p_s_i_s:

                     ta[[g]][[!]] _t_a_g_s_t_r_i_n_g

       The results are unspecified if the format of a tags file is not as
       specified by the _c_t_a_g_s utility (see _c_t_a_g_s) description.

       The ttaagg command shall search for _t_a_g_s_t_r_i_n_g in the tag files referred to
       by the ttaagg edit option, in the order they are specified, until a
       reference to _t_a_g_s_t_r_i_n_g is found. Files shall be searched from beginning
       to end. If no reference is found, it shall be an error and an error
       message to this effect shall be written. If the reference is not found,
       or if an error occurs while processing a file referred to in the ttaagg
       edit option, it shall be an error, and an error message shall be
       written at the first occurrence of such an error.

       Otherwise, if the tags file contained a pattern, the pattern shall be
       treated as a regular expression used in the editor; for example, for
       the purposes of the ss command.

       If the _t_a_g_s_t_r_i_n_g is in a file with a different name than the current
       pathname, set the current pathname to the name of that file, and
       replace the contents of the edit buffer with the contents of that file.
       In this case, if no ''!!''  is appended to the command name, and the edit
       buffer has been modified since the last complete write, it shall be an
       error, unless the file is successfully written as specified by the
       aauuttoowwrriittee option.

       This command shall be affected by the aauuttoowwrriittee, ttaagg, ttaagglleennggtthh, and
       wwrriitteeaannyy edit options.

       _C_u_r_r_e_n_t _l_i_n_e: If the tags file contained a line number, set to that
       line number. If the line number is larger than the last line in the
       edit buffer, an error message shall be written and the current line
       shall be set as specified for the eeddiitt command.

       If the tags file contained a pattern, set to the first occurrence of
       the pattern in the file. If no matching pattern is found, an error
       message shall be written and the current line shall be set as specified
       for the eeddiitt command.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: If the tags file contained a line-number reference and
       that line-number was not larger than the last line in the edit buffer,
       or if the tags file contained a pattern and that pattern was found, set
       to non-<blank>.  Otherwise, set as specified for the eeddiitt command.

   UUnnaabbbbrreevviiaattee
       _S_y_n_o_p_s_i_s:

                     una[[bbrev]] _l_h_s

       If _l_h_s is not an entry in the current list of abbreviations (see
       _A_b_b_r_e_v_i_a_t_e), it shall be an error. Otherwise, delete _l_h_s from the list
       of abbreviations.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   UUnnddoo
       _S_y_n_o_p_s_i_s:

                     u[[ndo]]

       Reverse the changes made by the last command that modified the contents
       of the edit buffer, including uunnddoo.  For this purpose, the gglloobbaall, vv,
       ooppeenn, and vviissuuaall commands, and commands resulting from buffer
       executions and mapped character expansions, are considered single
       commands.

       If no action that can be undone preceded the uunnddoo command, it shall be
       an error.

       If the uunnddoo command restores lines that were marked, the mark shall
       also be restored unless it was reset subsequent to the deletion of the
       lines.

       _C_u_r_r_e_n_t _l_i_n_e:

        1. If lines are added or changed in the file, set to the first line
           added or changed.

        2. Set to the line before the first line deleted, if it exists.

        3. Set to 1 if the edit buffer is not empty.

        4. Set to zero.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   UUnnmmaapp
       _S_y_n_o_p_s_i_s:

                     unm[[ap]][[!]] _l_h_s

       If ''!!''  is appended to the command name, and if _l_h_s is not an entry in
       the list of text input mode map definitions, it shall be an error.
       Otherwise, delete _l_h_s from the list of text input mode map definitions.

       If no ''!!''  is appended to the command name, and if _l_h_s is not an entry
       in the list of command mode map definitions, it shall be an error.
       Otherwise, delete _l_h_s from the list of command mode map definitions.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   VVeerrssiioonn
       _S_y_n_o_p_s_i_s:

                     ve[[rsion]]

       Write a message containing version information for the editor. The
       format of the message is unspecified.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   VViissuuaall
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] vi[[sual]][[_t_y_p_e]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       If _e_x is currently in open or visual mode, the Synopsis and behavior of
       the visual command shall be the same as the eeddiitt command, as specified
       by _E_d_i_t.

       Otherwise, this command need not be supported on block-mode terminals
       or terminals with insufficient capabilities. If standard input,
       standard output, or standard error are not terminal devices, the
       results are unspecified.

       If _c_o_u_n_t is specified, the value of the wwiinnddooww edit option shall be set
       to _c_o_u_n_t (as described in _w_i_n_d_o_w).  If the ''^^'' type character was also
       specified, the wwiinnddooww edit option shall be set before being used by the
       type character.

       Enter visual mode. If _t_y_p_e is not specified, it shall be as if a _t_y_p_e
       of ''++'' was specified. The _t_y_p_e shall cause the following effects:

       +     Place the beginning of the specified line at the top of the
             display.

       -     Place the end of the specified line at the bottom of the display.

       .     Place the beginning of the specified line in the middle of the
             display.

       ^     If the specified line is less than or equal to the value of the
             wwiinnddooww edit option, set the line to 1; otherwise, decrement the
             line by the value of the wwiinnddooww edit option minus 1. Place the
             beginning of this line as close to the bottom of the displayed
             lines as possible, while still displaying the value of the wwiinnddooww
             edit option number of lines.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the specified line.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   WWrriittee
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] w[[rite]][[!]][[>>]][[_f_i_l_e]]
                     [[_2_a_d_d_r]] w[[rite]][[!]][[_f_i_l_e]]
                     [[_2_a_d_d_r]] wq[[!]][[>>]][[_f_i_l_e]]

       If no lines are specified, the lines shall default to the entire file.

       The command wwqq shall be equivalent to a wwrriittee command followed by a
       qquuiitt command; wwqq!!  shall be equivalent to wwrriittee!!  followed by qquuiitt.  In
       both cases, if the wwrriittee command fails, the qquuiitt shall not be
       attempted.

       If the command name is not followed by one or more <blank> characters,
       or _f_i_l_e is not preceded by a ''!!''  character, the wwrriittee shall be to a
       file.

        1. If the >>>> argument is specified, and the file already exists, the
           lines shall be appended to the file instead of replacing its
           contents. If the >>>> argument is specified, and the file does not
           already exist, it is unspecified whether the write shall proceed as
           if the >>>> argument had not been specified or if the write shall
           fail.

        2. If the rreeaaddoonnllyy edit option is set (see _r_e_a_d_o_n_l_y), the wwrriittee shall
           fail.

        3. If _f_i_l_e is specified, and is not the current pathname, and the file
           exists, the wwrriittee shall fail.

        4. If _f_i_l_e is not specified, the current pathname shall be used. If
           there is no current pathname, the wwrriittee command shall fail.

        5. If the current pathname is used, and the current pathname has been
           changed by the ffiillee or rreeaadd commands, and the file exists, the
           wwrriittee shall fail. If the wwrriittee is successful, subsequent wwrriittees
           shall not fail for this reason (unless the current pathname is
           changed again).

        6. If the whole edit buffer is not being written, and the file to be
           written exists, the wwrriittee shall fail.

       For rules 1., 2., 3., and 5., the wwrriittee can be forced by appending the
       character ''!!''  to the command name.

       For rules 2., 3., and 5., the wwrriittee can be forced by setting the
       wwrriitteeaannyy edit option.

       Additional, implementation-defined tests may cause the wwrriittee to fail.

       If the edit buffer is empty, a file without any contents shall be
       written.

       An informational message shall be written noting the number of lines
       and bytes written.

       Otherwise, if the command is followed by one or more <blank>
       characters, and the file is preceded by ''!!'', the rest of the line after
       the ''!!''  shall have ''%%'', ''##'', and ''!!''  characters expanded as described
       in _C_o_m_m_a_n_d _L_i_n_e _P_a_r_s_i_n_g _i_n _e_x.

       The _e_x utility shall then pass two arguments to the program named by
       the sshheellll edit option; the first shall be --cc and the second shall be
       the expanded arguments to the wwrriittee command as a single argument. The
       specified lines shall be written to the standard input of the command.
       The standard error and standard output of the program, if any, shall be
       written as described for the pprriinntt command. If the last character in
       that output is not a <newline>, a <newline> shall be written at the end
       of the output.

       The special meaning of the ''!!''  following the wwrriittee command can be
       overridden by escaping it with a <backslash> character.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   WWrriittee aanndd EExxiitt
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] x[[it]][[!]][[_f_i_l_e]]

       If the edit buffer has not been modified since the last complete wwrriittee,
       xxiitt shall be equivalent to the qquuiitt command, or if a ''!!''  is appended
       to the command name, to qquuiitt!!.

       Otherwise, xxiitt shall be equivalent to the wwqq command, or if a ''!!''  is
       appended to the command name, to wwqq!!.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   YYaannkk
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] ya[[nk]][[_b_u_f_f_e_r]][[_c_o_u_n_t]]

       Copy the specified lines to the specified buffer (by default, the
       unnamed buffer), which shall become a line-mode buffer.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   AAddjjuusstt WWiinnddooww
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] z[[!]][[_t_y_p_e ...]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       If no line is specified, the current line shall be the default; if _t_y_p_e
       is omitted as well, the current line value shall first be incremented
       by 1. If incrementing the current line would cause it to be greater
       than the last line in the edit buffer, it shall be an error.

       If there are <blank> characters between the _t_y_p_e argument and the
       preceding zz command name or optional ''!!''  character, it shall be an
       error.

       If _c_o_u_n_t is specified, the value of the wwiinnddooww edit option shall be set
       to _c_o_u_n_t (as described in _w_i_n_d_o_w).  If _c_o_u_n_t is omitted, it shall
       default to 2 times the value of the ssccrroollll edit option, or if !!  was
       specified, the number of lines in the display minus 1.

       If _t_y_p_e is omitted, then _c_o_u_n_t lines starting with the specified line
       shall be written. Otherwise, _c_o_u_n_t lines starting with the line
       specified by the _t_y_p_e argument shall be written.

       The _t_y_p_e argument shall change the lines to be written. The possible
       values of _t_y_p_e are as follows:

       -     The specified line shall be decremented by the following value:


                 (((number of '-' characters) x _c_o_u_n_t) -1)

             If the calculation would result in a number less than 1, it shall
             be an error. Write lines from the edit buffer, starting at the
             new value of line, until _c_o_u_n_t lines or the last line in the edit
             buffer has been written.

       +     The specified line shall be incremented by the following value:


                 (((number of '+' characters) -1) x _c_o_u_n_t) +1

             If the calculation would result in a number greater than the last
             line in the edit buffer, it shall be an error. Write lines from
             the edit buffer, starting at the new value of line, until _c_o_u_n_t
             lines or the last line in the edit buffer has been written.

       =,.   If more than a single ''..''  or ''=='' is specified, it shall be an
             error. The following steps shall be taken:

              1. If _c_o_u_n_t is zero, nothing shall be written.

              2. Write as many of the _N lines before the current line in the
                 edit buffer as exist. If _c_o_u_n_t or ''!!''  was specified, _N shall
                 be:


                     (_c_o_u_n_t -1) /2

                 Otherwise, _N shall be:


                     (_c_o_u_n_t -3) /2

                 If _N is a number less than 3, no lines shall be written.

              3. If ''=='' was specified as the type character, write a line
                 consisting of the smaller of the number of columns in the
                 display divided by two, or 40 ''--'' characters.

              4. Write the current line.

              5. Repeat step 3.

              6. Write as many of the _N lines after the current line in the
                 edit buffer as exist.  _N shall be defined as in step 2. If _N
                 is a number less than 3, no lines shall be written. If _c_o_u_n_t
                 is less than 3, no lines shall be written.

       ^     The specified line shall be decremented by the following value:


                 (((number of '^' characters) +1) x _c_o_u_n_t) -1

             If the calculation would result in a number less than 1, it shall
             be an error. Write lines from the edit buffer, starting at the
             new value of line, until _c_o_u_n_t lines or the last line in the edit
             buffer has been written.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line written, unless the type is ==, in
       which case, set to the specified line.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   EEssccaappee
       _S_y_n_o_p_s_i_s:

                     ! _c_o_m_m_a_n_d
                     [[_a_d_d_r]]! _c_o_m_m_a_n_d

       The contents of the line after the ''!!''  shall have ''%%'', ''##'', and ''!!''
       characters expanded as described in _C_o_m_m_a_n_d _L_i_n_e _P_a_r_s_i_n_g _i_n _e_x.  If the
       expansion causes the text of the line to change, it shall be
       redisplayed, preceded by a single ''!!''  character.

       The _e_x utility shall execute the program named by the sshheellll edit
       option. It shall pass two arguments to the program; the first shall be
       --cc, and the second shall be the expanded arguments to the !!  command as
       a single argument.

       If no lines are specified, the standard input, standard output, and
       standard error of the program shall be set to the standard input,
       standard output, and standard error of the _e_x program when it was
       invoked. In addition, a warning message shall be written if the edit
       buffer has been modified since the last complete write, and the wwaarrnn
       edit option is set.

       If lines are specified, they shall be passed to the program as standard
       input, and the standard output and standard error of the program shall
       replace those lines in the edit buffer. Each line in the program output
       (as delimited by <newline> characters or the end of the output if it is
       not immediately preceded by a <newline>), shall be a separate line in
       the edit buffer. Any occurrences of <carriage-return> and <newline>
       pairs in the output shall be treated as single <newline> characters.
       The specified lines shall be copied into the unnamed buffer before they
       are replaced, and the unnamed buffer shall become a line-mode buffer.

       If in _e_x mode, a single ''!!''  character shall be written when the
       program completes.

       This command shall be affected by the sshheellll and wwaarrnn edit options. If
       no lines are specified, this command shall be affected by the aauuttoowwrriittee
       and wwrriitteeaannyy edit options. If lines are specified, this command shall
       be affected by the aauuttoopprriinntt edit option.

       _C_u_r_r_e_n_t _l_i_n_e:

        1. If no lines are specified, unchanged.

        2. Otherwise, set to the last line read in, if any lines are read in.

        3. Otherwise, set to the line before the first line of the lines
           specified, if that line exists.

        4. Otherwise, set to the first line of the edit buffer if the edit
           buffer is not empty.

        5. Otherwise, set to zero.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: If no lines are specified, unchanged. Otherwise, set to
       non-<blank>.

   SShhiifftt LLeefftt
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] <[[< ...]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       Shift the specified lines to the start of the line; the number of
       column positions to be shifted shall be the number of command
       characters times the value of the sshhiiffttwwiiddtthh edit option. Only leading
       <blank> characters shall be deleted or changed into other <blank>
       characters in shifting; other characters shall not be affected.

       Lines to be shifted shall be copied into the unnamed buffer, which
       shall become a line-mode buffer.

       This command shall be affected by the aauuttoopprriinntt edit option.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line in the lines specified.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   SShhiifftt RRiigghhtt
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] >[[> ...]][[_c_o_u_n_t]][[_f_l_a_g_s]]

       Shift the specified lines away from the start of the line; the number
       of column positions to be shifted shall be the number of command
       characters times the value of the sshhiiffttwwiiddtthh edit option. The shift
       shall be accomplished by adding <blank> characters as a prefix to the
       line or changing leading <blank> characters into other <blank>
       characters. Empty lines shall not be changed.

       Lines to be shifted shall be copied into the unnamed buffer, which
       shall become a line-mode buffer.

       This command shall be affected by the aauuttoopprriinntt edit option.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line in the lines specified.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   <<ccoonnttrrooll>>--DD
       _S_y_n_o_p_s_i_s:

                     <control>-D

       Write the next _n lines, where _n is the minimum of the values of the
       ssccrroollll edit option and the number of lines after the current line in
       the edit buffer. If the current line is the last line of the edit
       buffer it shall be an error.

       _C_u_r_r_e_n_t _l_i_n_e: Set to the last line written.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Set to non-<blank>.

   WWrriittee LLiinnee NNuummbbeerr
       _S_y_n_o_p_s_i_s:

                     [[_1_a_d_d_r]] = [[_f_l_a_g_s]]

       If _l_i_n_e is not specified, it shall default to the last line in the edit
       buffer.  Write the line number of the specified line.

       _C_u_r_r_e_n_t _l_i_n_e: Unchanged.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: Unchanged.

   EExxeeccuuttee
       _S_y_n_o_p_s_i_s:

                     [[_2_a_d_d_r]] @ _b_u_f_f_e_r
                     [[_2_a_d_d_r]] * _b_u_f_f_e_r

       If no buffer is specified or is specified as ''@@'' or ''**'', the last
       buffer executed shall be used. If no previous buffer has been executed,
       it shall be an error.

       For each line specified by the addresses, set the current line (''..'')
       to the specified line, and execute the contents of the named _b_u_f_f_e_r (as
       they were at the time the @@ command was executed) as _e_x commands. For
       each line of a line-mode buffer, and all but the last line of a
       character-mode buffer, the _e_x command parser shall behave as if the
       line was terminated by a <newline>.

       If an error occurs during this process, or a line specified by the
       addresses does not exist when the current line would be set to it, or
       more than a single line was specified by the addresses, and the
       contents of the edit buffer are replaced (for example, by the _e_x ::eeddiitt
       command) an error message shall be written, and no more commands
       resulting from the execution of this command shall be processed.

       _C_u_r_r_e_n_t _l_i_n_e: As specified for the individual _e_x commands.

       _C_u_r_r_e_n_t _c_o_l_u_m_n: As specified for the individual _e_x commands.

   RReegguullaarr EExxpprreessssiioonnss iinn eexx
       The _e_x utility shall support regular expressions that are a superset of
       the basic regular expressions described in the Base Definitions volume
       of POSIX.1-2017, _S_e_c_t_i_o_n _9_._3, _B_a_s_i_c _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n_s.  A null
       regular expression (""////"") shall be equivalent to the last regular
       expression encountered.

       Regular expressions can be used in addresses to specify lines and, in
       some commands (for example, the ssuubbssttiittuuttee command), to specify
       portions of a line to be substituted.

       The following constructs can be used to enhance the basic regular
       expressions:

       \<    Match the beginning of a _w_o_r_d.  (See the definition of _w_o_r_d at
             the beginning of _C_o_m_m_a_n_d _D_e_s_c_r_i_p_t_i_o_n_s _i_n _e_x.)

       \>    Match the end of a _w_o_r_d.

       ~     Match the replacement part of the last ssuubbssttiittuuttee command. The
             <tilde> (''~~'') character can be escaped in a regular expression to
             become a normal character with no special meaning. The
             <backslash> shall be discarded.

       When the editor option mmaaggiicc is not set, the only characters with
       special meanings shall be ''^^'' at the beginning of a pattern, ''$$'' at the
       end of a pattern, and <backslash>.  The characters ''..'', ''**'', ''[['', and
       ''~~'' shall be treated as ordinary characters unless preceded by a
       <backslash>; when preceded by a <backslash> they shall regain their
       special meaning, or in the case of <backslash>, be handled as a single
       <backslash>.  <backslash> characters used to escape other characters
       shall be discarded.

   RReeppllaacceemmeenntt SSttrriinnggss iinn eexx
       The character ''&&'' (''\\&&'' if the editor option mmaaggiicc is not set) in the
       replacement string shall stand for the text matched by the pattern to
       be replaced. The character ''~~'' (''\\~~'' if mmaaggiicc is not set) shall be
       replaced by the replacement part of the previous ssuubbssttiittuuttee command.
       The sequence ''\\nn'', where _n is an integer, shall be replaced by the text
       matched by the corresponding back-reference expression. If the
       corresponding back-reference expression does not match, then the
       characters ''\\nn'' shall be replaced by the empty string.

       The strings ''\\ll'', ''\\uu'', ''\\LL'', and ''\\UU'' can be used to modify the case
       of elements in the replacement string (using the ''\\&&'' or ""\\""digit)
       notation. The string ''\\ll'' (''\\uu'') shall cause the character that follows
       to be converted to lowercase (uppercase). The string ''\\LL'' (''\\UU'') shall
       cause all characters subsequent to it to be converted to lowercase
       (uppercase) as they are inserted by the substitution until the string
       ''\\ee'' or ''\\EE'', or the end of the replacement string, is encountered.

       Otherwise, any character following a <backslash> shall be treated as
       that literal character, and the escaping <backslash> shall be
       discarded.

       An example of case conversion with the ss command is as follows:


           ::p
           TThhee ccaatt ssaatt oonn tthhee mmaatt..
           ::s/\<.at\>/\u&/gp
           TThhee CCaatt SSaatt oonn tthhee MMaatt..
           ::s/S\(.*\)M/S\U\1\eM/p
           TThhee CCaatt SSAATT OONN TTHHEE MMaatt..

   EEddiitt OOppttiioonnss iinn eexx
       The _e_x utility has a number of options that modify its behavior. These
       options have default settings, which can be changed using the sseett
       command.

       Options are Boolean unless otherwise specified.

   aauuttooiinnddeenntt,, aaii
       [Default _u_n_s_e_t]

       If aauuttooiinnddeenntt is set, each line in input mode shall be indented (using
       first as many <tab> characters as possible, as determined by the editor
       option ttaabbssttoopp, and then using <space> characters) to align with
       another line, as follows:

        1. If in open or visual mode and the text input is part of a line-
           oriented command (see the EXTENDED DESCRIPTION in _v_i), align to the
           first column.

        2. Otherwise, if in open or visual mode, indentation for each line
           shall be set as follows:

            a. If a line was previously inserted as part of this command, it
               shall be set to the indentation of the last inserted line by
               default, or as otherwise specified for the <control>-D
               character in _I_n_p_u_t _M_o_d_e _C_o_m_m_a_n_d_s _i_n _v_i.

            b. Otherwise, it shall be set to the indentation of the previous
               current line, if any; otherwise, to the first column.

        3. For the _e_x aa, ii, and cc commands, indentation for each line shall be
           set as follows:

            a. If a line was previously inserted as part of this command, it
               shall be set to the indentation of the last inserted line by
               default, or as otherwise specified for the _e_o_f character in
               _S_c_r_o_l_l.

            b. Otherwise, if the command is the _e_x aa command, it shall be set
               to the line appended after, if any; otherwise to the first
               column.

            c. Otherwise, if the command is the _e_x ii command, it shall be set
               to the line inserted before, if any; otherwise to the first
               column.

            d. Otherwise, if the command is the _e_x cc command, it shall be set
               to the indentation of the line replaced.

   aauuttoopprriinntt,, aapp
       [Default _s_e_t]

       If aauuttoopprriinntt is set, the current line shall be written after each _e_x
       command that modifies the contents of the current edit buffer, and
       after each ttaagg command for which the tag search pattern was found or
       tag line number was valid, unless:

        1. The command was executed while in open or visual mode.

        2. The command was executed as part of a gglloobbaall or vv command or @@
           buffer execution.

        3. The command was the form of the rreeaadd command that reads a file into
           the edit buffer.

        4. The command was the aappppeenndd, cchhaannggee, or iinnsseerrtt command.

        5. The command was not terminated by a <newline>.

        6. The current line shall be written by a flag specified to the
           command; for example, ddeelleettee ## shall write the current line as
           specified for the flag modifier to the ddeelleettee command, and not as
           specified by the aauuttoopprriinntt edit option.

   aauuttoowwrriittee,, aaww
       [Default _u_n_s_e_t]

       If aauuttoowwrriittee is set, and the edit buffer has been modified since it was
       last completely written to any file, the contents of the edit buffer
       shall be written as if the _e_x wwrriittee command had been specified without
       arguments, before each command affected by the aauuttoowwrriittee edit option is
       executed. Appending the character ''!!''  to the command name of any of
       the _e_x commands except ''!!''  shall prevent the write. If the write
       fails, it shall be an error and the command shall not be executed.

   bbeeaauuttiiffyy,, bbff
       [Default _u_n_s_e_t]

       If bbeeaauuttiiffyy is set, all non-printable characters, other than <tab>,
       <newline>, and <form-feed> characters, shall be discarded from text
       read in from files.

   ddiirreeccttoorryy,, ddiirr
       [Default _i_m_p_l_e_m_e_n_t_a_t_i_o_n_-_d_e_f_i_n_e_d]

       The value of this option specifies the directory in which the editor
       buffer is to be placed. If this directory is not writable by the user,
       the editor shall quit.

   eeddccoommppaattiibbllee,, eedd
       [Default _u_n_s_e_t]

       Causes the presence of gg and cc suffixes on substitute commands to be
       remembered, and toggled by repeating the suffixes.

   eerrrroorrbbeellllss,, eebb
       [Default _u_n_s_e_t]

       If the editor is in _e_x mode, and the terminal does not support a
       standout mode (such as inverse video), and eerrrroorrbbeellllss is set, error
       messages shall be preceded by alerting the terminal.

   eexxrrcc
       [Default _u_n_s_e_t]

       If eexxrrcc is set, _e_x shall access any ..eexxrrcc file in the current
       directory, as described in _I_n_i_t_i_a_l_i_z_a_t_i_o_n _i_n _e_x _a_n_d _v_i.  If eexxrrcc is not
       set, _e_x shall ignore any ..eexxrrcc file in the current directory during
       initialization, unless the current directory is that named by the _H_O_M_E
       environment variable.

   iiggnnoorreeccaassee,, iicc
       [Default _u_n_s_e_t]

       If iiggnnoorreeccaassee is set, characters that have uppercase and lowercase
       representations shall have those representations considered as
       equivalent for purposes of regular expression comparison.

       The iiggnnoorreeccaassee edit option shall affect all remembered regular
       expressions; for example, unsetting the iiggnnoorreeccaassee edit option shall
       cause a subsequent _v_i nn command to search for the last basic regular
       expression in a case-sensitive fashion.

   lliisstt
       [Default _u_n_s_e_t]

       If lliisstt is set, edit buffer lines written while in _e_x command mode
       shall be written as specified for the pprriinntt command with the ll flag
       specified. In open or visual mode, each edit buffer line shall be
       displayed as specified for the _e_x pprriinntt command with the ll flag
       specified. In open or visual text input mode, when the cursor does not
       rest on any character in the line, it shall rest on the ''$$'' marking the
       end of the line.

   mmaaggiicc
       [Default _s_e_t]

       If mmaaggiicc is set, modify the interpretation of characters in regular
       expressions and substitution replacement strings (see _R_e_g_u_l_a_r
       _E_x_p_r_e_s_s_i_o_n_s _i_n _e_x and _R_e_p_l_a_c_e_m_e_n_t _S_t_r_i_n_g_s _i_n _e_x).

   mmeessgg
       [Default _s_e_t]

       If mmeessgg is set, the permission for others to use the wwrriittee or ttaallkk
       commands to write to the terminal shall be turned on while in open or
       visual mode. The shell-level command _m_e_s_g nn shall take precedence over
       any setting of the _e_x mmeessgg option; that is, if mmeessgg yy was issued before
       the editor started (or in a shell escape), such as:


           :!mesg y

       the mmeessgg option in _e_x shall suppress incoming messages, but the mmeessgg
       option shall not enable incoming messages if mmeessgg nn was issued.

   nnuummbbeerr,, nnuu
       [Default _u_n_s_e_t]

       If nnuummbbeerr is set, edit buffer lines written while in _e_x command mode
       shall be written with line numbers, in the format specified by the
       pprriinntt command with the ## flag specified. In _e_x text input mode, each
       line shall be preceded by the line number it will have in the file.

       In open or visual mode, each edit buffer line shall be displayed with a
       preceding line number, in the format specified by the _e_x pprriinntt command
       with the ## flag specified. This line number shall not be considered
       part of the line for the purposes of evaluating the current column;
       that is, column position 1 shall be the first column position after the
       format specified by the pprriinntt command.

   ppaarraaggrraapphhss,, ppaarraa
       [Default in the POSIX locale IPLPPPQPP LIpplpipbp]

       The ppaarraaggrraapphhss edit option shall define additional paragraph boundaries
       for the open and visual mode commands. The ppaarraaggrraapphhss edit option can
       be set to a character string consisting of zero or more character
       pairs. It shall be an error to set it to an odd number of characters.

   pprroommpptt
       [Default _s_e_t]

       If pprroommpptt is set, _e_x command mode input shall be prompted for with a
       <colon> (''::''); when unset, no prompt shall be written.

   rreeaaddoonnllyy
       [Default _s_e_e _t_e_x_t]

       If the rreeaaddoonnllyy edit option is set, read-only mode shall be enabled
       (see _W_r_i_t_e).  The rreeaaddoonnllyy edit option shall be initialized to set if
       either of the following conditions are true:

        *  The command-line option -R was specified.

        *  Performing actions equivalent to the _a_c_c_e_s_s() function called with
           the following arguments indicates that the file lacks write
           permission:

            1. The current pathname is used as the _p_a_t_h argument.

            2. The constant WW__OOKK is used as the _a_m_o_d_e argument.

       The rreeaaddoonnllyy edit option may be initialized to set for other,
       implementation-defined reasons. The rreeaaddoonnllyy edit option shall not be
       initialized to unset based on any special privileges of the user or
       process. The rreeaaddoonnllyy edit option shall be reinitialized each time that
       the contents of the edit buffer are replaced (for example, by an eeddiitt
       or nneexxtt command) unless the user has explicitly set it, in which case
       it shall remain set until the user explicitly unsets it. Once unset, it
       shall again be reinitialized each time that the contents of the edit
       buffer are replaced.

   rreeddrraaww
       [Default _u_n_s_e_t]

       The editor simulates an intelligent terminal on a dumb terminal.
       (Since this is likely to require a large amount of output to the
       terminal, it is useful only at high transmission speeds.)

   rreemmaapp
       [Default _s_e_t]

       If rreemmaapp is set, map translation shall allow for maps defined in terms
       of other maps; translation shall continue until a final product is
       obtained. If unset, only a one-step translation shall be done.

   rreeppoorrtt
       [Default 5]

       The value of this rreeppoorrtt edit option specifies what number of lines
       being added, copied, deleted, or modified in the edit buffer will cause
       an informational message to be written to the user. The following
       conditions shall cause an informational message. The message shall
       contain the number of lines added, copied, deleted, or modified, but is
       otherwise unspecified.

        *  An _e_x or _v_i editor command, other than ooppeenn, uunnddoo, or vviissuuaall, that
           modifies at least the value of the rreeppoorrtt edit option number of
           lines, and which is not part of an _e_x gglloobbaall or vv command, or _e_x or
           _v_i buffer execution, shall cause an informational message to be
           written.

        *  An _e_x yyaannkk or _v_i yy or YY command, that copies at least the value of
           the rreeppoorrtt edit option plus 1 number of lines, and which is not
           part of an _e_x gglloobbaall or vv command, or _e_x or _v_i buffer execution,
           shall cause an informational message to be written.

        *  An _e_x gglloobbaall, vv, ooppeenn, uunnddoo, or vviissuuaall command or _e_x or _v_i buffer
           execution, that adds or deletes a total of at least the value of
           the rreeppoorrtt edit option number of lines, and which is not part of an
           _e_x gglloobbaall or vv command, or _e_x or _v_i buffer execution, shall cause
           an informational message to be written.  (For example, if 3 lines
           were added and 8 lines deleted during an _e_x vviissuuaall command, 5 would
           be the number compared against the rreeppoorrtt edit option after the
           command completed.)

   ssccrroollll,, ssccrr
       [Default (number of lines in the display -1)/2]

       The value of the ssccrroollll edit option shall determine the number of lines
       scrolled by the _e_x <control>-D and zz commands. For the _v_i <control>-D
       and <control>-U commands, it shall be the initial number of lines to
       scroll when no previous <control>-D or <control>-U command has been
       executed.

   sseeccttiioonnss
       [Default in the POSIX locale NHSHH HUnhsh]

       The sseeccttiioonnss edit option shall define additional section boundaries for
       the open and visual mode commands. The sseeccttiioonnss edit option can be set
       to a character string consisting of zero or more character pairs; it
       shall be an error to set it to an odd number of characters.

   sshheellll,, sshh
       [Default from the environment variable _S_H_E_L_L]

       The value of this option shall be a string. The default shall be taken
       from the _S_H_E_L_L environment variable. If the _S_H_E_L_L environment variable
       is null or empty, the _s_h (see _s_h) utility shall be the default.

   sshhiiffttwwiiddtthh,, ssww
       [Default 8]

       The value of this option shall give the width in columns of an
       indentation level used during autoindentation and by the shift commands
       (<< and >>).

   sshhoowwmmaattcchh,, ssmm
       [Default _u_n_s_e_t]

       The functionality described for the sshhoowwmmaattcchh edit option need not be
       supported on block-mode terminals or terminals with insufficient
       capabilities.

       If sshhoowwmmaattcchh is set, in open or visual mode, when a ''))'' or ''}}'' is
       typed, if the matching ''(('' or ''{{'' is currently visible on the display,
       the matching ''(('' or ''{{'' shall be flagged moving the cursor to its
       location for an unspecified amount of time.

   sshhoowwmmooddee
       [Default _u_n_s_e_t]

       If sshhoowwmmooddee is set, in open or visual mode, the current mode that the
       editor is in shall be displayed on the last line of the display.
       Command mode and text input mode shall be differentiated; other
       unspecified modes and implementation-defined information may be
       displayed.

   sslloowwooppeenn
       [Default _u_n_s_e_t]

       If sslloowwooppeenn is set during open and visual text input modes, the editor
       shall not update portions of the display other than those display line
       columns that display the characters entered by the user (see _I_n_p_u_t _M_o_d_e
       _C_o_m_m_a_n_d_s _i_n _v_i).

   ttaabbssttoopp,, ttss
       [Default 8]

       The value of this edit option shall specify the column boundary used by
       a <tab> in the display (see _a_u_t_o_p_r_i_n_t, _a_p and _I_n_p_u_t _M_o_d_e _C_o_m_m_a_n_d_s _i_n
       _v_i).

   ttaagglleennggtthh,, ttll
       [Default zero]

       The value of this edit option shall specify the maximum number of
       characters that are considered significant in the user-specified tag
       name and in the tag name from the tags file. If the value is zero, all
       characters in both tag names shall be significant.

   ttaaggss
       [Default _s_e_e _t_e_x_t]

       The value of this edit option shall be a string of <blank>-delimited
       pathnames of files used by the ttaagg command. The default value is
       unspecified.

   tteerrmm
       [Default from the environment variable _T_E_R_M]

       The value of this edit option shall be a string. The default shall be
       taken from the _T_E_R_M variable in the environment. If the _T_E_R_M
       environment variable is empty or null, the default is unspecified. The
       editor shall use the value of this edit option to determine the type of
       the display device.

       The results are unspecified if the user changes the value of the term
       edit option after editor initialization.

   tteerrssee
       [Default _u_n_s_e_t]

       If tteerrssee is set, error messages may be less verbose. However, except
       for this caveat, error messages are unspecified. Furthermore, not all
       error messages need change for different settings of this option.

   wwaarrnn
       [Default _s_e_t]

       If wwaarrnn is set, and the contents of the edit buffer have been modified
       since they were last completely written, the editor shall write a
       warning message before certain !!  commands (see _E_s_c_a_p_e).

   wwiinnddooww
       [Default _s_e_e _t_e_x_t]

       A value used in open and visual mode, by the <control>-B and
       <control>-F commands, and, in visual mode, to specify the number of
       lines displayed when the screen is repainted.

       If the --ww command-line option is not specified, the default value shall
       be set to the value of the _L_I_N_E_S environment variable. If the _L_I_N_E_S
       environment variable is empty or null, the default shall be the number
       of lines in the display minus 1.

       Setting the wwiinnddooww edit option to zero or to a value greater than the
       number of lines in the display minus 1 (either explicitly or based on
       the --ww option or the _L_I_N_E_S environment variable) shall cause the wwiinnddooww
       edit option to be set to the number of lines in the display minus 1.

       The baud rate of the terminal line may change the default in an
       implementation-defined manner.

   wwrraappmmaarrggiinn,, wwmm
       [Default 0]

       If the value of this edit option is zero, it shall have no effect.

       If not in the POSIX locale, the effect of this edit option is
       implementation-defined.

       Otherwise, it shall specify a number of columns from the ending margin
       of the terminal.

       During open and visual text input modes, for each character for which
       any part of the character is displayed in a column that is less than
       wwrraappmmaarrggiinn columns from the ending margin of the display line, the
       editor shall behave as follows:

        1. If the character triggering this event is a <blank>, it, and all
           immediately preceding <blank> characters on the current line
           entered during the execution of the current text input command,
           shall be discarded, and the editor shall behave as if the user had
           entered a single <newline> instead. In addition, if the next user-
           entered character is a <space>, it shall be discarded as well.

        2. Otherwise, if there are one or more <blank> characters on the
           current line immediately preceding the last group of inserted
           non-<blank> characters which was entered during the execution of
           the current text input command, the <blank> characters shall be
           replaced as if the user had entered a single <newline> instead.

       If the aauuttooiinnddeenntt edit option is set, and the events described in 1. or
       2. are performed, any <blank> characters at or after the cursor in the
       current line shall be discarded.

       The ending margin shall be determined by the system or overridden by
       the user, as described for _C_O_L_U_M_N_S in the ENVIRONMENT VARIABLES section
       and the Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s.

   wwrraappssccaann,, wwss
       [Default _s_e_t]

       If wwrraappssccaann is set, searches (the _e_x // or ??  addresses, or open and
       visual mode //, ??, NN, and nn commands) shall wrap around the beginning or
       end of the edit buffer; when unset, searches shall stop at the
       beginning or end of the edit buffer.

   wwrriitteeaannyy,, wwaa
       [Default _u_n_s_e_t]

       If wwrriitteeaannyy is set, some of the checks performed when executing the _e_x
       wwrriittee commands shall be inhibited, as described in editor option
       aauuttoowwrriittee.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       When any error is encountered and the standard input is not a terminal
       device file, _e_x shall not write the file or return to command or text
       input mode, and shall terminate with a non-zero exit status.

       Otherwise, when an unrecoverable error is encountered, it shall be
       equivalent to a SIGHUP asynchronous event.

       Otherwise, when an error is encountered, the editor shall behave as
       specified in _C_o_m_m_a_n_d _L_i_n_e _P_a_r_s_i_n_g _i_n _e_x.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       If a SIGSEGV signal is received while _e_x is saving a file, the file
       might not be successfully saved.

       The nneexxtt command can accept more than one file, so usage such as:


           next `ls [abc]*`

       is valid; it would not be valid for the eeddiitt or rreeaadd commands, for
       example, because they expect only one file and unspecified results
       occur.

EEXXAAMMPPLLEESS
       None.

RRAATTIIOONNAALLEE
       The _e_x/_v_i specification is based on the historical practice found in
       the 4 BSD and System V implementations of _e_x and _v_i.

       A _r_e_s_t_r_i_c_t_e_d _e_d_i_t_o_r (both the historical _r_e_d utility and modifications
       to _e_x) were considered and rejected for inclusion. Neither option
       provided the level of security that users might expect.

       It is recognized that _e_x visual mode and related features would be
       difficult, if not impossible, to implement satisfactorily on a block-
       mode terminal, or a terminal without any form of cursor addressing;
       thus, it is not a mandatory requirement that such features should work
       on all terminals. It is the intention, however, that an _e_x
       implementation should provide the full set of capabilities on all
       terminals capable of supporting them.

   OOppttiioonnss
       The --cc replacement for ++_c_o_m_m_a_n_d was inspired by the --ee option of _s_e_d.
       Historically, all such commands (see eeddiitt and nneexxtt as well) were
       executed from the last line of the edit buffer. This meant, for
       example, that ""++//ppaatttteerrnn"" would fail unless the wwrraappssccaann option was
       set. POSIX.1-2008 requires conformance to historical practice. The
       ++_c_o_m_m_a_n_d option is no longer specified by POSIX.1-2008 but may be
       present in some implementations. Historically, some implementations
       restricted the _e_x commands that could be listed as part of the command
       line arguments.  For consistency, POSIX.1-2008 does not permit these
       restrictions.

       In historical implementations of the editor, the --RR option (and the
       rreeaaddoonnllyy edit option) only prevented overwriting of files; appending to
       files was still permitted, mapping loosely into the _c_s_h nnoocclloobbbbeerr
       variable. Some implementations, however, have not followed this
       semantic, and rreeaaddoonnllyy does not permit appending either. POSIX.1-2008
       follows the latter practice, believing that it is a more obvious and
       intuitive meaning of rreeaaddoonnllyy.

       The --ss option suppresses all interactive user feedback and is useful
       for editing scripts in batch jobs. The list of specific effects is
       historical practice. The terminal type ``incapable of supporting open
       and visual modes'' has historically been named ``dumb''.

       The --tt option was required because the _c_t_a_g_s utility appears in
       POSIX.1-2008 and the option is available in all historical
       implementations of _e_x.

       Historically, the _e_x and _v_i utilities accepted a --xx option, which did
       encryption based on the algorithm found in the historical _c_r_y_p_t
       utility. The --xx option for encryption, and the associated _c_r_y_p_t
       utility, were omitted because the algorithm used was not specifiable
       and the export control laws of some nations make it difficult to export
       cryptographic technology. In addition, it did not historically provide
       the level of security that users might expect.

   SSttaannddaarrdd IInnppuutt
       An end-of-file condition is not equivalent to an end-of-file character.
       A common end-of-file character, <control>-D, is historically an _e_x
       command.

       There was no maximum line length in historical implementations of _e_x.
       Specifically, as it was parsed in chunks, the addresses had a different
       maximum length than the filenames. Further, the maximum line buffer
       size was declared as BUFSIZ, which was different lengths on different
       systems. This version selected the value of {LINE_MAX} to impose a
       reasonable restriction on portable usage of _e_x and to aid test suite
       writers in their development of realistic tests that exercise this
       limit.

   IInnppuutt FFiilleess
       It was an explicit decision by the standard developers that a <newline>
       be added to any file lacking one. It was believed that this feature of
       _e_x and _v_i was relied on by users in order to make text files lacking a
       trailing <newline> more portable. It is recognized that this will
       require a user-specified option or extension for implementations that
       permit _e_x and _v_i to edit files of type other than text if such files
       are not otherwise identified by the system. It was agreed that the
       ability to edit files of arbitrary type can be useful, but it was not
       considered necessary to mandate that an _e_x or _v_i implementation be
       required to handle files other than text files.

       The paragraph in the INPUT FILES section, ``By default, ...'', is
       intended to close a long-standing security problem in _e_x and _v_i; that
       of the ``modeline'' or ``modelines'' edit option. This feature allows
       any line in the first or last five lines of the file containing the
       strings ""eexx::"" or ""vvii::"" (and, apparently, ""eeii::"" or ""vvxx::"") to be a line
       containing editor commands, and _e_x interprets all the text up to the
       next ''::'' or <newline> as a command. Consider the consequences, for
       example, of an unsuspecting user using _e_x or _v_i as the editor when
       replying to a mail message in which a line such as:


           ex:! rm -rf :

       appeared in the signature lines. The standard developers believed
       strongly that an editor should not by default interpret any lines of a
       file. Vendors are strongly urged to delete this feature from their
       implementations of _e_x and _v_i.

   AAssyynncchhrroonnoouuss EEvveennttss
       The intention of the phrase ``complete write'' is that the entire edit
       buffer be written to stable storage. The note regarding temporary files
       is intended for implementations that use temporary files to back edit
       buffers unnamed by the user.

       Historically, SIGQUIT was ignored by _e_x, but was the equivalent of the
       QQ command in visual mode; that is, it exited visual mode and entered _e_x
       mode. POSIX.1-2008 permits, but does not require, this behavior.
       Historically, SIGINT was often used by _v_i users to terminate text input
       mode (<control>-C is often easier to enter than <ESC>).  Some
       implementations of _v_i alerted the terminal on this event, and some did
       not. POSIX.1-2008 requires that SIGINT behave identically to <ESC>, and
       that the terminal not be alerted.

       Historically, suspending the _e_x editor during text input mode was
       similar to SIGINT, as completed lines were retained, but any partial
       line discarded, and the editor returned to command mode. POSIX.1-2008
       is silent on this issue; implementations are encouraged to follow
       historical practice, where possible.

       Historically, the _v_i editor did not treat SIGTSTP as an asynchronous
       event, and it was therefore impossible to suspend the editor in visual
       text input mode.  There are two major reasons for this. The first is
       that SIGTSTP is a broadcast signal on UNIX systems, and the chain of
       events where the shell _e_x_e_cs an application that then _e_x_e_cs _v_i usually
       caused confusion for the terminal state if SIGTSTP was delivered to the
       process group in the default manner. The second was that most
       implementations of the UNIX _c_u_r_s_e_s package did not handle SIGTSTP
       safely, and the receipt of SIGTSTP at the wrong time would cause them
       to crash. POSIX.1-2008 is silent on this issue; implementations are
       encouraged to treat suspension as an asynchronous event if possible.

       Historically, modifications to the edit buffer made before SIGINT
       interrupted an operation were retained; that is, anywhere from zero to
       all of the lines to be modified might have been modified by the time
       the SIGINT arrived. These changes were not discarded by the arrival of
       SIGINT. POSIX.1-2008 permits this behavior, noting that the uunnddoo
       command is required to be able to undo these partially completed
       commands.

       The action taken for signals other than SIGINT, SIGCONT, SIGHUP, and
       SIGTERM is unspecified because some implementations attempt to save the
       edit buffer in a useful state when other signals are received.

   SSttaannddaarrdd EErrrroorr
       For _e_x/_v_i, diagnostic messages are those messages reported as a result
       of a failed attempt to invoke _e_x or _v_i, such as invalid options or
       insufficient resources, or an abnormal termination condition.
       Diagnostic messages should not be confused with the error messages
       generated by inappropriate or illegal user commands.

   IInniittiiaalliizzaattiioonn iinn eexx aanndd vvii
       If an _e_x command (other than ccdd, cchhddiirr, or ssoouurrccee) has a filename
       argument, one or both of the alternate and current pathnames will be
       set. Informally, they are set as follows:

        1. If the _e_x command is one that replaces the contents of the edit
           buffer, and it succeeds, the current pathname will be set to the
           filename argument (the first filename argument in the case of the
           nneexxtt command) and the alternate pathname will be set to the
           previous current pathname, if there was one.

        2. In the case of the file read/write forms of the rreeaadd and wwrriittee
           commands, if there is no current pathname, the current pathname
           will be set to the filename argument.

        3. Otherwise, the alternate pathname will be set to the filename
           argument.

       For example, ::eeddiitt ffoooo and ::rreeccoovveerr ffoooo, when successful, set the
       current pathname, and, if there was a previous current pathname, the
       alternate pathname. The commands ::wwrriittee, !!ccoommmmaanndd, and ::eeddiitt set
       neither the current or alternate pathnames. If the ::eeddiitt ffoooo command
       were to fail for some reason, the alternate pathname would be set. The
       rreeaadd and wwrriittee commands set the alternate pathname to their _f_i_l_e
       argument, unless the current pathname is not set, in which case they
       set the current pathname to their _f_i_l_e arguments. The alternate
       pathname was not historically set by the ::ssoouurrccee command. POSIX.1-2008
       requires conformance to historical practice.  Implementations adding
       commands that take filenames as arguments are encouraged to set the
       alternate pathname as described here.

       Historically, _e_x and _v_i read the ..eexxrrcc file in the _$_H_O_M_E directory
       twice, if the editor was executed in the _$_H_O_M_E directory. POSIX.1-2008
       prohibits this behavior.

       Historically, the 4 BSD _e_x and _v_i read the _$_H_O_M_E and local ..eexxrrcc files
       if they were owned by the real ID of the user, or the ssoouurrcceeaannyy option
       was set, regardless of other considerations. This was a security
       problem because it is possible to put normal UNIX system commands
       inside a ..eexxrrcc file. POSIX.1-2008 does not specify the ssoouurrcceeaannyy
       option, and historical implementations are encouraged to delete it.

       The ..eexxrrcc files must be owned by the real ID of the user, and not
       writable by anyone other than the owner. The appropriate privileges
       exception is intended to permit users to acquire special privileges,
       but continue to use the ..eexxrrcc files in their home directories.

       System V Release 3.2 and later _v_i implementations added the option
       [[nnoo]]eexxrrcc.  The behavior is that local ..eexxrrcc files are read-only if the
       eexxrrcc option is set. The default for the eexxrrcc option was off, so by
       default, local ..eexxrrcc files were not read. The problem this was intended
       to solve was that System V permitted users to give away files, so there
       is no possible ownership or writeability test to ensure that the file
       is safe. This is still a security problem on systems where users can
       give away files, but there is nothing additional that POSIX.1-2008 can
       do. The implementation-defined exception is intended to permit groups
       to have local ..eexxrrcc files that are shared by users, by creating pseudo-
       users to own the shared files.

       POSIX.1-2008 does not mention system-wide _e_x and _v_i start-up files.
       While they exist in several implementations of _e_x and _v_i, they are not
       present in any implementations considered historical practice by
       POSIX.1-2008. Implementations that have such files should use them only
       if they are owned by the real user ID or an appropriate user (for
       example, root on UNIX systems) and if they are not writable by any user
       other than their owner. System-wide start-up files should be read
       before the _E_X_I_N_I_T variable, $$HHOOMMEE//..eexxrrcc, or local ..eexxrrcc files are
       evaluated.

       Historically, any _e_x command could be entered in the _E_X_I_N_I_T variable or
       the ..eexxrrcc file, although ones requiring that the edit buffer already
       contain lines of text generally caused historical implementations of
       the editor to drop ccoorree.  POSIX.1-2008 requires that any _e_x command be
       permitted in the _E_X_I_N_I_T variable and ..eexxrrcc files, for simplicity of
       specification and consistency, although many of them will obviously
       fail under many circumstances.

       The initialization of the contents of the edit buffer uses the phrase
       ``the effect shall be'' with regard to various _e_x commands. The intent
       of this phrase is that edit buffer contents loaded during the
       initialization phase not be lost; that is, loading the edit buffer
       should fail if the ..eexxrrcc file read in the contents of a file and did
       not subsequently write the edit buffer. An additional intent of this
       phrase is to specify that the initial current line and column is set as
       specified for the individual _e_x commands.

       Historically, the --tt option behaved as if the tag search were a
       ++_c_o_m_m_a_n_d; that is, it was executed from the last line of the file
       specified by the tag. This resulted in the search failing if the
       pattern was a forward search pattern and the wwrraappssccaann edit option was
       not set. POSIX.1-2008 does not permit this behavior, requiring that the
       search for the tag pattern be performed on the entire file, and, if not
       found, that the current line be set to a more reasonable location in
       the file.

       Historically, the empty edit buffer presented for editing when a file
       was not specified by the user was unnamed. This is permitted by
       POSIX.1-2008; however, implementations are encouraged to provide users
       a temporary filename for this buffer because it permits them the use of
       _e_x commands that use the current pathname during temporary edit
       sessions.

       Historically, the file specified using the --tt option was not part of
       the current argument list. This practice is permitted by POSIX.1-2008;
       however, implementations are encouraged to include its name in the
       current argument list for consistency.

       Historically, the --cc command was generally not executed until a file
       that already exists was edited. POSIX.1-2008 requires conformance to
       this historical practice.  Commands that could cause the --cc command to
       be executed include the _e_x commands eeddiitt, nneexxtt, rreeccoovveerr, rreewwiinndd, and
       ttaagg, and the _v_i commands <control>-^ and <control>-].  Historically,
       reading a file into an edit buffer did not cause the --cc command to be
       executed (even though it might set the current pathname) with the
       exception that it did cause the --cc command to be executed if: the
       editor was in _e_x mode, the edit buffer had no current pathname, the
       edit buffer was empty, and no read commands had yet been attempted. For
       consistency and simplicity of specification, POSIX.1-2008 does not
       permit this behavior.

       Historically, the --rr option was the same as a normal edit session if
       there was no recovery information available for the file. This allowed
       users to enter:


           vi -r *.c

       and recover whatever files were recoverable. In some implementations,
       recovery was attempted only on the first file named, and the file was
       not entered into the argument list; in others, recovery was attempted
       for each file named. In addition, some historical implementations
       ignored --rr if --tt was specified or did not support command line _f_i_l_e
       arguments with the --tt option. For consistency and simplicity of
       specification, POSIX.1-2008 disallows these special cases, and requires
       that recovery be attempted the first time each file is edited.

       Historically, _v_i initialized the `` and '' marks, but _e_x did not. This
       meant that if the first command in _e_x mode was vviissuuaall or if an _e_x
       command was executed first (for example, _v_i +10 _f_i_l_e), _v_i was entered
       without the marks being initialized. Because the standard developers
       believed the marks to be generally useful, and for consistency and
       simplicity of specification, POSIX.1-2008 requires that they always be
       initialized if in open or visual mode, or if in _e_x mode and the edit
       buffer is not empty. Not initializing it in _e_x mode if the edit buffer
       is empty is historical practice; however, it has always been possible
       to set (and use) marks in empty edit buffers in open and visual mode
       edit sessions.

   AAddddrreessssiinngg
       Historically, _e_x and _v_i accepted the additional addressing forms ''\\//''
       and ''\\??''.  They were equivalent to ""////"" and ""????"", respectively. They
       are not required by POSIX.1-2008, mostly because nobody can remember
       whether they ever did anything different historically.

       Historically, _e_x and _v_i permitted an address of zero for several
       commands, and permitted the %% address in empty files for others. For
       consistency, POSIX.1-2008 requires support for the former in the few
       commands where it makes sense, and disallows it otherwise. In addition,
       because POSIX.1-2008 requires that %% be logically equivalent to ""11,,$$"",
       it is also supported where it makes sense and disallowed otherwise.

       Historically, the %% address could not be followed by further addresses.
       For consistency and simplicity of specification, POSIX.1-2008 requires
       that additional addresses be supported.

       All of the following are valid _a_d_d_r_e_s_s_e_s:

       +++       Three lines after the current line.

       /_r_e/-     One line before the next occurrence of _r_e.

       -2        Two lines before the current line.

       3 ---- 2  Line one (note intermediate negative address).

       1 2 3     Line six.

       Any number of addresses can be provided to commands taking addresses;
       for example, ""11,,22,,33,,44,,55pp"" prints lines 4 and 5, because two is the
       greatest valid number of addresses accepted by the pprriinntt command. This,
       in combination with the <semicolon> delimiter, permits users to create
       commands based on ordered patterns in the file. For example, the
       command 33;;//ffoooo//;;++22pprriinntt will display the first line after line 3 that
       contains the pattern _f_o_o, plus the next two lines. Note that the
       address 33;; must be evaluated before being discarded because the search
       origin for the //ffoooo// command depends on this.

       Historically, values could be added to addresses by including them
       after one or more <blank> characters; for example, 33 -- 55pp wrote the
       seventh line of the file, and //ffoooo// 55 was the same as //ffoooo//++55.
       However, only absolute values could be added; for example, 55 //ffoooo// was
       an error. POSIX.1-2008 requires conformance to historical practice.
       Address offsets are separately specified from addresses because they
       could historically be provided to visual mode search commands.

       Historically, any missing addresses defaulted to the current line. This
       was true for leading and trailing <comma>-delimited addresses, and for
       trailing <semicolon>-delimited addresses. For consistency, POSIX.1-2008
       requires it for leading <semicolon> addresses as well.

       Historically, _e_x and _v_i accepted the ''^^'' character as both an address
       and as a flag offset for commands. In both cases it was identical to
       the ''--'' character. POSIX.1-2008 does not require or prohibit this
       behavior.

       Historically, the enhancements to basic regular expressions could be
       used in addressing; for example, ''~~'', ''\\<<'', and ''\\>>''.  POSIX.1-2008
       requires conformance to historical practice; that is, that regular
       expression usage be consistent, and that regular expression
       enhancements be supported wherever regular expressions are used.

   CCoommmmaanndd LLiinnee PPaarrssiinngg iinn eexx
       Historical _e_x command parsing was even more complex than that described
       here. POSIX.1-2008 requires the subset of the command parsing that the
       standard developers believed was documented and that users could
       reasonably be expected to use in a portable fashion, and that was
       historically consistent between implementations. (The discarded
       functionality is obscure, at best.)  Historical implementations will
       require changes in order to comply with POSIX.1-2008; however, users
       are not expected to notice any of these changes.  Most of the
       complexity in _e_x parsing is to handle three special termination cases:

        1. The !!, gglloobbaall, vv, and the filter versions of the rreeaadd and wwrriittee
           commands are delimited by <newline> characters (they can contain
           <vertical-line> characters that are usually shell pipes).

        2. The eexx, eeddiitt, nneexxtt, and vviissuuaall in open and visual mode commands all
           take _e_x commands, optionally containing <vertical-line> characters,
           as their first arguments.

        3. The ss command takes a regular expression as its first argument, and
           uses the delimiting characters to delimit the command.

       Historically, <vertical-line> characters in the ++_c_o_m_m_a_n_d argument of
       the eexx, eeddiitt, nneexxtt, vvii, and vviissuuaall commands, and in the _p_a_t_t_e_r_n and
       _r_e_p_l_a_c_e_m_e_n_t parts of the ss command, did not delimit the command, and in
       the filter cases for rreeaadd and wwrriittee, and the !!, gglloobbaall, and vv commands,
       they did not delimit the command at all. For example, the following
       commands are all valid:


           ::edit +25 | s/abc/ABC/ file.c
           ::s/ | /PIPE/
           ::read !spell % | columnate
           ::global/pattern/p | l
           ::s/a/b/ | s/c/d | set

       Historically, empty or <blank> filled lines in ..eexxrrcc files and ssoouurrcceed
       files (as well as _E_X_I_N_I_T variables and _e_x command scripts) were treated
       as default commands; that is, pprriinntt commands. POSIX.1-2008 specifically
       requires that they be ignored when encountered in ..eexxrrcc and ssoouurrcceed
       files to eliminate a common source of new user error.

       Historically, _e_x commands with multiple adjacent (or <blank>-separated)
       vertical lines were handled oddly when executed from _e_x mode. For
       example, the command |||||| <carriage-return>, when the cursor was on line
       1, displayed lines 2, 3, and 5 of the file.  In addition, the command ||
       would only display the line after the next line, instead of the next
       two lines. The former worked more logically when executed from _v_i mode,
       and displayed lines 2, 3, and 4. POSIX.1-2008 requires the _v_i behavior;
       that is, a single default command and line number increment for each
       command separator, and trailing <newline> characters after <vertical-
       line> separators are discarded.

       Historically, _e_x permitted a single extra <colon> as a leading command
       character; for example, ::gg//ppaatttteerrnn//::pp was a valid command. POSIX.1-2008
       generalizes this to require that any number of leading <colon>
       characters be stripped.

       Historically, any prefix of the ddeelleettee command could be followed
       without intervening <blank> characters by a flag character because in
       the command dd pp, _p is interpreted as the buffer _p.  POSIX.1-2008
       requires conformance to historical practice.

       Historically, the kk command could be followed by the mark name without
       intervening <blank> characters. POSIX.1-2008 requires conformance to
       historical practice.

       Historically, the ss command could be immediately followed by flag and
       option characters; for example, ss//ee//EE//||ss||ssggcc33pp was a valid command.
       However, flag characters could not stand alone; for example, the
       commands sspp and ss ll would fail, while the command ssggpp and ss ggll would
       succeed. (Obviously, the ''##'' flag character was used as a delimiter
       character if it followed the command.) Another issue was that option
       characters had to precede flag characters even when the command was
       fully specified; for example, the command ss//ee//EE//ppgg would fail, while
       the command ss//ee//EE//ggpp would succeed. POSIX.1-2008 requires conformance
       to historical practice.

       Historically, the first command name that had a prefix matching the
       input from the user was the executed command; for example, vvee, vveerr, and
       vveerrss all executed the vveerrssiioonn command. Commands were in a specific
       order, however, so that aa matched aappppeenndd, not aabbbbrreevviiaattee.  POSIX.1-2008
       requires conformance to historical practice. The restriction on command
       search order for implementations with extensions is to avoid the
       addition of commands such that the historical prefixes would fail to
       work portably.

       Historical implementations of _e_x and _v_i did not correctly handle
       multiple _e_x commands, separated by <vertical-line> characters, that
       entered or exited visual mode or the editor. Because implementations of
       _v_i exist that do not exhibit this failure mode, POSIX.1-2008 does not
       permit it.

       The requirement that alphabetic command names consist of all following
       alphabetic characters up to the next non-alphabetic character means
       that alphabetic command names must be separated from their arguments by
       one or more non-alphabetic characters, normally a <blank> or ''!!''
       character, except as specified for the exceptions, the ddeelleettee, kk, and ss
       commands.

       Historically, the repeated execution of the _e_x default pprriinntt commands
       (<control>-D, _e_o_f, <newline>, <carriage-return>) erased any prompting
       character and displayed the next lines without scrolling the terminal;
       that is, immediately below any previously displayed lines. This
       provided a cleaner presentation of the lines in the file for the user.
       POSIX.1-2008 does not require this behavior because it may be
       impossible in some situations; however, implementations are strongly
       encouraged to provide this semantic if possible.

       Historically, it was possible to change files in the middle of a
       command, and have the rest of the command executed in the new file; for
       example:


           :edit +25 file.c | s/abc/ABC/ | 1

       was a valid command, and the substitution was attempted in the newly
       edited file. POSIX.1-2008 requires conformance to historical practice.
       The following commands are examples that exercise the _e_x parser:


           echo 'foo | bar' > file1; echo 'foo/bar' > file2;
           vi
           :edit +1 | s/|/PIPE/ | w file1 | e file2 | 1 | s/\//SLASH/ | wq

       Historically, there was no protection in editor implementations to
       avoid _e_x gglloobbaall, vv, @@, or ** commands changing edit buffers during
       execution of their associated commands. Because this would almost
       invariably result in catastrophic failure of the editor, and
       implementations exist that do exhibit these problems, POSIX.1-2008
       requires that changing the edit buffer during a gglloobbaall or vv command, or
       during a @@ or ** command for which there will be more than a single
       execution, be an error. Implementations supporting multiple edit
       buffers simultaneously are strongly encouraged to apply the same
       semantics to switching between buffers as well.

       The _e_x command quoting required by POSIX.1-2008 is a superset of the
       quoting in historical implementations of the editor. For example, it
       was not historically possible to escape a <blank> in a filename; for
       example, ::eeddiitt ffoooo\\\\\\ bbaarr would report that too many filenames had been
       entered for the edit command, and there was no method of escaping a
       <blank> in the first argument of an eeddiitt, eexx, nneexxtt, or vviissuuaall command
       at all. POSIX.1-2008 extends historical practice, requiring that
       quoting behavior be made consistent across all _e_x commands, except for
       the mmaapp, uunnmmaapp, aabbbbrreevviiaattee, and uunnaabbbbrreevviiaattee commands, which
       historically used <control>-V instead of <backslash> characters for
       quoting. For those four commands, POSIX.1-2008 requires conformance to
       historical practice.

       Backslash quoting in _e_x is non-intuitive.  <backslash>-escapes are
       ignored unless they escape a special character; for example, when
       performing _f_i_l_e argument expansion, the string ""\\\\%%"" is equivalent to
       ''\\%%'', not "\<_c_u_r_r_e_n_t _p_a_t_h_n_a_m_e>".  This can be confusing for users
       because <backslash> is usually one of the characters that causes shell
       expansion to be performed, and therefore shell quoting rules must be
       taken into consideration. Generally, quoting characters are only
       considered if they escape a special character, and a quoting character
       must be provided for each layer of parsing for which the character is
       special. As another example, only a single <backslash> is necessary for
       the ''\\ll'' sequence in substitute replacement patterns, because the
       character ''ll'' is not special to any parsing layer above it.

       <control>-V quoting in _e_x is slightly different from backslash quoting.
       In the four commands where <control>-V quoting applies (aabbbbrreevviiaattee,
       uunnaabbbbrreevviiaattee, mmaapp, and uunnmmaapp), any character may be escaped by a
       <control>-V whether it would have a special meaning or not.
       POSIX.1-2008 requires conformance to historical practice.

       Historical implementations of the editor did not require delimiters
       within character classes to be escaped; for example, the command
       ::ss//[[//]]//// on the string ""xxxxxx//yyyyyy"" would delete the ''//'' from the string.
       POSIX.1-2008 disallows this historical practice for consistency and
       because it places a large burden on implementations by requiring that
       knowledge of regular expressions be built into the editor parser.

       Historically, quoting <newline> characters in _e_x commands was handled
       inconsistently. In most cases, the <newline> character always
       terminated the command, regardless of any preceding escape character,
       because <backslash> characters did not escape <newline> characters for
       most _e_x commands. However, some _e_x commands (for example, ss, mmaapp, and
       aabbbbrreevviiaattiioonn) permitted <newline> characters to be escaped (although in
       the case of mmaapp and aabbbbrreevviiaattiioonn, <control>-V characters escaped them
       instead of <backslash> characters). This was true in not only the
       command line, but also ..eexxrrcc and ssoouurrcceed files. For example, the
       command:


           map = foo<control-V><newline>bar

       would succeed, although it was sometimes difficult to get the
       <control>-V and the inserted <newline> passed to the _e_x parser. For
       consistency and simplicity of specification, POSIX.1-2008 requires that
       it be possible to escape <newline> characters in _e_x commands at all
       times, using <backslash> characters for most _e_x commands, and using
       <control>-V characters for the mmaapp and aabbbbrreevviiaattiioonn commands. For
       example, the command pprriinntt<newline>lliisstt is required to be parsed as the
       single command pprriinntt<newline>lliisstt.  While this differs from historical
       practice, POSIX.1-2008 developers believed it unlikely that any script
       or user depended on the historical behavior.

       Historically, an error in a command specified using the --cc option did
       not cause the rest of the --cc commands to be discarded. POSIX.1-2008
       disallows this for consistency with mapped keys, the @@, gglloobbaall, ssoouurrccee,
       and vv commands, the _E_X_I_N_I_T environment variable, and the ..eexxrrcc files.

   IInnppuutt EEddiittiinngg iinn eexx
       One of the common uses of the historical _e_x editor is over slow network
       connections. Editors that run in canonical mode can require far less
       traffic to and from, and far less processing on, the host machine, as
       well as more easily supporting block-mode terminals. For these reasons,
       POSIX.1-2008 requires that _e_x be implemented using canonical mode input
       processing, as was done historically.

       POSIX.1-2008 does not require the historical 4 BSD input editing
       characters ``word erase'' or ``literal next''. For this reason, it is
       unspecified how they are handled by _e_x, although they must have the
       required effect. Implementations that resolve them after the line has
       been ended using a <newline> or <control>-M character, and
       implementations that rely on the underlying system terminal support for
       this processing, are both conforming.  Implementations are strongly
       urged to use the underlying system functionality, if at all possible,
       for compatibility with other system text input interfaces.

       Historically, when the _e_o_f character was used to decrement the
       aauuttooiinnddeenntt level, the cursor moved to display the new end of the
       aauuttooiinnddeenntt characters, but did not move the cursor to a new line, nor
       did it erase the <control>-D character from the line. POSIX.1-2008 does
       not specify that the cursor remain on the same line or that the rest of
       the line is erased; however, implementations are strongly encouraged to
       provide the best possible user interface; that is, the cursor should
       remain on the same line, and any <control>-D character on the line
       should be erased.

       POSIX.1-2008 does not require the historical 4 BSD input editing
       character ``reprint'', traditionally <control>-R, which redisplayed the
       current input from the user. For this reason, and because the
       functionality cannot be implemented after the line has been terminated
       by the user, POSIX.1-2008 makes no requirements about this
       functionality. Implementations are strongly urged to make this
       historical functionality available, if possible.

       Historically, <control>-Q did not perform a literal next function in
       _e_x, as it did in _v_i.  POSIX.1-2008 requires conformance to historical
       practice to avoid breaking historical _e_x scripts and ..eexxrrcc files.

   eeooff
       Whether the _e_o_f character immediately modifies the aauuttooiinnddeenntt
       characters in the prompt is left unspecified so that implementations
       can conform in the presence of systems that do not support this
       functionality. Implementations are encouraged to modify the line and
       redisplay it immediately, if possible.

       The specification of the handling of the _e_o_f character differs from
       historical practice only in that _e_o_f characters are not discarded if
       they follow normal characters in the text input. Historically, they
       were always discarded.

   CCoommmmaanndd DDeessccrriippttiioonnss iinn eexx
       Historically, several commands (for example, gglloobbaall, vv, vviissuuaall, ss,
       wwrriittee, wwqq, yyaannkk, !!, <<, >>, &&, and ~~) were executable in empty files
       (that is, the default address(es) were 0), or permitted explicit
       addresses of 0 (for example, 0 was a valid address, or 0,0 was a valid
       range). Addresses of 0, or command execution in an empty file, make
       sense only for commands that add new text to the edit buffer or write
       commands (because users may wish to write empty files). POSIX.1-2008
       requires this behavior for such commands and disallows it otherwise,
       for consistency and simplicity of specification.

       A count to an _e_x command has been historically corrected to be no
       greater than the last line in a file; for example, in a five-line file,
       the command 11,,66pprriinntt would fail, but the command 11pprriinntt330000 would
       succeed. POSIX.1-2008 requires conformance to historical practice.

       Historically, the use of flags in _e_x commands could be obscure. General
       historical practice was as described by POSIX.1-2008, but there were
       some special cases. For instance, the lliisstt, nnuummbbeerr, and pprriinntt commands
       ignored trailing address offsets; for example, 33pp ++++++## would display
       line 3, and 3 would be the current line after the execution of the
       command. The ooppeenn and vviissuuaall commands ignored both the trailing offsets
       and the trailing flags.  Also, flags specified to the ooppeenn and vviissuuaall
       commands interacted badly with the lliisstt edit option, and setting and
       then unsetting it during the open/visual session would cause _v_i to stop
       displaying lines in the specified format. For consistency and
       simplicity of specification, POSIX.1-2008 does not permit any of these
       exceptions to the general rule.

       POSIX.1-2008 uses the word _c_o_p_y in several places when discussing
       buffers. This is not intended to imply implementation.

       Historically, _e_x users could not specify numeric buffers because of the
       ambiguity this would cause; for example, in the command 33 ddeelleettee 22, it
       is unclear whether 2 is a buffer name or a _c_o_u_n_t.  POSIX.1-2008
       requires conformance to historical practice by default, but does not
       preclude extensions.

       Historically, the contents of the unnamed buffer were frequently
       discarded after commands that did not explicitly affect it; for
       example, when using the eeddiitt command to switch files. For consistency
       and simplicity of specification, POSIX.1-2008 does not permit this
       behavior.

       The _e_x utility did not historically have access to the numeric buffers,
       and, furthermore, deleting lines in _e_x did not modify their contents.
       For example, if, after doing a delete in _v_i, the user switched to _e_x,
       did another delete, and then switched back to _v_i, the contents of the
       numeric buffers would not have changed. POSIX.1-2008 requires
       conformance to historical practice. Numeric buffers are described in
       the _e_x utility in order to confine the description of buffers to a
       single location in POSIX.1-2008.

       The metacharacters that trigger shell expansion in _f_i_l_e arguments match
       historical practice, as does the method for doing shell expansion.
       Implementations wishing to provide users with the flexibility to alter
       the set of metacharacters are encouraged to provide a sshheellllmmeettaa string
       edit option.

       Historically, _e_x commands executed from _v_i refreshed the screen when it
       did not strictly need to do so; for example, ::!!ddaattee >> //ddeevv//nnuullll does
       not require a screen refresh because the output of the UNIX _d_a_t_e
       command requires only a single line of the screen. POSIX.1-2008
       requires that the screen be refreshed if it has been overwritten, but
       makes no requirements as to how an implementation should make that
       determination. Implementations may prompt and refresh the screen
       regardless.

   AAbbbbrreevviiaattee
       Historical practice was that characters that were entered as part of an
       abbreviation replacement were subject to mmaapp expansions, the sshhoowwmmaattcchh
       edit option, further abbreviation expansions, and so on; that is, they
       were logically pushed onto the terminal input queue, and were not a
       simple replacement. POSIX.1-2008 requires conformance to historical
       practice.  Historical practice was that whenever a non-word character
       (that had not been escaped by a <control>-V) was entered after a word
       character, _v_i would check for abbreviations. The check was based on the
       type of the character entered before the word character of the
       word/non-word pair that triggered the check. The word character of the
       word/non-word pair that triggered the check and all characters entered
       before the trigger pair that were of that type were included in the
       check, with the exception of <blank> characters, which always delimited
       the abbreviation.

       This means that, for the abbreviation to work, the _l_h_s must end with a
       word character, there can be no transitions from word to non-word
       characters (or _v_i_c_e _v_e_r_s_a) other than between the last and next-to-last
       characters in the _l_h_s, and there can be no <blank> characters in the
       _l_h_s.  In addition, because of the historical quoting rules, it was
       impossible to enter a literal <control>-V in the _l_h_s.  POSIX.1-2008
       requires conformance to historical practice. Historical implementations
       did not inform users when abbreviations that could never be used were
       entered; implementations are strongly encouraged to do so.

       For example, the following abbreviations will work:


           :ab (p  REPLACE
           :ab p   REPLACE
           :ab ((p REPLACE

       The following abbreviations will not work:


           :ab (   REPLACE
           :ab (pp REPLACE

       Historical practice is that words on the _v_i colon command line were
       subject to abbreviation expansion, including the arguments to the
       aabbbbrreevv (and more interestingly) the uunnaabbbbrreevv command. Because there are
       implementations that do not do abbreviation expansion for the first
       argument to those commands, this is permitted, but not required, by
       POSIX.1-2008. However, the following sequence:


           :ab foo bar
           :ab foo baz

       resulted in the addition of an abbreviation of ""bbaazz"" for the string
       ""bbaarr"" in historical _e_x/_v_i, and the sequence:


           :ab foo1 bar
           :ab foo2 bar
           :unabbreviate foo2

       deleted the abbreviation ""ffoooo11"", not ""ffoooo22"".  These behaviors are not
       permitted by POSIX.1-2008 because they clearly violate the expectations
       of the user.

       It was historical practice that <control>-V, not <backslash>,
       characters be interpreted as escaping subsequent characters in the
       aabbbbrreevviiaattee command. POSIX.1-2008 requires conformance to historical
       practice; however, it should be noted that an abbreviation containing a
       <blank> will never work.

   AAppppeenndd
       Historically, any text following a <vertical-line> command separator
       after an aappppeenndd, cchhaannggee, or iinnsseerrtt command became part of the insert
       text. For example, in the command:


           :g/pattern/append|stuff1

       a line containing the text ""ssttuuffff11"" would be appended to each line
       matching pattern. It was also historically valid to enter:


           :append|stuff1
           stuff2
           .

       and the text on the _e_x command line would be appended along with the
       text inserted after it.  There was an historical bug, however, that the
       user had to enter two terminating lines (the ''..''  lines) to terminate
       text input mode in this case. POSIX.1-2008 requires conformance to
       historical practice, but disallows the historical need for multiple
       terminating lines.

   CChhaannggee
       See the RATIONALE for the aappppeenndd command. Historical practice for
       cursor positioning after the change command when no text is input, is
       as described in POSIX.1-2008. However, one System V implementation is
       known to have been modified such that the cursor is positioned on the
       first address specified, and not on the line before the first address.
       POSIX.1-2008 disallows this modification for consistency.

       Historically, the cchhaannggee command did not support buffer arguments,
       although some implementations allow the specification of an optional
       buffer. This behavior is neither required nor disallowed by
       POSIX.1-2008.

   CChhaannggee DDiirreeccttoorryy
       A common extension in _e_x implementations is to use the elements of a
       ccddppaatthh edit option as prefix directories for _p_a_t_h arguments to cchhddiirr
       that are relative pathnames and that do not have ''..''  or ""...."" as their
       first component. Elements in the ccddppaatthh edit option are
       <colon>-separated.  The initial value of the ccddppaatthh edit option is the
       value of the shell _C_D_P_A_T_H environment variable. This feature was not
       included in POSIX.1-2008 because it does not exist in any of the
       implementations considered historical practice.

   CCooppyy
       Historical implementations of _e_x permitted copies to lines inside of
       the specified range; for example, ::22,,55ccooppyy33 was a valid command.
       POSIX.1-2008 requires conformance to historical practice.

   DDeelleettee
       POSIX.1-2008 requires support for the historical parsing of a ddeelleettee
       command followed by flags, without any intervening <blank> characters.
       For example:

       11ddpp     Deletes the first line and prints the line that was second.

       11ddeelleepp  As for 11ddpp.

       11dd      Deletes the first line, saving it in buffer _p.

       11dd pp11ll  (Pee-one-ell.) Deletes the first line, saving it in buffer _p,
               and listing the line that was second.

   EEddiitt
       Historically, any _e_x command could be entered as a ++_c_o_m_m_a_n_d argument to
       the eeddiitt command, although some (for example, iinnsseerrtt and aappppeenndd) were
       known to confuse historical implementations. For consistency and
       simplicity of specification, POSIX.1-2008 requires that any command be
       supported as an argument to the eeddiitt command.

       Historically, the command argument was executed with the current line
       set to the last line of the file, regardless of whether the eeddiitt
       command was executed from visual mode or not. POSIX.1-2008 requires
       conformance to historical practice.

       Historically, the ++_c_o_m_m_a_n_d specified to the eeddiitt and nneexxtt commands was
       delimited by the first <blank>, and there was no way to quote them. For
       consistency, POSIX.1-2008 requires that the usual _e_x backslash quoting
       be provided.

       Historically, specifying the ++_c_o_m_m_a_n_d argument to the edit command
       required a filename to be specified as well; for example, ::eeddiitt ++110000
       would always fail. For consistency and simplicity of specification,
       POSIX.1-2008 does not permit this usage to fail for that reason.

       Historically, only the cursor position of the last file edited was
       remembered by the editor. POSIX.1-2008 requires that this be supported;
       however, implementations are permitted to remember and restore the
       cursor position for any file previously edited.

   FFiillee
       Historical versions of the _e_x editor ffiillee command displayed a current
       line and number of lines in the edit buffer of 0 when the file was
       empty, while the _v_i <control>-G command displayed a current line and
       number of lines in the edit buffer of 1 in the same situation.
       POSIX.1-2008 does not permit this discrepancy, instead requiring that a
       message be displayed indicating that the file is empty.

   GGlloobbaall
       The two-pass operation of the gglloobbaall and vv commands is not intended to
       imply implementation, only the required result of the operation.

       The current line and column are set as specified for the individual _e_x
       commands. This requirement is cumulative; that is, the current line and
       column must track across all the commands executed by the gglloobbaall or vv
       commands.

   IInnsseerrtt
       See the RATIONALE for the aappppeenndd command.

       Historically, iinnsseerrtt could not be used with an address of zero; that
       is, not when the edit buffer was empty. POSIX.1-2008 requires that this
       command behave consistently with the aappppeenndd command.

   JJooiinn
       The action of the jjooiinn command in relation to the special characters is
       only defined for the POSIX locale because the correct amount of white
       space after a period varies; in Japanese none is required, in French
       only a single space, and so on.

   LLiisstt
       The historical output of the lliisstt command was potentially ambiguous.
       The standard developers believed correcting this to be more important
       than adhering to historical practice, and POSIX.1-2008 requires
       unambiguous output.

   MMaapp
       Historically, command mode maps only applied to command names; for
       example, if the character ''xx'' was mapped to ''yy'', the command ffxx
       searched for the ''xx'' character, not the ''yy'' character. POSIX.1-2008
       requires this behavior. Historically, entering <control>-V as the first
       character of a _v_i command was an error. Several implementations have
       extended the semantics of _v_i such that <control>-V means that the
       subsequent command character is not mapped. This is permitted, but not
       required, by POSIX.1-2008. Regardless, using <control>-V to escape the
       second or later character in a sequence of characters that might match
       a mmaapp command, or any character in text input mode, is historical
       practice, and stops the entered keys from matching a map. POSIX.1-2008
       requires conformance to historical practice.

       Historical implementations permitted digits to be used as a mmaapp command
       _l_h_s, but then ignored the map. POSIX.1-2008 requires that the mapped
       digits not be ignored.

       The historical implementation of the mmaapp command did not permit mmaapp
       commands that were more than a single character in length if the first
       character was printable. This behavior is permitted, but not required,
       by POSIX.1-2008.

       Historically, mapped characters were remapped unless the rreemmaapp edit
       option was not set, or the prefix of the mapped characters matched the
       mapping characters; for example, in the mmaapp:


           :map ab abcd

       the characters ""aabb"" were used as is and were not remapped, but the
       characters ""ccdd"" were mapped if appropriate. This can cause infinite
       loops in the _v_i mapping mechanisms. POSIX.1-2008 requires conformance
       to historical practice, and that such loops be interruptible.

       Text input maps had the same problems with expanding the _l_h_s for the _e_x
       mmaapp!!  and uunnmmaapp!!  command as did the _e_x aabbbbrreevviiaattee and uunnaabbbbrreevviiaattee
       commands. See the RATIONALE for the _e_x aabbbbrreevviiaattee command. POSIX.1-2008
       requires similar modification of some historical practice for the mmaapp
       and uunnmmaapp commands, as described for the aabbbbrreevviiaattee and uunnaabbbbrreevviiaattee
       commands.

       Historically, mmaapps that were subsets of other mmaapps behaved differently
       depending on the order in which they were defined.  For example:


           :map! ab     short
           :map! abc    long

       would always translate the characters ""aabb"" to ""sshhoorrtt"", regardless of
       how fast the characters ""aabbcc"" were entered. If the entry order was
       reversed:


           :map! abc    long
           :map! ab     short

       the characters ""aabb"" would cause the editor to pause, waiting for the
       completing ''cc'' character, and the characters might never be mapped to
       ""sshhoorrtt"".  For consistency and simplicity of specification, POSIX.1-2008
       requires that the shortest match be used at all times.

       The length of time the editor spends waiting for the characters to
       complete the _l_h_s is unspecified because the timing capabilities of
       systems are often inexact and variable, and it may depend on other
       factors such as the speed of the connection. The time should be long
       enough for the user to be able to complete the sequence, but not long
       enough for the user to have to wait. Some implementations of _v_i have
       added a kkeeyyttiimmee option, which permits users to set the number of 0,1
       seconds the editor waits for the completing characters. Because mapped
       terminal function and cursor keys tend to start with an <ESC>
       character, and <ESC> is the key ending _v_i text input mode, mmaapps
       starting with <ESC> characters are generally exempted from this timeout
       period, or, at least timed out differently.

   MMaarrkk
       Historically, users were able to set the ``previous context'' marks
       explicitly. In addition, the _e_x commands '''' and ''`` and the _v_i commands
       '''', ````, ``'', and ''`` all referred to the same mark. In addition, the
       previous context marks were not set if the command, with which the
       address setting the mark was associated, failed. POSIX.1-2008 requires
       conformance to historical practice. Historically, if marked lines were
       deleted, the mark was also deleted, but would reappear if the change
       was undone. POSIX.1-2008 requires conformance to historical practice.

       The description of the special events that set the `` and '' marks
       matches historical practice. For example, historically the command
       //aa//,,//bb// did not set the `` and '' marks, but the command //aa//,,//bb//ddeelleettee
       did.

   NNeexxtt
       Historically, any _e_x command could be entered as a ++_c_o_m_m_a_n_d argument to
       the nneexxtt command, although some (for example, iinnsseerrtt and aappppeenndd) were
       known to confuse historical implementations. POSIX.1-2008 requires that
       any command be permitted and that it behave as specified. The nneexxtt
       command can accept more than one file, so usage such as:


           next `ls [abc] `

       is valid; it need not be valid for the eeddiitt or rreeaadd commands, for
       example, because they expect only one filename.

       Historically, the nneexxtt command behaved differently from the ::rreewwiinndd
       command in that it ignored the force flag if the aauuttoowwrriittee flag was
       set. For consistency, POSIX.1-2008 does not permit this behavior.

       Historically, the nneexxtt command positioned the cursor as if the file had
       never been edited before, regardless. POSIX.1-2008 does not permit this
       behavior, for consistency with the eeddiitt command.

       Implementations wanting to provide a counterpart to the nneexxtt command
       that edited the previous file have used the command pprreevv[[iioouuss]],, which
       takes no _f_i_l_e argument. POSIX.1-2008 does not require this command.

   OOppeenn
       Historically, the ooppeenn command would fail if the ooppeenn edit option was
       not set. POSIX.1-2008 does not mention the ooppeenn edit option and does
       not require this behavior. Some historical implementations do not
       permit entering open mode from open or visual mode, only from _e_x mode.
       For consistency, POSIX.1-2008 does not permit this behavior.

       Historically, entering open mode from the command line (that is, _v_i
       ++ooppeenn) resulted in anomalous behaviors; for example, the _e_x file and
       _s_e_t commands, and the _v_i command <control>-G did not work. For
       consistency, POSIX.1-2008 does not permit this behavior.

       Historically, the ooppeenn command only permitted ''//'' characters to be used
       as the search pattern delimiter. For consistency, POSIX.1-2008 requires
       that the search delimiters used by the ss, gglloobbaall, and vv commands be
       accepted as well.

   PPrreesseerrvvee
       The pprreesseerrvvee command does not historically cause the file to be
       considered unmodified for the purposes of future commands that may exit
       the editor. POSIX.1-2008 requires conformance to historical practice.

       Historical documentation stated that mail was not sent to the user when
       preserve was executed; however, historical implementations did send
       mail in this case. POSIX.1-2008 requires conformance to the historical
       implementations.

   PPrriinntt
       The writing of NUL by the pprriinntt command is not specified as a special
       case because the standard developers did not want to require _e_x to
       support NUL characters. Historically, characters were displayed using
       the ARPA standard mappings, which are as follows:

        1. Printable characters are left alone.

        2. Control characters less than \177 are represented as ''^^'' followed
           by the character offset from the ''@@'' character in the ASCII map;
           for example, \007 is represented as ''^^GG''.

        3. \177 is represented as ''^^'' followed by ''??''.

       The display of characters having their eighth bit set was less
       standard. Existing implementations use hex (0x00), octal (\000), and a
       meta-bit display. (The latter displayed bytes that had their eighth bit
       set as the two characters ""MM--"" followed by the seven-bit display as
       described above.) The latter probably has the best claim to historical
       practice because it was used for the --vv option of 4 BSD and 4 BSD-
       derived versions of the _c_a_t utility since 1980.

       No specific display format is required by POSIX.1-2008.

       Explicit dependence on the ASCII character set has been avoided where
       possible, hence the use of the phrase an ``implementation-defined
       multi-character sequence'' for the display of non-printable characters
       in preference to the historical usage of, for instance, ""^^II"" for the
       <tab>.  Implementations are encouraged to conform to historical
       practice in the absence of any strong reason to diverge.

       Historically, all _e_x commands beginning with the letter ''pp'' could be
       entered using capitalized versions of the commands; for example,
       PP[[rriinntt]], PPrree[[sseerrvvee]], and PPuu[[tt]] were all valid command names.
       POSIX.1-2008 permits, but does not require, this historical practice
       because capital forms of the commands are used by some implementations
       for other purposes.

   PPuutt
       Historically, an _e_x ppuutt command, executed from open or visual mode, was
       the same as the open or visual mode PP command, if the buffer was named
       and was cut in character mode, and the same as the pp command if the
       buffer was named and cut in line mode. If the unnamed buffer was the
       source of the text, the entire line from which the text was taken was
       usually ppuutt, and the buffer was handled as if in line mode, but it was
       possible to get extremely anomalous behavior. In addition, using the QQ
       command to switch into _e_x mode, and then doing a ppuutt often resulted in
       errors as well, such as appending text that was unrelated to the
       (supposed) contents of the buffer. For consistency and simplicity of
       specification, POSIX.1-2008 does not permit these behaviors. All _e_x ppuutt
       commands are required to operate in line mode, and the contents of the
       buffers are not altered by changing the mode of the editor.

   RReeaadd
       Historically, an _e_x rreeaadd command executed from open or visual mode,
       executed in an empty file, left an empty line as the first line of the
       file. For consistency and simplicity of specification, POSIX.1-2008
       does not permit this behavior.  Historically, a rreeaadd in open or visual
       mode from a program left the cursor at the last line read in, not the
       first. For consistency, POSIX.1-2008 does not permit this behavior.

       Historical implementations of _e_x were unable to undo rreeaadd commands that
       read from the output of a program. For consistency, POSIX.1-2008 does
       not permit this behavior.

       Historically, the _e_x and _v_i message after a successful rreeaadd or wwrriittee
       command specified ``characters'', not ``bytes''. POSIX.1-2008 requires
       that the number of bytes be displayed, not the number of characters,
       because it may be difficult in multi-byte implementations to determine
       the number of characters read. Implementations are encouraged to
       clarify the message displayed to the user.

       Historically, reads were not permitted on files other than type
       regular, except that FIFO files could be read (probably only because
       they did not exist when _e_x and _v_i were originally written). Because the
       historical _e_x evaluated rreeaadd!!  and rreeaadd !!  equivalently, there can be
       no optional way to force the read. POSIX.1-2008 permits, but does not
       require, this behavior.

   RReeccoovveerr
       Some historical implementations of the editor permitted users to
       recover the edit buffer contents from a previous edit session, and then
       exit without saving those contents (or explicitly discarding them). The
       intent of POSIX.1-2008 in requiring that the edit buffer be treated as
       already modified is to prevent this user error.

   RReewwiinndd
       Historical implementations supported the rreewwiinndd command when the user
       was editing the first file in the list; that is, the file that the
       rreewwiinndd command would edit. POSIX.1-2008 requires conformance to
       historical practice.

   SSuubbssttiittuuttee
       Historically, _e_x accepted an rr option to the ss command. The effect of
       the rr option was to use the last regular expression used in any command
       as the pattern, the same as the ~~ command. The rr option is not required
       by POSIX.1-2008. Historically, the cc and gg options were toggled; for
       example, the command ::ss//aabbcc//ddeeff// was the same as ss//aabbcc//ddeeff//ccccccccgggggggg.
       For simplicity of specification, POSIX.1-2008 does not permit this
       behavior.

       The tilde command is often used to replace the last search RE. For
       example, in the sequence:


           s/red/blue/
           /green
           ~

       the ~~ command is equivalent to:


           s/green/blue/

       Historically, _e_x accepted all of the following forms:


           s/abc/def/
           s/abc/def
           s/abc/
           s/abc

       POSIX.1-2008 requires conformance to this historical practice.

       The ss command presumes that the ''^^'' character only occupies a single
       column in the display. Much of the _e_x and _v_i specification presumes
       that the <space> only occupies a single column in the display. There
       are no known character sets for which this is not true.

       Historically, the final column position for the substitute commands was
       based on previous column movements; a search for a pattern followed by
       a substitution would leave the column position unchanged, while a 0
       command followed by a substitution would change the column position to
       the first non-<blank>.  For consistency and simplicity of
       specification, POSIX.1-2008 requires that the final column position
       always be set to the first non-<blank>.

   SSeett
       Historical implementations redisplayed all of the options for each
       occurrence of the aallll keyword. POSIX.1-2008 permits, but does not
       require, this behavior.

   TTaagg
       No requirement is made as to where _e_x and _v_i shall look for the file
       referenced by the tag entry. Historical practice has been to look for
       the path found in the ttaaggss file, based on the current directory. A
       useful extension found in some implementations is to look based on the
       directory containing the tags file that held the entry, as well. No
       requirement is made as to which reference for the tag in the tags file
       is used. This is deliberate, in order to permit extensions such as
       multiple entries in a tags file for a tag.

       Because users often specify many different tags files, some of which
       need not be relevant or exist at any particular time, POSIX.1-2008
       requires that error messages about problem tags files be displayed only
       if the requested tag is not found, and then, only once for each time
       that the ttaagg edit option is changed.

       The requirement that the current edit buffer be unmodified is only
       necessary if the file indicated by the tag entry is not the same as the
       current file (as defined by the current pathname). Historically, the
       file would be reloaded if the filename had changed, as well as if the
       filename was different from the current pathname. For consistency and
       simplicity of specification, POSIX.1-2008 does not permit this
       behavior, requiring that the name be the only factor in the decision.

       Historically, _v_i only searched for tags in the current file from the
       current cursor to the end of the file, and therefore, if the wwrraappssccaann
       option was not set, tags occurring before the current cursor were not
       found. POSIX.1-2008 considers this a bug, and implementations are
       required to search for the first occurrence in the file, regardless.

   UUnnddoo
       The uunnddoo description deliberately uses the word ``modified''. The uunnddoo
       command is not intended to undo commands that replace the contents of
       the edit buffer, such as eeddiitt, nneexxtt, ttaagg, or rreeccoovveerr.

       Cursor positioning after the uunnddoo command was inconsistent in the
       historical _v_i, sometimes attempting to restore the original cursor
       position (gglloobbaall, uunnddoo, and vv commands), and sometimes, in the presence
       of maps, placing the cursor on the last line added or changed instead
       of the first. POSIX.1-2008 requires a simplified behavior for
       consistency and simplicity of specification.

   VVeerrssiioonn
       The vveerrssiioonn command cannot be exactly specified since there is no
       widely-accepted definition of what the version information should
       contain.  Implementations are encouraged to do something reasonably
       intelligent.

   WWrriittee
       Historically, the _e_x and _v_i message after a successful rreeaadd or wwrriittee
       command specified ``characters'', not ``bytes''. POSIX.1-2008 requires
       that the number of bytes be displayed, not the number of characters
       because it may be difficult in multi-byte implementations to determine
       the number of characters written. Implementations are encouraged to
       clarify the message displayed to the user.

       Implementation-defined tests are permitted so that implementations can
       make additional checks; for example, for locks or file modification
       times.

       Historically, attempting to append to a nonexistent file caused an
       error. It has been left unspecified in POSIX.1-2008 to permit
       implementations to let the wwrriittee succeed, so that the append semantics
       are similar to those of the historical _c_s_h.

       Historical _v_i permitted empty edit buffers to be written. However,
       since the way _v_i got around dealing with ``empty'' files was to always
       have a line in the edit buffer, no matter what, it wrote them as files
       of a single, empty line. POSIX.1-2008 does not permit this behavior.

       Historically, _e_x restored standard output and standard error to their
       values as of when _e_x was invoked, before writes to programs were
       performed. This could disturb the terminal configuration as well as be
       a security issue for some terminals. POSIX.1-2008 does not permit this,
       requiring that the program output be captured and displayed as if by
       the _e_x pprriinntt command.

   AAddjjuusstt WWiinnddooww
       Historically, the line count was set to the value of the ssccrroollll option
       if the type character was end-of-file. This feature was broken on most
       historical implementations long ago, however, and is not documented
       anywhere. For this reason, POSIX.1-2008 is resolutely silent.

       Historically, the zz command was <blank>-sensitive and zz ++ and zz -- did
       different things than zz++ and zz-- because the type could not be
       distinguished from a flag. (The commands zz ..  and zz == were historically
       invalid.) POSIX.1-2008 requires conformance to this historical
       practice.

       Historically, the zz command was further <blank>-sensitive in that the
       _c_o_u_n_t could not be <blank>-delimited; for example, the commands zz== 55
       and zz-- 55 were also invalid. Because the _c_o_u_n_t is not ambiguous with
       respect to either the type character or the flags, this is not
       permitted by POSIX.1-2008.

   EEssccaappee
       Historically, _e_x filter commands only read the standard output of the
       commands, letting standard error appear on the terminal as usual. The
       _v_i utility, however, read both standard output and standard error.
       POSIX.1-2008 requires the latter behavior for both _e_x and _v_i, for
       consistency.

   SShhiifftt LLeefftt aanndd SShhiifftt RRiigghhtt
       Historically, it was possible to add shift characters to increase the
       effect of the command; for example, <<<<<< outdented (or >>>>>> indented) the
       lines 3 levels of indentation instead of the default 1.  POSIX.1-2008
       requires conformance to historical practice.

   <<ccoonnttrrooll>>--DD
       Historically, the <control>-D command erased the prompt, providing the
       user with an unbroken presentation of lines from the edit buffer. This
       is not required by POSIX.1-2008; implementations are encouraged to
       provide it if possible.  Historically, the <control>-D command took,
       and then ignored, a _c_o_u_n_t.  POSIX.1-2008 does not permit this behavior.

   WWrriittee LLiinnee NNuummbbeerr
       Historically, the _e_x == command, when executed in _e_x mode in an empty
       edit buffer, reported 0, and from open or visual mode, reported 1. For
       consistency and simplicity of specification, POSIX.1-2008 does not
       permit this behavior.

   EExxeeccuuttee
       Historically, _e_x did not correctly handle the inclusion of text input
       commands (that is, aappppeenndd, iinnsseerrtt, and cchhaannggee) in executed buffers.
       POSIX.1-2008 does not permit this exclusion for consistency.

       Historically, the logical contents of the buffer being executed did not
       change if the buffer itself were modified by the commands being
       executed; that is, buffer execution did not support self-modifying
       code. POSIX.1-2008 requires conformance to historical practice.

       Historically, the @@ command took a range of lines, and the @@ buffer was
       executed once per line, with the current line (''..'')  set to each
       specified line. POSIX.1-2008 requires conformance to historical
       practice.

       Some historical implementations did not notice if errors occurred
       during buffer execution. This, coupled with the ability to specify a
       range of lines for the _e_x @@ command, makes it trivial to cause them to
       drop ccoorree.  POSIX.1-2008 requires that implementations stop buffer
       execution if any error occurs, if the specified line doesn't exist, or
       if the contents of the edit buffer itself are replaced (for example,
       the buffer executes the _e_x ::eeddiitt command).

   RReegguullaarr EExxpprreessssiioonnss iinn eexx
       Historical practice is that the characters in the replacement part of
       the last ss command--that is, those matched by entering a ''~~'' in the
       regular expression--were not further expanded by the regular expression
       engine. So, if the characters contained the string ""aa..,,"" they would
       match ''aa'' followed by ""..,,"" and not ''aa'' followed by any character.
       POSIX.1-2008 requires conformance to historical practice.

   EEddiitt OOppttiioonnss iinn eexx
       The following paragraphs describe the historical behavior of some edit
       options that were not, for whatever reason, included in POSIX.1-2008.
       Implementations are strongly encouraged to only use these names if the
       functionality described here is fully supported.

       eexxtteennddeedd  The eexxtteennddeedd edit option has been used in some
                 implementations of _v_i to provide extended regular expressions
                 instead of basic regular expressions This option was omitted
                 from POSIX.1-2008 because it is not widespread historical
                 practice.

       ffllaasshh     The ffllaasshh edit option historically caused the screen to flash
                 instead of beeping on error. This option was omitted from
                 POSIX.1-2008 because it is not found in some historical
                 implementations.

       hhaarrddttaabbss  The hhaarrddttaabbss edit option historically defined the number of
                 columns between hardware tab settings. This option was
                 omitted from POSIX.1-2008 because it was believed to no
                 longer be generally useful.

       mmooddeelliinnee  The mmooddeelliinnee (sometimes named mmooddeelliinneess) edit option
                 historically caused _e_x or _v_i to read the five first and last
                 lines of the file for editor commands.  This option is a
                 security problem, and vendors are strongly encouraged to
                 delete it from historical implementations.

       ooppeenn      The ooppeenn edit option historically disallowed the _e_x ooppeenn and
                 vviissuuaall commands. This edit option was omitted because these
                 commands are required by POSIX.1-2008.

       ooppttiimmiizzee  The ooppttiimmiizzee edit option historically expedited text
                 throughput by setting the terminal to not do automatic
                 <carriage-return> characters when printing more than one
                 logical line of output. This option was omitted from
                 POSIX.1-2008 because it was intended for terminals without
                 addressable cursors, which are rarely, if ever, still used.

       rruulleerr     The rruulleerr edit option has been used in some implementations
                 of _v_i to present a current row/column ruler for the user.
                 This option was omitted from POSIX.1-2008 because it is not
                 widespread historical practice.

       ssoouurrcceeaannyy The ssoouurrcceeaannyy edit option historically caused _e_x or _v_i to
                 source start-up files that were owned by users other than the
                 user running the editor. This option is a security problem,
                 and vendors are strongly encouraged to remove it from their
                 implementations.

       ttiimmeeoouutt   The ttiimmeeoouutt edit option historically enabled the (now
                 standard) feature of only waiting for a short period before
                 returning keys that could be part of a macro. This feature
                 was omitted from POSIX.1-2008 because its behavior is now
                 standard, it is not widely useful, and it was rarely
                 documented.

       vveerrbboossee   The vveerrbboossee edit option has been used in some implementations
                 of _v_i to cause _v_i to output error messages for common errors;
                 for example, attempting to move the cursor past the beginning
                 or end of the line instead of only alerting the screen. (The
                 historical _v_i only alerted the terminal and presented no
                 message for such errors. The historical editor option tteerrssee
                 did not select when to present error messages, it only made
                 existing error messages more or less verbose.) This option
                 was omitted from POSIX.1-2008 because it is not widespread
                 historical practice; however, implementors are encouraged to
                 use it if they wish to provide error messages for naive
                 users.

       wwrraapplleenn   The wwrraapplleenn edit option has been used in some implementations
                 of _v_i to specify an automatic margin measured from the left
                 margin instead of from the right margin. This is useful when
                 multiple screen sizes are being used to edit a single file.
                 This option was omitted from POSIX.1-2008 because it is not
                 widespread historical practice; however, implementors are
                 encouraged to use it if they add this functionality.

   aauuttooiinnddeenntt,, aaii
       Historically, the command 00aa did not do any autoindentation, regardless
       of the current indentation of line 1. POSIX.1-2008 requires that any
       indentation present in line 1 be used.

   aauuttoopprriinntt,, aapp
       Historically, the aauuttoopprriinntt edit option was not completely consistent
       or based solely on modifications to the edit buffer. Exceptions were
       the rreeaadd command (when reading from a file, but not from a filter), the
       aappppeenndd, cchhaannggee, iinnsseerrtt, gglloobbaall, and vv commands, all of which were not
       affected by aauuttoopprriinntt, and the ttaagg command, which was affected by
       aauuttoopprriinntt.  POSIX.1-2008 requires conformance to historical practice.

       Historically, the aauuttoopprriinntt option only applied to the last of multiple
       commands entered using <vertical-line> delimiters; for example, ddeelleettee
       <newline> was affected by aauuttoopprriinntt, but ddeelleettee||vveerrssiioonn <newline> was
       not. POSIX.1-2008 requires conformance to historical practice.

   aauuttoowwrriittee,, aaww
       Appending the ''!!''  character to the _e_x nneexxtt command to avoid performing
       an automatic write was not supported in historical implementations.
       POSIX.1-2008 requires that the behavior match the other _e_x commands for
       consistency.

   iiggnnoorreeccaassee,, iicc
       Historical implementations of case-insensitive matching (the iiggnnoorreeccaassee
       edit option) lead to counter-intuitive situations when uppercase
       characters were used in range expressions. Historically, the process
       was as follows:

        1. Take a line of text from the edit buffer.

        2. Convert uppercase to lowercase in text line.

        3. Convert uppercase to lowercase in regular expressions, except in
           character class specifications.

        4. Match regular expressions against text.

       This would mean that, with iiggnnoorreeccaassee in effect, the text:


           The cat sat on the mat

       would be matched by


           /^the/

       but not by:


           /^[A-Z]he/

       For consistency with other commands implementing regular expressions,
       POSIX.1-2008 does not permit this behavior.

   ppaarraaggrraapphhss,, ppaarraa
       The ISO POSIX-2:1993 standard made the default ppaarraaggrraapphhss and sseeccttiioonnss
       edit options implementation-defined, arguing they were historically
       oriented to the UNIX system _t_r_o_f_f text formatter, and a ``portable
       user'' could use the {{, }}, [[[[, ]]]], ((, and )) commands in open or visual
       mode and have the cursor stop in unexpected places. POSIX.1-2008
       specifies their values in the POSIX locale because the unusual grouping
       (they only work when grouped into two characters at a time) means that
       they cannot be used for general-purpose movement, regardless.

   rreeaaddoonnllyy
       Implementations are encouraged to provide the best possible information
       to the user as to the read-only status of the file, with the exception
       that they should not consider the current special privileges of the
       process. This provides users with a safety net because they must force
       the overwrite of read-only files, even when running with additional
       privileges.

       The rreeaaddoonnllyy edit option specification largely conforms to historical
       practice. The only difference is that historical implementations did
       not notice that the user had set the rreeaaddoonnllyy edit option in cases
       where the file was already marked read-only for some reason, and would
       therefore reinitialize the rreeaaddoonnllyy edit option the next time the
       contents of the edit buffer were replaced. This behavior is disallowed
       by POSIX.1-2008.

   rreeppoorrtt
       The requirement that lines copied to a buffer interact differently than
       deleted lines is historical practice. For example, if the rreeppoorrtt edit
       option is set to 3, deleting 3 lines will cause a report to be written,
       but 4 lines must be copied before a report is written.

       The requirement that the _e_x gglloobbaall, vv, ooppeenn, uunnddoo, and vviissuuaall commands
       present reports based on the total number of lines added or deleted
       during the command execution, and that commands executed by the gglloobbaall
       and vv commands not present reports, is historical practice.
       POSIX.1-2008 extends historical practice by requiring that buffer
       execution be treated similarly. The reasons for this are two-fold.
       Historically, only the report by the last command executed from the
       buffer would be seen by the user, as each new report would overwrite
       the last. In addition, the standard developers believed that buffer
       execution had more in common with gglloobbaall and vv commands than it did
       with other _e_x commands, and should behave similarly, for consistency
       and simplicity of specification.

   sshhoowwmmaattcchh,, ssmm
       The length of time the cursor spends on the matching character is
       unspecified because the timing capabilities of systems are often
       inexact and variable. The time should be long enough for the user to
       notice, but not long enough for the user to become annoyed. Some
       implementations of _v_i have added a mmaattcchhttiimmee option that permits users
       to set the number of 0,1 second intervals the cursor pauses on the
       matching character.

   sshhoowwmmooddee
       The sshhoowwmmooddee option has been used in some historical implementations of
       _e_x and _v_i to display the current editing mode when in open or visual
       mode. The editing modes have generally included ``command'' and
       ``input'', and sometimes other modes such as ``replace'' and
       ``change''. The string was usually displayed on the bottom line of the
       screen at the far right-hand corner. In addition, a preceding ''**''
       character often denoted whether the contents of the edit buffer had
       been modified. The latter display has sometimes been part of the
       sshhoowwmmooddee option, and sometimes based on another option. This option was
       not available in the 4 BSD historical implementation of _v_i, but was
       viewed as generally useful, particularly to novice users, and is
       required by POSIX.1-2008.

       The ssmmdd shorthand for the sshhoowwmmooddee option was not present in all
       historical implementations of the editor.  POSIX.1-2008 requires it,
       for consistency.

       Not all historical implementations of the editor displayed a mode
       string for command mode, differentiating command mode from text input
       mode by the absence of a mode string. POSIX.1-2008 permits this
       behavior for consistency with historical practice, but implementations
       are encouraged to provide a display string for both modes.

   sslloowwooppeenn
       Historically, the sslloowwooppeenn option was automatically set if the terminal
       baud rate was less than 1200 baud, or if the baud rate was 1200 baud
       and the rreeddrraaww option was not set. The sslloowwooppeenn option had two effects.
       First, when inserting characters in the middle of a line, characters
       after the cursor would not be pushed ahead, but would appear to be
       overwritten. Second, when creating a new line of text, lines after the
       current line would not be scrolled down, but would appear to be
       overwritten. In both cases, ending text input mode would cause the
       screen to be refreshed to match the actual contents of the edit buffer.
       Finally, terminals that were sufficiently intelligent caused the editor
       to ignore the sslloowwooppeenn option. POSIX.1-2008 permits most historical
       behavior, extending historical practice to require sslloowwooppeenn behaviors
       if the edit option is set by the user.

   ttaaggss
       The default path for tags files is left unspecified as implementations
       may have their own ttaaggss implementations that do not correspond to the
       historical ones. The default ttaaggss option value should probably at least
       include the file ..//ttaaggss.

   tteerrmm
       Historical implementations of _e_x and _v_i ignored changes to the tteerrmm
       edit option after the initial terminal information was loaded. This is
       permitted by POSIX.1-2008; however, implementations are encouraged to
       permit the user to modify their terminal type at any time.

   tteerrssee
       Historically, the tteerrssee edit option optionally provided a shorter, less
       descriptive error message, for some error messages. This is permitted,
       but not required, by POSIX.1-2008. Historically, most common visual
       mode errors (for example, trying to move the cursor past the end of a
       line) did not result in an error message, but simply alerted the
       terminal. Implementations wishing to provide messages for novice users
       are urged to do so based on the eeddiitt option vveerrbboossee, and not tteerrssee.

   wwiinnddooww
       In historical implementations, the default for the wwiinnddooww edit option
       was based on the baud rate as follows:

        1. If the baud rate was less than 1200, the eeddiitt option ww330000 set the
           window value; for example, the line:


               set w300=12

           would set the window option to 12 if the baud rate was less than
           1200.

        2. If the baud rate was equal to 1200, the eeddiitt option ww11220000 set the
           window value.

        3. If the baud rate was greater than 1200, the eeddiitt option ww99660000 set
           the window value.

       The ww330000, ww11220000, and ww99660000 options do not appear in POSIX.1-2008
       because of their dependence on specific baud rates.

       In historical implementations, the size of the window displayed by
       various commands was related to, but not necessarily the same as, the
       wwiinnddooww edit option. For example, the size of the window was set by the
       _e_x command vviissuuaall 1100, but it did not change the value of the wwiinnddooww
       edit option. However, changing the value of the wwiinnddooww edit option did
       change the number of lines that were displayed when the screen was
       repainted. POSIX.1-2008 does not permit this behavior in the interests
       of consistency and simplicity of specification, and requires that all
       commands that change the number of lines that are displayed do it by
       setting the value of the wwiinnddooww edit option.

   wwrraappmmaarrggiinn,, wwmm
       Historically, the wwrraappmmaarrggiinn option did not affect maps inserting
       characters that also had associated _c_o_u_n_ts; for example
       ::mmaapp KK 55aaAABBCC DDEEFF.  Unfortunately, there are widely used maps that
       depend on this behavior.  For consistency and simplicity of
       specification, POSIX.1-2008 does not permit this behavior.

       Historically, wwrraappmmaarrggiinn was calculated using the column display width
       of all characters on the screen. For example, an implementation using
       ""^^II"" to represent <tab> characters when the lliisstt edit option was set,
       where ''^^'' and ''II'' each took up a single column on the screen, would
       calculate the wwrraappmmaarrggiinn based on a value of 2 for each <tab>.  The
       nnuummbbeerr edit option similarly changed the effective length of the line
       as well.  POSIX.1-2008 requires conformance to historical practice.

       Earlier versions of this standard allowed for implementations with
       bytes other than eight bits, but this has been modified in this
       version.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _S_e_c_t_i_o_n _2_._9_._1_._1, _C_o_m_m_a_n_d _S_e_a_r_c_h _a_n_d _E_x_e_c_u_t_i_o_n, _c_t_a_g_s, _e_d, _s_e_d, _s_h,
       _s_t_t_y, _v_i

       The Base Definitions volume of POSIX.1-2017, _T_a_b_l_e _5_-_1, _E_s_c_a_p_e
       _S_e_q_u_e_n_c_e_s _a_n_d _A_s_s_o_c_i_a_t_e_d _A_c_t_i_o_n_s, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s,
       _S_e_c_t_i_o_n _9_._3, _B_a_s_i_c _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x
       _G_u_i_d_e_l_i_n_e_s

       The System Interfaces volume of POSIX.1-2017, _a_c_c_e_s_s()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                                EX(1)
