[master] 6c4f3f8de vcli: Provide a VTE callback
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Aug 21 20:52:07 UTC 2023
commit 6c4f3f8deaaad29fd87fac407c39368facc14bea
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Thu Aug 17 15:08:40 2023 +0200
vcli: Provide a VTE callback
diff --git a/include/vcli_serve.h b/include/vcli_serve.h
index f3757f28b..00eae9c83 100644
--- a/include/vcli_serve.h
+++ b/include/vcli_serve.h
@@ -109,5 +109,8 @@ cli_func_t VCLS_func_help_json;
cli_func_t VCLS_func_ping;
cli_func_t VCLS_func_ping_json;
+/* VTE integration */
+int VCLI_VTE_format(void *priv, const char *fmt, ...) v_printflike_(2, 3);
+
/* From libvarnish/vte.c */
void VCLI_VTE(struct cli *cli, struct vsb **src, int width);
diff --git a/lib/libvarnish/vcli_serve.c b/lib/libvarnish/vcli_serve.c
index a6cce1ddf..40b46947f 100644
--- a/lib/libvarnish/vcli_serve.c
+++ b/lib/libvarnish/vcli_serve.c
@@ -661,6 +661,22 @@ VCLI_Out(struct cli *cli, const char *fmt, ...)
va_end(ap);
}
+int v_matchproto_(VTE_format_f)
+VCLI_VTE_format(void *priv, const char *fmt, ...)
+{
+ struct cli *cli;
+ va_list ap;
+
+ CAST_OBJ_NOTNULL(cli, priv, CLI_MAGIC);
+ AN(fmt);
+
+ va_start(ap, fmt);
+ vcli_outv(cli, fmt, ap);
+ va_end(ap);
+
+ return (0);
+}
+
/*lint -e{818} cli could be const */
int
VCLI_Overflow(struct cli *cli)
More information about the varnish-commit
mailing list