Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
6729ae2b
Commit
6729ae2b
authored
Aug 17, 2023
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vte: Add a VTE_Printf() convenience
parent
6dcbc76f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
vte.h
include/vte.h
+1
-0
vte.c
lib/libvarnish/vte.c
+25
-0
No files found.
include/vte.h
View file @
6729ae2b
...
...
@@ -31,4 +31,5 @@ struct vte;
struct
vte
*
VTE_new
(
int
maxfields
,
int
width
);
int
VTE_cat
(
struct
vte
*
,
const
char
*
);
int
VTE_printf
(
struct
vte
*
,
const
char
*
,
...)
v_printflike_
(
2
,
3
);
void
VTE_destroy
(
struct
vte
**
);
lib/libvarnish/vte.c
View file @
6729ae2b
...
...
@@ -32,6 +32,7 @@
#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
/* for MUSL (ssize_t) */
...
...
@@ -162,6 +163,30 @@ VTE_cat(struct vte *vte, const char *s)
return
(
vte_update
(
vte
));
}
int
VTE_printf
(
struct
vte
*
vte
,
const
char
*
fmt
,
...)
{
va_list
ap
;
int
res
;
CHECK_OBJ_NOTNULL
(
vte
,
VTE_MAGIC
);
AN
(
fmt
);
if
(
vte
->
o_sep
!=
0
)
return
(
-
1
);
va_start
(
ap
,
fmt
);
res
=
VSB_vprintf
(
vte
->
vsb
,
fmt
,
ap
);
va_end
(
ap
);
if
(
res
<
0
)
{
vte
->
o_sep
=
-
1
;
return
(
-
1
);
}
return
(
vte_update
(
vte
));
}
void
VCLI_VTE
(
struct
cli
*
cli
,
struct
vsb
**
src
,
int
width
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment