aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2021-09-09 15:42:32 +0200
committerEric <ewild@sysmocom.de>2021-09-10 14:50:26 +0200
commit11a58a1b34f8bba398f16358a863a0ab273c8307 (patch)
treecbc54065e2c108b777ad1004fa16e8537922ece9
parenta7a757f2eec39c3f4ce01055327c3ec84ee39ef0 (diff)
vty: allow flushing
It was so far sufficient to wait for the buffers to drain at some random point in time, but this is not always the case, sometimes it is important that the output is flushed immediately. Change-Id: If984b9ad2eba9f400bc29a7aa8825e241fd1d2a9
-rw-r--r--include/osmocom/vty/vty.h1
-rw-r--r--src/vty/vty.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index 3e6178f1..c13f4356 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -222,6 +222,7 @@ int vty_out_newline(struct vty *);
int vty_read(struct vty *vty);
//void vty_time_print (struct vty *, int);
void vty_close (struct vty *);
+void vty_flush(struct vty *vty);
char *vty_get_cwd (void);
void vty_log (const char *level, const char *proto, const char *fmt, va_list);
int vty_config_lock (struct vty *);
diff --git a/src/vty/vty.c b/src/vty/vty.c
index a39f2680..1ad84f53 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -207,6 +207,12 @@ static void vty_auth(struct vty *vty)
}
}
+void vty_flush(struct vty *vty)
+{
+ if (vty->obuf)
+ buffer_flush_all(vty->obuf, vty->fd);
+}
+
/*! Close a given vty interface. */
void vty_close(struct vty *vty)
{