1This version of ed(1) is not strictly POSIX compliant, as described in 2the POSIX 1003.2 document. The following is a summary of the omissions, 3extensions and possible deviations from POSIX 1003.2. 4 5OMISSIONS 6--------- 71) Locale(3) is not supported yet. 8 92) For backwards compatibility, the POSIX rule that says a range of 10 addresses cannot be used where only a single address is expected has 11 been relaxed. 12 13EXTENSIONS 14---------- 151) BSD commands have been implemented wherever they do not conflict with 16 the POSIX standard. The BSD-ism's included are: 17 i) `s' (i.e., s[rgp]*) to repeat a previous substitution, 18 ii) `W' for appending text to an existing file, 19 iii) `wq' for exiting after a write, 20 iv) `z' for scrolling through the buffer, and 21 v) BSD line addressing syntax (i.e., `^' and `%') is recognized. 22 232) If crypt(3) is available, files can be read and written using DES 24 encryption. The `x' command prompts the user to enter a key used for 25 encrypting/ decrypting subsequent reads and writes. If only a newline 26 is entered as the key, then encryption is disabled. Otherwise, a key 27 is read in the same manner as a password entry. The key remains in 28 effect until encryption is disabled. For more information on the 29 encryption algorithm, see the bdes(1) man page. Encryption/decryption 30 should be fully compatible with SunOS DES. 31 323) The POSIX interactive global commands `G' and `V' are extended to 33 support multiple commands, including `a', `i' and `c'. The command 34 format is the same as for the global commands `g' and `v', i.e., one 35 command per line with each line, except for the last, ending in a 36 backslash (\). 37 384) Though ed is not a binary editor, it can be used (if painfully) to edit 39 binary files. To assist in binary editing, when a file containing at 40 least one ASCII NUL character is written, a newline is not appended if 41 it did not already contain one upon reading. For instance, to create 42 a file containing a single NUL, one might use: 43 $ cp /dev/null file 44 $ ed file 45 a 46 ^@ 47 . 48 wq 49 $ 50 515) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is 52 that <file> arguments are processed for backslash escapes, i.e., any 53 character preceded by a backslash is interpreted literally. If the 54 first unescaped character of a <file> argument is a bang (!), then the 55 rest of the line is interpreted as a shell command, and no escape 56 processing is performed by ed. 57 586) The ex(1) editor's ! (bang) command syntax is supported, i.e.: 59 i) commands of the form: 60 (addr1,addr2) !shell-command 61 replace the addressed lines with the output of the shell- 62 command, and 63 ii) commands of the form: 64 [rwe] !! 65 read, write, or edit, respectively, the previous shell-command. 66 677) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked 68 as red. This limits editing of files in the local directory only and 69 prohibits shell commands. 70 71DEVIATIONS 72---------- 731) Since the behavior of `u' (undo) within a `g' (global) command list is 74 not specified by POSIX, it follows the behavior of the SunOS ed (this 75 is the best way, I think, in that the alternatives are either too 76 complicated to implement or too confusing to use): undo forces a global 77 command list to be executed only once, rather than for each line 78 matching a global pattern. In addtion, each instance of `u' within a 79 global command undoes all previous commands (including undo's) in the 80 command list. 81 822) The `m' (move) command within a `g' command list also follows the SunOS 83 ed implementation: any moved lines are removed from the global command's 84 `active' list. 85 863) If ed is invoked with a name argument prefixed by a bang, then the 87 remainder of the argument is interpreted as a shell command. To invoke 88 ed on a file whose name starts with bang, prefix the name with a 89 backslash. 90