diff options
author | Ron Yorston <rmy@pobox.com> | 2016-10-19 17:01:55 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-10-19 17:01:55 +0100 |
commit | 075814c60a316cfd088c88f26f75ab21b5850b98 (patch) | |
tree | f6e33ac693630827deb309faa5fa4931588db57d /editors | |
parent | 977d65c1bbc57f5cdd0c8bfd67c8b5bb1cd390dd (diff) | |
parent | f37e1155aabde6bd95d267a8aec347cedccb8bc3 (diff) | |
download | busybox-w32-075814c60a316cfd088c88f26f75ab21b5850b98.tar.gz busybox-w32-075814c60a316cfd088c88f26f75ab21b5850b98.tar.bz2 busybox-w32-075814c60a316cfd088c88f26f75ab21b5850b98.zip |
Merge branch busybox (up to "ash: comment out free(p) just before...")
Diffstat (limited to 'editors')
-rw-r--r-- | editors/sed.c | 19 | ||||
-rw-r--r-- | editors/vi.c | 14 |
2 files changed, 18 insertions, 15 deletions
diff --git a/editors/sed.c b/editors/sed.c index 2e99dc792..63ca1dc99 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1305,16 +1305,17 @@ static void process_files(void) | |||
1305 | case 'n': | 1305 | case 'n': |
1306 | if (!G.be_quiet) | 1306 | if (!G.be_quiet) |
1307 | sed_puts(pattern_space, last_gets_char); | 1307 | sed_puts(pattern_space, last_gets_char); |
1308 | if (next_line) { | 1308 | if (next_line == NULL) { |
1309 | free(pattern_space); | 1309 | /* If no next line, jump to end of script and exit. */ |
1310 | pattern_space = next_line; | 1310 | goto discard_line; |
1311 | last_gets_char = next_gets_char; | ||
1312 | next_line = get_next_line(&next_gets_char, &last_puts_char); | ||
1313 | substituted = 0; | ||
1314 | linenum++; | ||
1315 | break; | ||
1316 | } | 1311 | } |
1317 | /* fall through */ | 1312 | free(pattern_space); |
1313 | pattern_space = next_line; | ||
1314 | last_gets_char = next_gets_char; | ||
1315 | next_line = get_next_line(&next_gets_char, &last_puts_char); | ||
1316 | substituted = 0; | ||
1317 | linenum++; | ||
1318 | break; | ||
1318 | 1319 | ||
1319 | /* Quit. End of script, end of input. */ | 1320 | /* Quit. End of script, end of input. */ |
1320 | case 'q': | 1321 | case 'q': |
diff --git a/editors/vi.c b/editors/vi.c index da7464b58..b81f2b92d 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2722,9 +2722,8 @@ static char *swap_context(char *p) // goto new context for '' command make this | |||
2722 | // only swap context if other context is valid | 2722 | // only swap context if other context is valid |
2723 | if (text <= mark[27] && mark[27] <= end - 1) { | 2723 | if (text <= mark[27] && mark[27] <= end - 1) { |
2724 | tmp = mark[27]; | 2724 | tmp = mark[27]; |
2725 | mark[27] = mark[26]; | 2725 | mark[27] = p; |
2726 | mark[26] = tmp; | 2726 | mark[26] = p = tmp; |
2727 | p = mark[26]; // where we are going- previous context | ||
2728 | context_start = prev_line(prev_line(prev_line(p))); | 2727 | context_start = prev_line(prev_line(prev_line(p))); |
2729 | context_end = next_line(next_line(next_line(p))); | 2728 | context_end = next_line(next_line(next_line(p))); |
2730 | } | 2729 | } |
@@ -3665,8 +3664,9 @@ static void do_cmd(int c) | |||
3665 | } | 3664 | } |
3666 | break; | 3665 | break; |
3667 | case '\'': // '- goto a specific mark | 3666 | case '\'': // '- goto a specific mark |
3668 | c1 = (get_one_char() | 0x20) - 'a'; | 3667 | c1 = (get_one_char() | 0x20); |
3669 | if ((unsigned)c1 <= 25) { // a-z? | 3668 | if ((unsigned)(c1 - 'a') <= 25) { // a-z? |
3669 | c1 = (c1 - 'a'); | ||
3670 | // get the b-o-l | 3670 | // get the b-o-l |
3671 | q = mark[c1]; | 3671 | q = mark[c1]; |
3672 | if (text <= q && q < end) { | 3672 | if (text <= q && q < end) { |
@@ -3980,7 +3980,9 @@ static void do_cmd(int c) | |||
3980 | c1 = get_one_char(); | 3980 | c1 = get_one_char(); |
3981 | if (c1 != 'g') { | 3981 | if (c1 != 'g') { |
3982 | buf[0] = 'g'; | 3982 | buf[0] = 'g'; |
3983 | buf[1] = c1; // TODO: if Unicode? | 3983 | // c1 < 0 if the key was special. Try "g<up-arrow>" |
3984 | // TODO: if Unicode? | ||
3985 | buf[1] = (c1 >= 0 ? c1 : '*'); | ||
3984 | buf[2] = '\0'; | 3986 | buf[2] = '\0'; |
3985 | not_implemented(buf); | 3987 | not_implemented(buf); |
3986 | break; | 3988 | break; |