1993-04-23 06:08:48 +04:00
|
|
|
This version of ed is not strictly POSIX compliant, as described in the
|
1993-11-12 13:48:43 +03:00
|
|
|
POSIX 1003.2 document. BSD commands have been implemented wherever they
|
|
|
|
do not conflict with the POSIX standard. For backwards compatibility,
|
|
|
|
the POSIX rule that says a range of addresses cannot be used where only
|
|
|
|
a single address is expected has been relaxed.
|
1993-04-23 06:08:48 +04:00
|
|
|
|
|
|
|
The BSD commands included are:
|
1993-05-08 14:49:52 +04:00
|
|
|
1) `s' (i.e., s[rgp]*) to repeat a previous substitution,
|
|
|
|
2) `W' for appending text to an existing file,
|
|
|
|
3) `wq' for exiting after a write, and
|
|
|
|
4) `z' for scrolling through the buffer.
|
1993-04-23 06:08:48 +04:00
|
|
|
BSD line addressing syntax (i.e., `^' and `%'). is also recognized.
|
|
|
|
|
|
|
|
The POSIX interactive global commands `G' and `V' are extended to support
|
|
|
|
multiple commands, including `a', `i' and `c'. The command format is the
|
|
|
|
same as for the global commands `g' and `v', i.e., one command per line
|
|
|
|
with each line, except for the last, ending in a backslash (\).
|
|
|
|
|
|
|
|
If crypt is available, files can be read and written using DES encryption.
|
|
|
|
The `x' command prompts the user to enter a key used for encrypting/
|
|
|
|
decrypting subsequent reads and writes. If only a newline is entered as
|
|
|
|
the key, then encryption is disabled. Otherwise, a key is read in the
|
|
|
|
same manner as a password entry. The key remains in effect until
|
|
|
|
encryption is disabled. For more information on the encryption algorithm,
|
|
|
|
see the bdes(1) man page. Encryption/decryption should be fully compatible
|
|
|
|
with SunOS DES.
|
|
|
|
|
|
|
|
An extension to the POSIX file commands `E', `e', `r', `W' and `w' is that
|
|
|
|
<file> arguments are processed for backslash escapes, i.e., any character
|
1993-05-08 14:49:52 +04:00
|
|
|
preceded by a backslash is interpreted literally. If the first unescaped
|
|
|
|
character of a <file> argument is a bang (!), then the rest of the line
|
|
|
|
is interpreted as a shell command, and no escape processing is performed
|
|
|
|
by ed.
|
1993-04-23 06:08:48 +04:00
|
|
|
|
1993-05-08 14:49:52 +04:00
|
|
|
The vi editor's bang command syntax is supported, i.e.,
|
|
|
|
(addr1,addr2) !<shell-cmd> replaces the addressed lines with the output of
|
|
|
|
the command <shell-cmd>.
|
|
|
|
[rwe] !! reads/writes/edits the previous !<shell-cmd>.
|
1993-04-23 06:08:48 +04:00
|
|
|
|
|
|
|
If ed is invoked with a name argument prefixed by a bang, then the
|
|
|
|
remainder of the argument is interpreted as a shell command. To invoke
|
|
|
|
ed on a file whose name starts with bang, prefix the name with a backslash.
|
1993-05-27 05:27:46 +04:00
|
|
|
|
1993-06-16 11:36:51 +04:00
|
|
|
ed runs in restricted mode if invoked as red. This limits editing of
|
|
|
|
files in the local directory only and prohibits !<shell-cmd> commands.
|
|
|
|
|
|
|
|
Though ed is not a binary editor, it can be used (if painfully) to edit
|
|
|
|
binary files. To assist in binary editing, when a file containing at
|
|
|
|
least one ASCII NUL character is written, a newline is not appended
|
|
|
|
if it did not already contain one upon reading.
|
1993-07-02 14:02:26 +04:00
|
|
|
|
|
|
|
Since the behavior of `u' (undo) within a `g' (global) command list is
|
1993-11-12 13:48:43 +03:00
|
|
|
not specified by POSIX, it follows the behavior of the SunOS ed
|
1993-07-02 14:02:26 +04:00
|
|
|
(this is the best way, I think, in that the alternatives are either too
|
|
|
|
complicated to implement or too confusing to use): undo forces a global
|
|
|
|
command list to be executed only once, rather than for each line matching
|
|
|
|
a global pattern. In addtion, each instance of `u' within a global command
|
|
|
|
undoes all previous commands (including undo's) in the command list.
|
|
|
|
|
|
|
|
The `m' (move) command within a `g' command list also follows the SunOS
|
|
|
|
ed implementation: any moved lines are removed from the global command's
|
|
|
|
`active' list.
|