Subject: Re: bin/730: ed 1,$s/a/b/p command prints wrong line.
To: John F. Woods <jfw@jfwhome.funhouse.com>
From: Andrew Moore <alm@netcom.com>
List: netbsd-bugs
Date: 01/14/1995 03:30:46
>>Number:         730
>>Category:       bin
>>Synopsis:       ed 1,$s/a/b/p command prints wrong line.

Below is a patch.  Could someone please apply this for me? I am on my
way out of town and sun-lamp is not reachable at the moment.  Thanks.
-AM

diff -u -r1.1 sub.c
--- 1.1	1994/07/10 01:14:06
+++ sub.c	1995/01/14 11:09:29
@@ -122,6 +122,7 @@
 	char *txt;
 	char *eot;
 	long lc;
+	long xa = current_addr;
 	int nsubs = 0;
 	line_t *lp;
 	int len;
@@ -152,8 +153,10 @@
 			} while (txt != eot);
 			SPL0();
 			nsubs++;
+			xa = current_addr;
 		}
 	}
+	current_addr = xa;
 	if  (nsubs == 0 && !(gflag & GLB)) {
 		sprintf(errmsg, "no match");
 		return ERR;