61626005754dc017074ff12db302aa422d46b646
[openwrt-10.03/.git] / package / busybox / patches / 480-vi_search.patch
1 --- a/editors/vi.c
2 +++ b/editors/vi.c
3 @@ -3313,7 +3313,7 @@ static void do_cmd(char c)
4                 buf[1] = '\0';
5                 q = get_input_line(buf);        // get input line- use "status line"
6                 if (q[0] && !q[1]) {
7 -                       if (last_search_pattern[0])
8 +                       if (last_search_pattern)
9                             last_search_pattern[0] = c;
10                         goto dc3; // if no pat re-use old pat
11                 }
12 @@ -3329,6 +3329,10 @@ static void do_cmd(char c)
13                 if (cmdcnt-- > 1) {
14                         do_cmd(c);
15                 }                               // repeat cnt
16 +               if (last_search_pattern == 0) {
17 +                       msg = "No previous regular expression";
18 +                       goto dc2;
19 +               }
20                 dir = BACK;             // assume BACKWARD search
21                 p = dot - 1;
22                 if (last_search_pattern[0] == '?') {
23 @@ -3348,10 +3352,8 @@ static void do_cmd(char c)
24                         msg = "No previous regular expression";
25                         goto dc2;
26                 }
27 -               if (last_search_pattern[0] == '/') {
28 -                       dir = FORWARD;  // assume FORWARD search
29 -                       p = dot + 1;
30 -               }
31 +               dir = FORWARD;  // assume FORWARD search
32 +               p = dot + 1;
33                 if (last_search_pattern[0] == '?') {
34                         dir = BACK;
35                         p = dot - 1;