]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: de-uglify `-t` option + `log stdout` combo
authorDavid Lamparter <equinox@diac24.net>
Thu, 4 Feb 2021 21:27:11 +0000 (22:27 +0100)
committerDavid Lamparter <equinox@diac24.net>
Fri, 12 Feb 2021 18:29:36 +0000 (19:29 +0100)
The logging code writes log messages with a `\n` line ending, meanwhile
the VTY code switches it so you need `\r\n`...

And we don't flush the newline after executing a command either.

After this patch, starting daemons like `zebra/zebra -t` should provide
a nice development/debugging experience with a VTY open right there on
stdio and `log stdout` interspersed.

(This is already documented in the man pages, it just looked like sh*t
previously since the log messages didn't newline correctly.)

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/vty.c

index 4062b183e721178ad22649e2f04ff417aaf24899..76fe785609a81c6034c284799524637eb1b70ae3 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1470,6 +1470,7 @@ static int vty_read(struct thread *thread)
                case '\n':
                case '\r':
                        vty_out(vty, "\n");
+                       buffer_flush_available(vty->obuf, vty_sock);
                        vty_execute(vty);
                        break;
                case '\t':
@@ -1714,7 +1715,6 @@ void vty_stdio_resume(void)
                termios = stdio_orig_termios;
                termios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
                                     | IGNCR | ICRNL | IXON);
-               termios.c_oflag &= ~OPOST;
                termios.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
                termios.c_cflag &= ~(CSIZE | PARENB);
                termios.c_cflag |= CS8;