Currently vi in Busybox doesn't support filtering text through an
external command with ':1,2!cmd'.  Instead it behaves as if no
range had been supplied and displays the output of the command.

Issue a warning and do nothing in such cases.

function                                             old     new   delta
colon                                               4076    4096     +20
.rodata                                           100563  100581     +18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 38/0)               Total: 38 bytes

Signed-off-by: Ron Yorston <[email protected]>
---
 editors/vi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/editors/vi.c b/editors/vi.c
index 34932f60c..f48bcf514 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2951,6 +2951,10 @@ static void colon(char *buf)
        else if (cmd[0] == '!') {       // run a cmd
                int retcode;
                // :!ls   run the <cmd>
+               if (GOT_ADDRESS) {
+                       status_line_bold("Range not allowed");
+                       goto ret;
+               }
                exp = expand_args(buf + 1);
                if (exp == NULL)
                        goto ret;
-- 
2.51.0

_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to