aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJeremie Le Hen <jlh@FreeBSD.org>2014-07-30 14:46:39 +0000
committerJeremie Le Hen <jlh@FreeBSD.org>2014-07-30 14:46:39 +0000
commitb38ebc05386102e78ac3cae92f0c9778bcd0ce8f (patch)
tree136d90d1b520b15d30ed4d9dece468eb6708fae7 /usr.bin
parent27c095f49ee3b74a31994241052d4d768da5745c (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sed/process.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 5e2618ae98fd6..a500200dd87d0 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -288,24 +288,32 @@ applies(struct s_command *cp)
r = 1;
else if (cp->a2)
if (cp->startline > 0) {
- if (MATCH(cp->a2)) {
- cp->startline = 0;
- lastaddr = 1;
- r = 1;
- } else if (linenum - cp->startline <= cp->a2->u.l)
- r = 1;
- else if ((cp->a2->type == AT_LINE &&
- linenum > cp->a2->u.l) ||
- (cp->a2->type == AT_RELLINE &&
- linenum - cp->startline > cp->a2->u.l)) {
- /*
- * We missed the 2nd address due to a branch,
- * so just close the range and return false.
- */
- cp->startline = 0;
- r = 0;
- } else
- r = 1;
+ switch (cp->a2->type) {
+ case AT_RELLINE:
+ if (linenum - cp->startline <= cp->a2->u.l)
+ r = 1;
+ else {
+ cp->startline = 0;
+ r = 0;
+ }
+ break;
+ default:
+ if (MATCH(cp->a2)) {
+ cp->startline = 0;
+ lastaddr = 1;
+ r = 1;
+ } else if (cp->a2->type == AT_LINE &&
+ linenum > cp->a2->u.l) {
+ /*
+ * We missed the 2nd address due to a
+ * branch, so just close the range and
+ * return false.
+ */
+ cp->startline = 0;
+ r = 0;
+ } else
+ r = 1;
+ }
} else if (MATCH(cp->a1)) {
/*
* If the second address is a number less than or