summaryrefslogtreecommitdiffstats
path: root/bin/ed
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2016-10-11 06:54:05 +0000
committermartijn <martijn@openbsd.org>2016-10-11 06:54:05 +0000
commit5c1c5849605688a3bb686fdd60814068d5bab0b3 (patch)
tree5b98744ac9855286b4a5c2f1c2163ce16b22fc58 /bin/ed
parentModify httpd(8)'s proc.c to use less file descriptors during the daemon (diff)
downloadwireguard-openbsd-5c1c5849605688a3bb686fdd60814068d5bab0b3.tar.xz
wireguard-openbsd-5c1c5849605688a3bb686fdd60814068d5bab0b3.zip
Reimplement g flag for s commands. Got lost in previous commit.
Found because of a hint by and OK schwarze@.
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/sub.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ed/sub.c b/bin/ed/sub.c
index 0423c315786..6d22ed5245d 100644
--- a/bin/ed/sub.c
+++ b/bin/ed/sub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sub.c,v 1.17 2016/10/10 17:36:03 martijn Exp $ */
+/* $OpenBSD: sub.c,v 1.18 2016/10/11 06:54:05 martijn Exp $ */
/* $NetBSD: sub.c,v 1.4 1995/03/21 09:04:50 cgd Exp $ */
/* sub.c: This file contains the substitution routines for the ed
@@ -221,7 +221,7 @@ substitute_matching_text(regex_t *pat, line_t *lp, int gflag, int kth)
else
nempty = rm[0].rm_so = rm[0].rm_eo;
rm[0].rm_eo = lp->len;
- } while (rm[0].rm_so < lp->len &&
+ } while (rm[0].rm_so < lp->len && (gflag & GSG || kth) &&
!regexec(pat, txt, SE_MAX, rm, REG_STARTEND | REG_NOTBOL));
i = eot - eom;
REALLOC(rbuf, rbufsz, off + i + 2, ERR);