Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/nvi/dist/common Fix missing of "search wrapped"...



details:   https://anonhg.NetBSD.org/src/rev/c5fc8fefb59c
branches:  trunk
changeset: 357714:c5fc8fefb59c
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Nov 22 16:17:30 2017 +0000

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

diffstat:

 external/bsd/nvi/dist/common/search.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 87790b86f875 -r c5fc8fefb59c external/bsd/nvi/dist/common/search.c
--- a/external/bsd/nvi/dist/common/search.c     Wed Nov 22 15:25:34 2017 +0000
+++ b/external/bsd/nvi/dist/common/search.c     Wed Nov 22 16:17:30 2017 +0000
@@ -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 @@
        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 @@
                                        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;



Home | Main Index | Thread Index | Old Index