ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
io.h
Go to the documentation of this file.
1
20#pragma once
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
29typedef struct {
32 int pipe_fd;
33} log_io_t;
34
48
61void log_io_stop(log_io_t capture, const char *prefix);
62
81#define LOG_IO(prefix, block) \
82 do { \
83 log_io_t _log_io = log_io_start(); \
84 block; \
85 log_io_stop(_log_io, (prefix)); \
86 } while (0)
87
88#ifdef __cplusplus
89}
90#endif
log_io_t log_io_start(void)
Start capturing stdout and stderr.
Definition io.c:15
void log_io_stop(log_io_t capture, const char *prefix)
Stop capturing and log the accumulated output.
Definition io.c:79
Opaque handle for IO capture state.
Definition io.h:29
int saved_stdout_fd
Saved stdout file descriptor.
Definition io.h:30
int pipe_fd
Read end of pipe for captured output.
Definition io.h:32
int saved_stderr_fd
Saved stderr file descriptor.
Definition io.h:31