summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/process.c
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2007-04-21 01:21:36 +0000
committeryar <yar@FreeBSD.org>2007-04-21 01:21:36 +0000
commit65b331b4a19ecf3dc073e2363cb8294e986ded44 (patch)
treeca61296c60f091c362f574d1212cf29938a3745f /usr.bin/sed/process.c
parenta1e73b1eafb356ff4adba96fd8099c15c11471cd (diff)
downloadFreeBSD-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.c13
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
OpenPOWER on IntegriCloud