diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 145 |
1 files changed, 145 insertions, 0 deletions
@@ -0,0 +1,145 @@ +GNU ed is a line-oriented text editor. It is used to create, display, +modify and otherwise manipulate text files, both interactively and via +shell scripts. A restricted version of ed, red, can only edit files in +the current directory and cannot execute shell commands. Ed is the +"standard" text editor in the sense that it is the original editor for +Unix, and thus widely available. For most purposes, however, it is +superseded by full-screen editors such as GNU Emacs or GNU Moe. + +Extensions to and deviations from the POSIX standard are described below. + +See the file INSTALL for compilation and installation instructions. + +Try "ed --help" for usage instructions. + +Report bugs to <bug-ed@gnu.org>. + +Ed home page: http://www.gnu.org/software/ed/ed.html + +For a description of the ed algorithm, see Kernighan and Plauger's book +"Software Tools in Pascal," Addison-Wesley, 1981. + + +GNU ed(1) is not strictly POSIX compliant, as described in the +POSIX 1003.1-2004 document. The following is a summary of omissions +and extensions to, and deviations from, the POSIX standard. + +OMISSIONS +--------- + * Locale(3) is not supported. + +EXTENSIONS +---------- + * Though GNU ed is not a stream editor, it can be used 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. In particular, reading /dev/null + prior to writing prevents appending a newline to a binary file. + + For example, to create a file with GNU ed containing a single NUL character: + $ ed file + a + ^@ + . + r /dev/null + wq + + Similarly, to remove a newline from the end of binary `file': + $ ed file + r /dev/null + wq + + * BSD commands have been implemented wherever they do not conflict with + the POSIX standard. The BSD-ism's included are: + * `s' (i.e., s[n][rgp]*) to repeat a previous substitution, + * `W' for appending text to an existing file, + * `wq' for exiting after a write, and + * `z' for scrolling through the buffer. + + * 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 (\). + + * The file commands `E', `e', `r', `W' and `w' process a <file> + argument for backslash escapes; i.e., any character 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 GNU ed. + + * For SunOS ed(1) compatibility, GNU ed runs in restricted mode if invoked + as red. This limits editing of files in the local directory only and + prohibits shell commands. + +DEVIATIONS +---------- + * 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. + + * To support the BSD `s' command (see EXTENSIONS above), + substitution patterns cannot be delimited by numbers or the characters + `r', `g' and `p'. In contrast, POSIX specifies any character expect + space or newline can used as a delimiter. + + * Since the behavior of `u' (undo) within a `g' (global) command list is + not specified by POSIX, GNU ed follows the behavior of the SunOS ed: + 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. This seems the best way, since the + alternatives are either too complicated to implement or too confusing + to use. + + * 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. + + * If GNU 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 + (quoted) backslash. + + * For backwards compatibility, errors in piped scripts do not force ed + to exit. POSIX only specifies ed's response for input via regular + files (including here documents) or tty's. + + +TESTSUITE +--------- +The files in the `testsuite' directory with suffixes `.t', `.d', `.r', +`.pr' and `.err' are used for testing ed. To run the tests, configure +the package and type `make check' from the build directory. The tests do +not exhaustively verify POSIX compliance nor do they verify correct +8-bit or long line support. + +The test file suffixes have the following meanings: +.t Template - a list of ed commands from which an ed script is + constructed +.d Data - read by an ed script +.r Result - the expected output after processing data via an ed + script. +.pr Result from a piped ed script. +.err Error - invalid ed commands that should generate an error + +The output of the tests is written to the files errs.ck, pipes.ck and +scripts.ck. At the end of the tests, these files are grep'ed for error +messages, which look like: + + *** The script u.ed exited abnormally *** +or: + *** Output u.o of script u.ed is incorrect *** + + +Copyright (C) 1993, 1994 Andrew Moore +Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. + +This file is free documentation: you have unlimited permission to copy, +distribute and modify it. + +The file Makefile.in is a data file used by configure to produce the +Makefile. It has the same copyright owner and permissions that configure +itself. |