Mailing List Archive

[PATCH] vty: Add Esc-? and ctrl-v <literal>, to allow '?' to be input (e.g for regex)
From: Paul Jakma <paul.jakma@hpe.com>

---
lib/vty.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/lib/vty.c b/lib/vty.c
index 7ba277f..2c5911a 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1340,8 +1340,9 @@ vty_execute (struct vty *vty)

#define CONTROL(X) ((X) - '@')
#define VTY_NORMAL 0
-#define VTY_PRE_ESCAPE 1
-#define VTY_ESCAPE 2
+#define VTY_PRE_ESCAPE 1 /* Esc seen */
+#define VTY_ESCAPE 2 /* ANSI terminal escape (Esc-[.) seen */
+#define VTY_ESC_LITERAL 3 /* Escape next char as literal */

/* Escape character command map. */
static void
@@ -1469,7 +1470,14 @@ vty_read (struct thread *thread)
vty_escape_map (buf[i], vty);
continue;
}
-
+
+ if (vty->escape == VTY_ESC_LITERAL)
+ {
+ vty_self_insert (vty, buf[i]);
+ vty->escape = VTY_NORMAL;
+ continue;
+ }
+
/* Pre-escape status. */
if (vty->escape == VTY_PRE_ESCAPE)
{
@@ -1495,6 +1503,10 @@ vty_read (struct thread *thread)
vty_backward_kill_word (vty);
vty->escape = VTY_NORMAL;
break;
+ case '?':
+ vty_self_insert (vty, buf[i]);
+ vty->escape = VTY_NORMAL;
+ break;
default:
vty->escape = VTY_NORMAL;
break;
@@ -1541,6 +1553,9 @@ vty_read (struct thread *thread)
case CONTROL('U'):
vty_kill_line_from_beginning (vty);
break;
+ case CONTROL('V'):
+ vty->escape = VTY_ESC_LITERAL;
+ break;
case CONTROL('W'):
vty_backward_kill_word (vty);
break;
--
2.7.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev
Re: [PATCH] vty: Add Esc-? and ctrl-v <literal>, to allow '?' to be input (e.g for regex) [ In reply to ]
Le 12/01/2017 ? 15:29, Paul Jakma a ?crit :
> From: Paul Jakma <paul.jakma@hpe.com>
>
> ---
> lib/vty.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
Paul,

please, can you add a proper log?, then it is a patch good to go.

Acked-by: Vincent.Jardin@6wind.com

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev
Re: [PATCH] vty: Add Esc-? and ctrl-v <literal>, to allow '?' to be input (e.g for regex) [ In reply to ]
On Thu, 12 Jan 2017, Vincent JARDIN wrote:

> please, can you add a proper log?, then it is a patch good to go.
>
> Acked-by: Vincent.Jardin@6wind.com

Thanks for the review. Silly patch, but I still use the telnet UI for
testing sometimes.

I removed the 'Esc-?' option, non-standard.

regards,
--
Paul Jakma, HPE Aruba, Advanced Technology Group
Fortune:
By failing to prepare, you are preparing to fail.

_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev