]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
vty_cli: add kill forward word handler
authorFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 28 Oct 2010 07:33:26 +0000 (09:33 +0200)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Thu, 28 Oct 2010 07:33:26 +0000 (09:33 +0200)
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
vty_cli.c

index b3d0d1c397f340ba2f62c3616e574dc54ac70705..a245304048fc613a35fdea9d9b0b9e9ff57ea9b4 100644 (file)
--- a/vty_cli.c
+++ b/vty_cli.c
@@ -170,6 +170,15 @@ static void knet_vty_backward_kill_word(struct knet_vty *vty)
                knet_vty_delete_backward_char(vty);
 }
 
+static void knet_vty_forward_kill_word(struct knet_vty *vty)
+{
+       while(vty->cursor_pos != vty->line_idx && vty->line[vty->cursor_pos] == ' ')
+               knet_vty_delete_char(vty);
+
+       while(vty->cursor_pos != vty->line_idx && vty->line[vty->cursor_pos] != ' ')
+               knet_vty_delete_backward_char(vty);
+}
+
 static int knet_vty_process_buf(struct knet_vty *vty, unsigned char *buf, int buflen)
 {
        int i;
@@ -214,7 +223,7 @@ static int knet_vty_process_buf(struct knet_vty *vty, unsigned char *buf, int bu
                                        break;
                                case 'd':
                                        vty->escape = VTY_NORMAL;
-                                       log_info("forward kill word");
+                                       knet_vty_forward_kill_word(vty);
                                        break;
                                case CONTROL('H'):
                                case 0x7f: