From 55d24e7f3dbc69db37781dbff325bda0779778df Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Fri, 5 Feb 2010 09:48:45 +0100 Subject: lib: get rid of extraneous output with vty_prepend the vty_*prepend* family can be used to reduce the amount of output produced by "show running-config" and "write ...". it buffers output in struct vty->prepend (1024 bytes) and outputs it when vty_out is called. if vty_out isn't called, it can be removed with vty_unprepend later. applied on zebra and ospfd to get rid of empty interface blocks. --- lib/vty.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/vty.h') diff --git a/lib/vty.h b/lib/vty.h index 7df04b5f..d8f47d86 100644 --- a/lib/vty.h +++ b/lib/vty.h @@ -118,6 +118,10 @@ struct vty /* Timeout seconds and thread. */ unsigned long v_timeout; struct thread *t_timeout; + + /* Auto-prepending; any vty_out will print this buffer, then clear it: */ + int prepend_pos; + char prepend[1024]; }; /* Integrated configuration file. */ @@ -207,6 +211,9 @@ extern void vty_terminate (void); extern void vty_reset (void); extern struct vty *vty_new (void); extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3); +extern void vty_prepend (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3); +extern void vty_unprepend (struct vty *); +#define vty_prepending(v) ((v)->prepend_pos) extern void vty_read_config (char *, char *); extern void vty_time_print (struct vty *, int); extern void vty_serv_sock (const char *, unsigned short, const char *); -- cgit v1.2.3