vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 13539b9f155a76e620864f8ba6338146bbb3276a parent 465dc36579c1a155a29e554b10bca1728354f974 Author: Marc André Tanner <mat@brain-dump.org> Date: Thu, 22 Oct 2015 19:16:06 +0200 text: introduce text_appendf utility function Diffstat:
| M | text.c | | | 8 | ++++++++ |
| M | text.h | | | 1 | + |
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/text.c b/text.c @@ -634,6 +634,14 @@ bool text_insert(Text *txt, size_t pos, const char *data, size_t len) { return true; } +bool text_appendf(Text *txt, const char *format, ...) { + va_list ap; + va_start(ap, format); + bool ret = text_vprintf(txt, text_size(txt), format, ap); + va_end(ap); + return ret; +} + bool text_printf(Text *txt, size_t pos, const char *format, ...) { va_list ap; va_start(ap, format); diff --git a/text.h b/text.h @@ -37,6 +37,7 @@ typedef struct { Text *text_load(const char *filename); /* file information at time of load or last save */ struct stat text_stat(Text*); +bool text_appendf(Text*, const char *format, ...); bool text_printf(Text*, size_t pos, const char *format, ...); bool text_vprintf(Text*, size_t pos, const char *format, va_list ap); /* insert `len' bytes starting from `data' at `pos' which has to be