diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-09 18:32:54 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-09 18:32:54 +0000 |
commit | 8465a99ce79ec805ea2063c3f571e2578650a984 (patch) | |
tree | 41be7a43b146159cf9e978198c288e72a8131e3f /miscutils/less.c | |
parent | bf678d54237698a79d41ea3ae49d885f0e83bec4 (diff) | |
download | busybox-w32-8465a99ce79ec805ea2063c3f571e2578650a984.tar.gz busybox-w32-8465a99ce79ec805ea2063c3f571e2578650a984.tar.bz2 busybox-w32-8465a99ce79ec805ea2063c3f571e2578650a984.zip |
less: fix case when regex search finds nothing
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index b81430d07..138bd4711 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -788,19 +788,25 @@ static void normalize_match_pos(int match) | |||
788 | 788 | ||
789 | static void goto_match(int match) | 789 | static void goto_match(int match) |
790 | { | 790 | { |
791 | int sv; | ||
792 | |||
791 | if (!pattern_valid) | 793 | if (!pattern_valid) |
792 | return; | 794 | return; |
793 | if (match < 0) | 795 | if (match < 0) |
794 | match = 0; | 796 | match = 0; |
797 | sv = cur_fline; | ||
795 | /* Try to find next match if eof isn't reached yet */ | 798 | /* Try to find next match if eof isn't reached yet */ |
796 | if (match >= num_matches && eof_error > 0) { | 799 | if (match >= num_matches && eof_error > 0) { |
797 | cur_fline = MAXLINES; /* look as far as needed */ | 800 | cur_fline = MAXLINES; /* look as far as needed */ |
798 | read_lines(); | 801 | read_lines(); |
799 | cap_cur_fline(cur_fline); | ||
800 | } | 802 | } |
801 | if (num_matches) { | 803 | if (num_matches) { |
804 | cap_cur_fline(cur_fline); | ||
802 | normalize_match_pos(match); | 805 | normalize_match_pos(match); |
803 | buffer_line(match_lines[match_pos]); | 806 | buffer_line(match_lines[match_pos]); |
807 | } else { | ||
808 | cur_fline = sv; | ||
809 | print_statusline("No matches found"); | ||
804 | } | 810 | } |
805 | } | 811 | } |
806 | 812 | ||