diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-13 08:32:51 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-13 08:32:51 +0000 |
commit | 24f824edb33597b8d43cc12f6b556cb6d3565b89 (patch) | |
tree | 6176ce9a7309de8c5e29a688ad909f56488509ca | |
parent | ffa4499c9f55e652e71acd0c4e5e9412ede37050 (diff) | |
download | busybox-w32-24f824edb33597b8d43cc12f6b556cb6d3565b89.tar.gz busybox-w32-24f824edb33597b8d43cc12f6b556cb6d3565b89.tar.bz2 busybox-w32-24f824edb33597b8d43cc12f6b556cb6d3565b89.zip |
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
-rw-r--r-- | miscutils/less.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index 1a67ca7ce..37ec5d976 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -384,6 +384,10 @@ static void read_lines(void) | |||
384 | linepos = 0; | 384 | linepos = 0; |
385 | } /* end of "read lines until we reach cur_fline" loop */ | 385 | } /* end of "read lines until we reach cur_fline" loop */ |
386 | fill_match_lines(old_max_fline); | 386 | fill_match_lines(old_max_fline); |
387 | #if ENABLE_FEATURE_LESS_REGEXP | ||
388 | /* prevent us from being stuck in search for a match */ | ||
389 | wanted_match = -1; | ||
390 | #endif | ||
387 | #undef readbuf | 391 | #undef readbuf |
388 | } | 392 | } |
389 | 393 | ||
@@ -904,13 +908,8 @@ static void goto_match(int match) | |||
904 | match = 0; | 908 | match = 0; |
905 | /* Try to find next match if eof isn't reached yet */ | 909 | /* Try to find next match if eof isn't reached yet */ |
906 | if (match >= num_matches && eof_error > 0) { | 910 | if (match >= num_matches && eof_error > 0) { |
907 | wanted_match = match; | 911 | wanted_match = match; /* "I want to read until I see N'th match" */ |
908 | read_lines(); | 912 | read_lines(); |
909 | if (wanted_match >= num_matches) { | ||
910 | /* We still failed to find it. Prevent future | ||
911 | * read_lines() from trying... */ | ||
912 | wanted_match = num_matches - 1; | ||
913 | } | ||
914 | } | 913 | } |
915 | if (num_matches) { | 914 | if (num_matches) { |
916 | normalize_match_pos(match); | 915 | normalize_match_pos(match); |