svn commit: trunk/busybox/miscutils

vda at busybox.net vda at busybox.net
Sun Apr 13 08:32:52 UTC 2008


Author: vda
Date: 2008-04-13 01:32:51 -0700 (Sun, 13 Apr 2008)
New Revision: 21727

Log:
less: fix somewhat elusive case when less gets stuck in search mode

function                                             old     new   delta
read_lines                                           719     730     +11
goto_match                                           141     116     -25



Modified:
   trunk/busybox/miscutils/less.c


Changeset:
Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2008-04-13 08:20:00 UTC (rev 21726)
+++ trunk/busybox/miscutils/less.c	2008-04-13 08:32:51 UTC (rev 21727)
@@ -384,6 +384,10 @@
 		linepos = 0;
 	} /* end of "read lines until we reach cur_fline" loop */
 	fill_match_lines(old_max_fline);
+#if ENABLE_FEATURE_LESS_REGEXP
+	/* prevent us from being stuck in search for a match */
+	wanted_match = -1;
+#endif
 #undef readbuf
 }
 
@@ -904,13 +908,8 @@
 		match = 0;
 	/* Try to find next match if eof isn't reached yet */
 	if (match >= num_matches && eof_error > 0) {
-		wanted_match = match;
+		wanted_match = match; /* "I want to read until I see N'th match" */
 		read_lines();
-		if (wanted_match >= num_matches) {
-			/* We still failed to find it. Prevent future
-			 * read_lines() from trying... */
-			wanted_match = num_matches - 1;
-		}
 	}
 	if (num_matches) {
 		normalize_match_pos(match);




More information about the busybox-cvs mailing list