diff options
author | yar <yar@FreeBSD.org> | 2007-04-21 01:21:36 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2007-04-21 01:21:36 +0000 |
commit | 65b331b4a19ecf3dc073e2363cb8294e986ded44 (patch) | |
tree | ca61296c60f091c362f574d1212cf29938a3745f /usr.bin/sed/process.c | |
parent | a1e73b1eafb356ff4adba96fd8099c15c11471cd (diff) | |
download | FreeBSD-src-65b331b4a19ecf3dc073e2363cb8294e986ded44.zip FreeBSD-src-65b331b4a19ecf3dc073e2363cb8294e986ded44.tar.gz |
Change the semantics of -i (in-place editing) so that it treats
each file independently from other files. The new semantics are
desired in the most of practical cases, e.g.: delete lines 5-9
from each file.
Keep the previous semantics of -i under a new option, -I, which
uses a single continuous address space covering all files to edit
in-place -- they are too cool to just drop them.
Add regression tests for -i and -I.
Approved by: dds
Compared with: GNU sed
Discussed on: -hackers
MFC after: 2 weeks
Diffstat (limited to 'usr.bin/sed/process.c')
-rw-r--r-- | usr.bin/sed/process.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 44c75f6..9ed541f 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -317,6 +317,19 @@ applies(struct s_command *cp) } /* + * Reset all inrange markers. + */ +void +resetranges(void) +{ + struct s_command *cp; + + for (cp = prog; cp; cp = cp->code == '{' ? cp->u.c : cp->next) + if (cp->a2) + cp->inrange = 0; +} + +/* * substitute -- * Do substitutions in the pattern space. Currently, we build a * copy of the new pattern space in the substitute space structure |