diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-05-22 11:37:50 +0200 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-09-13 06:03:59 -0600 |
| commit | c56b57fc58c73e96def91f4904d5b6e7c50e3de9 (patch) | |
| tree | b0918f3a6b234e4bd9ff5e5d86c2aa09ea622179 /vis.h | |
| parent | d8276d916d875695a1000e14a6d1dfd03e689c81 (diff) | |
| download | vis-c56b57fc58c73e96def91f4904d5b6e7c50e3de9.tar.gz vis-c56b57fc58c73e96def91f4904d5b6e7c50e3de9.tar.xz | |
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.
Diffstat (limited to 'vis.h')
| -rw-r--r-- | vis.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -883,6 +883,20 @@ int vis_pipe(Vis*, File*, Filerange*, const char *argv[], int vis_pipe_collect(Vis*, File*, Filerange*, const char *argv[], char **out, char **err, bool fullscreen); /** + * Pipe a buffer to an external process, return its exit status and capture + * everything that is written to stdout/stderr. + * @param argv Argument list, must be ``NULL`` terminated. + * @param out Data written to ``stdout``, will be ``NUL`` terminated. + * @param err Data written to ``stderr``, will be ``NUL`` terminated. + * @param fullscreen Whether the external process is a fullscreen program (e.g. curses based) + * @rst + * .. warning:: The pointers stored in ``out`` and ``err`` need to be `free(3)`-ed + * by the caller. + * @endrst + */ +int vis_pipe_buf_collect(Vis*, const char*, const char *argv[], char **out, char **err, bool fullscreen); + +/** * @} * @defgroup vis_keys * @{ |
