summaryrefslogtreecommitdiffstats
path: root/source/a/nvi/patches/nvi-15-search_word.patch
blob: 38c914b5eff3a7362bacba984dc9041ed9535c15 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/sh /usr/share/dpatch/dpatch-run
## 15search_word.dpatch by  Al Viro <viro@ZenIV.linux.org.uk>
##
## DP: Fix {^A} command. (End-of-word was not included in search
## DP: regexp leading to false positives.)

@DPATCH@
--- nvi-1.81.6.orig/vi/v_search.c	2007-11-18 11:41:42.000000000 -0500
+++ nvi-1.81.6/vi/v_search.c	2009-03-05 15:37:37.000000000 -0500
@@ -322,16 +322,17 @@
 v_searchw(SCR *sp, VICMD *vp)
 {
 	size_t blen, len;
+	size_t olen = STRLEN(VIP(sp)->keyw);
 	int rval;
 	CHAR_T *bp, *p;
 
-	len = VIP(sp)->klen + RE_WSTART_LEN + RE_WSTOP_LEN;
+	len = olen + RE_WSTART_LEN + RE_WSTOP_LEN;
 	GET_SPACE_RETW(sp, bp, blen, len);
 	MEMCPY(bp, RE_WSTART, RE_WSTART_LEN); 
 	p = bp + RE_WSTART_LEN;
-	MEMCPY(p, VIP(sp)->keyw, VIP(sp)->klen);
-	p += VIP(sp)->klen;
+	MEMCPY(p, VIP(sp)->keyw, olen);
+	p += olen;
 	MEMCPY(p, RE_WSTOP, RE_WSTOP_LEN); 
 
 	rval = v_search(sp, vp, bp, len, SEARCH_SET, FORWARD);