Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/usr.bin/sed Pull up following revision(s) (requested by c...
details: https://anonhg.NetBSD.org/src/rev/5a3780cae0c5
branches: netbsd-7
changeset: 798263:5a3780cae0c5
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 18 07:44:03 2014 +0000
description:
Pull up following revision(s) (requested by christos in ticket #34):
usr.bin/sed/process.c: revision 1.46
PR/49109: Jeremie Le Hen: fix sed relative addressin (1,+N)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192108
http://svnweb.freebsd.org/base?view=revision&revision=269302
XXX: pullup 7.
diffstat:
usr.bin/sed/process.c | 48 ++++++++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 20 deletions(-)
diffs (69 lines):
diff -r fffdee8dba3a -r 5a3780cae0c5 usr.bin/sed/process.c
--- a/usr.bin/sed/process.c Mon Aug 18 07:42:02 2014 +0000
+++ b/usr.bin/sed/process.c Mon Aug 18 07:44:03 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process.c,v 1.45 2014/06/26 02:14:32 christos Exp $ */
+/* $NetBSD: process.c,v 1.45.2.1 2014/08/18 07:44:03 martin Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@@ -38,7 +38,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: process.c,v 1.45 2014/06/26 02:14:32 christos Exp $");
+__RCSID("$NetBSD: process.c,v 1.45.2.1 2014/08/18 07:44:03 martin Exp $");
#ifdef __FBSDID
__FBSDID("$FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $");
#endif
@@ -295,24 +295,32 @@
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 (cp->a1 && MATCH(cp->a1)) {
/*
* If the second address is a number less than or
Home |
Main Index |
Thread Index |
Old Index