Module Name:    src
Committed By:   rin
Date:           Wed Nov 22 16:17:30 UTC 2017

Modified Files:
        src/external/bsd/nvi/dist/common: search.c

Log Message:
Fix missing of "search wrapped" message when searching from the last char of
file, taken from nvi2:
https://github.com/lichray/nvi2/commit/a59e892d23212559eb1001e5d2a312a02e357651


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/common/search.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/common/search.c
diff -u src/external/bsd/nvi/dist/common/search.c:1.3 src/external/bsd/nvi/dist/common/search.c:1.4
--- src/external/bsd/nvi/dist/common/search.c:1.3	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/common/search.c	Wed Nov 22 16:17:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: search.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: search.c,v 1.4 2017/11/22 16:17:30 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: search.c,v 10.31 2001/06/25 15:19:12 skimo Exp  (Berkeley) Date: 2001/06/25 15:19:12 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: search.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: search.c,v 1.4 2017/11/22 16:17:30 rin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -148,7 +148,7 @@ f_search(SCR *sp, MARK *fm, MARK *rm, CH
 	db_recno_t lno;
 	regmatch_t match[1];
 	size_t coff, len;
-	int cnt, eval, rval, wrapped;
+	int cnt, eval, rval, wrapped = 0;
 	CHAR_T *l;
 
 	if (search_init(sp, FORWARD, ptrn, plen, eptrn, flags))
@@ -191,13 +191,14 @@ f_search(SCR *sp, MARK *fm, MARK *rm, CH
 					return (1);
 				}
 				lno = 1;
+				wrapped = 1;
 			}
 		} else
 			coff = fm->cno + 1;
 	}
 
 	btype = BUSY_ON;
-	for (cnt = INTERRUPT_CHECK, rval = 1, wrapped = 0;; ++lno, coff = 0) {
+	for (cnt = INTERRUPT_CHECK, rval = 1;; ++lno, coff = 0) {
 		if (cnt-- == 0) {
 			if (INTERRUPTED(sp))
 				break;

Reply via email to