Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrob Grobmann <grobgrobmann@gmail.com>2022-06-08 22:51:54 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2022-08-02 16:05:12 +0300
commit3147552a230cfd4a4943a46f63e3313655acf566 (patch)
treed7b8aec447af9de34a65bdd8827f9663d2c7bcf6 /editors
parent9eddf164bf22a20e8033fad2dc35cde2d6bd2305 (diff)
vi: add 'ZQ' quitting command
Busybox vi provides the 'ZZ' command to save and close the similar 'ZQ' command just exits without saving. function old new delta do_cmd 4222 4244 +22 Signed-off-by: Grob Grobmann <grobgrobmann@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/vi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index d799a8170..1f997e8e5 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -4324,8 +4324,14 @@ static void do_cmd(int c)
goto dc_i; // start inserting
break;
case 'Z': // Z- if modified, {write}; exit
- // ZZ means to save file (if necessary), then exit
c1 = get_one_char();
+ // ZQ means to exit without saving
+ if (c1 == 'Q') {
+ editing=0;
+ optind = cmdline_filecnt;
+ break;
+ }
+ // ZZ means to save file (if necessary), then exit
if (c1 != 'Z') {
indicate_error();
break;