aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-05-09 18:32:54 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-05-09 18:32:54 +0000
commit5cda2aab7576b9cbf2aea01d6db60897368014be (patch)
tree41be7a43b146159cf9e978198c288e72a8131e3f
parent4a2d4f8e671c8d1fb4494b4a9f9ae9615b5dda19 (diff)
downloadbusybox-w32-5cda2aab7576b9cbf2aea01d6db60897368014be.tar.gz
busybox-w32-5cda2aab7576b9cbf2aea01d6db60897368014be.tar.bz2
busybox-w32-5cda2aab7576b9cbf2aea01d6db60897368014be.zip
less: fix case when regex search finds nothing
git-svn-id: svn://busybox.net/trunk/busybox@18593 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--miscutils/less.c8
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
789static void goto_match(int match) 789static 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