diff options
author | Denys Vlasenko | 2019-04-03 16:35:23 +0200 |
---|---|---|
committer | Denys Vlasenko | 2019-04-03 16:35:23 +0200 |
commit | a3ce161363380899ae45716c70714cfcc93a7755 (patch) | |
tree | 81cc4fe0bd0e1ece8b86164d4ea76e9211970cf7 /editors | |
parent | e1a1b64f433661188d9e5591f2137860dab0c18a (diff) | |
download | busybox-a3ce161363380899ae45716c70714cfcc93a7755.zip busybox-a3ce161363380899ae45716c70714cfcc93a7755.tar.gz |
vi: revert change in how "end of file list" is deteced - fixes 'q' in bare "vi"
function old new delta
vi_main 273 272 -1
colon 2853 2852 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-2) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editors/vi.c b/editors/vi.c index 38177de..c4360f8 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2625,7 +2625,7 @@ static void colon(char *buf) if (useforce) { if (*cmd == 'q') { // force end of argv list - optind = cmdline_filecnt - 1; + optind = cmdline_filecnt; } editing = 0; goto ret; @@ -4384,7 +4384,7 @@ int vi_main(int argc, char **argv) edit_file(argv[optind]); // might be NULL on 1st iteration // NB: optind can be changed by ":next" and ":rewind" commands optind++; - if (!argv[optind]) + if (optind >= cmdline_filecnt) break; } // "Use normal screen buffer, restore cursor" |