Commit 08423342 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vte: Remove the former all-in-one VCLI_VTE()

parent c1f55638
......@@ -111,6 +111,3 @@ 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);
......@@ -25,6 +25,14 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Varnish Turbo Encabulator
*
* Align and print fields in a line-based output. Fields are delimited
* with a horizontal tab HT and lines starting with a space SP are kept
* verbatim. Lines are delimited with a single new line LF character.
*
* Using non-ASCII or non-printable ASCII character is undefined behavior.
*/
struct vte;
......
......@@ -3,6 +3,7 @@
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
* Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*
......@@ -34,21 +35,17 @@
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h> /* for MUSL (ssize_t) */
#include "vdef.h"
#include "vqueue.h"
#include "miniobj.h"
#include "vas.h"
#include "vcli_serve.h"
#include "vsb.h"
#include "vte.h"
#define MAXCOL 10
#define MINSEP 1
#define MAXSEP 3
......@@ -283,46 +280,3 @@ VTE_format(struct vte *vte, VTE_format_f *func, void *priv)
return (0);
}
/* NB: cheating in the absence of a VCLI_Outv() */
static int
vcli_vte(void *priv, const char *fmt, ...)
{
struct cli *cli;
va_list ap;
char buf[2];
cli = priv;
AN(cli);
va_start(ap, fmt);
(void)vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
VCLI_Out(cli, "%c", *buf);
return (0);
}
void
VCLI_VTE(struct cli *cli, struct vsb **src, int width)
{
struct vte *vte;
AN(cli);
AN(src);
AN(*src);
AZ(VSB_finish(*src));
if (VSB_len(*src) == 0) {
VSB_destroy(src);
return;
}
vte = VTE_new(MAXCOL, width);
AN(vte);
AZ(VTE_cat(vte, VSB_data(*src)));
AZ(VTE_finish(vte));
AZ(VTE_format(vte, vcli_vte, cli));
VTE_destroy(&vte);
VSB_destroy(src);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment