From c56b57fc58c73e96def91f4904d5b6e7c50e3de9 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 22 May 2024 11:37:50 +0200 Subject: support piping a buffer to an external process Currently only Text objects can be piped to external commands. This is tedious if data not available in any file should be passed to an external process (e.g. building options and passing them to vis-menu). This adds the option to pass a buffer to _vis_pipe and provides wrapper functions for the original behavior and the new one. --- text.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'text.h') diff --git a/text.h b/text.h index 048aef7..3249e21 100644 --- a/text.h +++ b/text.h @@ -413,6 +413,12 @@ ssize_t text_write_range(const Text*, const Filerange*, int fd); * this text instance. */ bool text_mmaped(const Text*, const char *ptr); + +/** + * Write complete buffer to file descriptor. + * @return The number of bytes written or ``-1`` in case of an error. + */ +ssize_t write_all(int fd, const char *buf, size_t count); /** @} */ #endif -- cgit v1.2.3