diff options
Diffstat (limited to 'lib/vty.c')
-rw-r--r-- | lib/vty.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -90,6 +90,25 @@ static u_char restricted_mode = 0; char integrate_default[] = SYSCONFDIR INTEGRATE_DEFAULT_CONFIG; +void +vty_prepend (struct vty *vty, const char *format, ...) +{ + va_list args; + + va_start (args, format); + vsnprintf (vty->prepend + vty->prepend_pos, + sizeof(vty->prepend) - vty->prepend_pos, + format, args); + vty->prepend_pos = strlen (vty->prepend); + va_end (args); +} + +void +vty_unprepend (struct vty *vty) +{ + vty->prepend_pos = 0; +} + /* VTY standard output function. */ int vty_out (struct vty *vty, const char *format, ...) @@ -100,6 +119,12 @@ vty_out (struct vty *vty, const char *format, ...) char buf[1024]; char *p = NULL; + if (vty->prepend_pos) + { + vty->prepend_pos = 0; + vty_out (vty, "%s", vty->prepend); + } + if (vty_shell (vty)) { va_start (args, format); |