diff options
author | Grob Grobmann <grobgrobmann@gmail.com> | 2022-06-08 16:51:54 -0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-08-02 15:05:12 +0200 |
commit | 3147552a230cfd4a4943a46f63e3313655acf566 (patch) | |
tree | d7b8aec447af9de34a65bdd8827f9663d2c7bcf6 | |
parent | 9eddf164bf22a20e8033fad2dc35cde2d6bd2305 (diff) | |
download | busybox-w32-3147552a230cfd4a4943a46f63e3313655acf566.tar.gz busybox-w32-3147552a230cfd4a4943a46f63e3313655acf566.tar.bz2 busybox-w32-3147552a230cfd4a4943a46f63e3313655acf566.zip |
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>
-rw-r--r-- | editors/vi.c | 8 |
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) | |||
4324 | goto dc_i; // start inserting | 4324 | goto dc_i; // start inserting |
4325 | break; | 4325 | break; |
4326 | case 'Z': // Z- if modified, {write}; exit | 4326 | case 'Z': // Z- if modified, {write}; exit |
4327 | // ZZ means to save file (if necessary), then exit | ||
4328 | c1 = get_one_char(); | 4327 | c1 = get_one_char(); |
4328 | // ZQ means to exit without saving | ||
4329 | if (c1 == 'Q') { | ||
4330 | editing=0; | ||
4331 | optind = cmdline_filecnt; | ||
4332 | break; | ||
4333 | } | ||
4334 | // ZZ means to save file (if necessary), then exit | ||
4329 | if (c1 != 'Z') { | 4335 | if (c1 != 'Z') { |
4330 | indicate_error(); | 4336 | indicate_error(); |
4331 | break; | 4337 | break; |