From 65b331b4a19ecf3dc073e2363cb8294e986ded44 Mon Sep 17 00:00:00 2001 From: yar Date: Sat, 21 Apr 2007 01:21:36 +0000 Subject: 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 --- usr.bin/sed/process.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'usr.bin/sed/process.c') 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 -- cgit v1.1