summaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-11-09 17:21:26 +0000
committerDenis Vlasenko2008-11-09 17:21:26 +0000
commit84641942e5366b2e09367ba4f4376c99f15ecc8e (patch)
treeeff2511dcc6cb647e0bf898903f86c94b85466ad /editors/vi.c
parentbacaff6e5474d6c5f080ce4cd2a55e8ff1ba5c94 (diff)
downloadbusybox-84641942e5366b2e09367ba4f4376c99f15ecc8e.zip
busybox-84641942e5366b2e09367ba4f4376c99f15ecc8e.tar.gz
apply post-1.12.1 patches, bump version to 1.12.21_12_2
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 02bdbb3..4accfdb 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -291,6 +291,8 @@ struct globals {
#define INIT_G() do { \
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
last_file_modified = -1; \
+ /* "" but has space for 2 chars */ \
+ USE_FEATURE_VI_SEARCH(last_search_pattern = xzalloc(2);) \
} while (0)
@@ -2974,7 +2976,7 @@ static void do_cmd(char c)
const char *msg = msg; // for compiler
char c1, *p, *q, *save_dot;
char buf[12];
- int dir = dir; // for compiler
+ int dir;
int cnt, i, j;
// c1 = c; // quiet the compiler
@@ -3316,7 +3318,7 @@ static void do_cmd(char c)
q = get_input_line(buf); // get input line- use "status line"
if (q[0] && !q[1]) {
if (last_search_pattern[0])
- last_search_pattern[0] = c;
+ last_search_pattern[0] = c;
goto dc3; // if no pat re-use old pat
}
if (q[0]) { // strlen(q) > 1: new pat- save it and find
@@ -3346,14 +3348,8 @@ static void do_cmd(char c)
do_cmd(c);
} // repeat cnt
dc3:
- if (last_search_pattern == 0) {
- msg = "No previous regular expression";
- goto dc2;
- }
- if (last_search_pattern[0] == '/') {
- dir = FORWARD; // assume FORWARD search
- p = dot + 1;
- }
+ dir = FORWARD; // assume FORWARD search
+ p = dot + 1;
if (last_search_pattern[0] == '?') {
dir = BACK;
p = dot - 1;