`FileSystem::absolute_path()` does `stat` the file, this commit runs
all `absolute_path` calls before touching the veil to make sure this
works as intended.
The initial version of sed implements only the `s` command (given on the
command line) applied to all lines of the input file. While this is
probably the most common scenario that people use sed with in the wild,
it's limited in several ways:
* `s` is only one of the many commands that sed is meant to implement.
* Commands may take one or two addresses that limits its applicability
to input lines.
* Commands in general operate over the "pattern" and "hold" spaces
rather than blindly over input lines.
* Command line parameters include specifying a script file, and
optionally input file(s) and/or a script to execute.
This commit implements a big portion of these missing features:
* It adds support for parsing *almost* all commands and their
arguments.
* It also implements the execution of a big portion of the commands.
* It adds support for parsing the optional addresses that prefix a
command, and enables/disables commands based on these address ranges.
* It implements the pattern and hold spaces, which are the source of
input/output for most of the commands.
* It improves the command line argument handling to receive a script
file, potentially multiple execution scripts, and optional input
files.
Some know missing functionality:
* The `{` and `}` commands are not supported yet.
* Pattern-based addresses are not supported yet.
* Labels and branches are parsed, but not supported at runtime.
Similar to POSIX read, the basic read and write functions of AK::Stream
do not have a lower limit of how much data they read or write (apart
from "none at all").
Rename the functions to "read some [data]" and "write some [data]" (with
"data" being omitted, since everything here is reading and writing data)
to make them sufficiently distinct from the functions that ensure to
use the entire buffer (which should be the go-to function for most
usages).
No functional changes, just a lot of new FIXMEs.
A substitution command like "s/x/y/wabc" will now write all substituted
lines to a file called "abc". Note that this is in addition to writing
to stdout.