summaryrefslogtreecommitdiffstats
path: root/bin/ed/sub.c
diff options
context:
space:
mode:
authoralm <alm@FreeBSD.org>1995-01-14 11:47:16 +0000
committeralm <alm@FreeBSD.org>1995-01-14 11:47:16 +0000
commita8457251d86ea194903d3e90fd12d2b9c12bb3a3 (patch)
tree7dfefbb3758aea38eb016dbe551086b4a84ee6f7 /bin/ed/sub.c
parent5fd14a31198cc1c92e6ed888814f198cedce677b (diff)
downloadFreeBSD-src-a8457251d86ea194903d3e90fd12d2b9c12bb3a3.zip
FreeBSD-src-a8457251d86ea194903d3e90fd12d2b9c12bb3a3.tar.gz
fixed `s' to set dot to last line affected, not the last line in
a substitution range.
Diffstat (limited to 'bin/ed/sub.c')
-rw-r--r--bin/ed/sub.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ed/sub.c b/bin/ed/sub.c
index 0243076..c23e4a2 100644
--- a/bin/ed/sub.c
+++ b/bin/ed/sub.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: sub.c,v 1.3 1994/09/24 02:55:31 davidg Exp $
*/
#ifndef lint
@@ -124,6 +124,7 @@ search_and_replace(pat, gflag, kth)
char *txt;
char *eot;
long lc;
+ long xa = current_addr;
int nsubs = 0;
line_t *lp;
int len;
@@ -154,8 +155,10 @@ search_and_replace(pat, gflag, kth)
} while (txt != eot);
SPL0();
nsubs++;
+ xa = current_addr;
}
}
+ current_addr = xa;
if (nsubs == 0 && !(gflag & GLB)) {
sprintf(errmsg, "no match");
return ERR;
OpenPOWER on IntegriCloud