|
clibs
Tiny but handy utility libraries for C
|
Thread-aware printing macros with redirect support. More...
#include <stdio.h>

Go to the source code of this file.
Macros | |
| #define | PRINT(fmt, ...) |
| Print to output stream (like printf). | |
| #define | PERROR(fmt, ...) |
| Print to error stream (like fprintf(stderr,...)). | |
| #define | PUTS(fmt, ...) |
| Print one line to output stream, with newline. | |
| #define | PUTERR(fmt, ...) |
| Print one line to error stream, with newline. | |
| #define | DEBUG_INFO(fmt, ...) |
| Print debug message with file and line info. | |
Functions | |
| void | clibs_set_output (FILE *out, FILE *err) |
| Sets thread-local output and error streams. | |
| FILE * | clibs_get_out (void) |
| Gets current output stream (fallback: stdout). | |
| FILE * | clibs_get_err (void) |
| Gets current error stream (fallback: stderr). | |
Thread-aware printing macros with redirect support.
This module provides print macros (like printf, puts) that redirect output to thread-local FILE* streams, with fallback to stdout/stderr. Intended for portable, lock-free console or file printing.
| #define DEBUG_INFO | ( | fmt, | |
| ... ) |
Print debug message with file and line info.
| #define PERROR | ( | fmt, | |
| ... ) |
Print to error stream (like fprintf(stderr,...)).
| #define PRINT | ( | fmt, | |
| ... ) |
Print to output stream (like printf).
| #define PUTERR | ( | fmt, | |
| ... ) |
Print one line to error stream, with newline.
| #define PUTS | ( | fmt, | |
| ... ) |
Print one line to output stream, with newline.
| FILE * clibs_get_err | ( | void | ) |
Gets current error stream (fallback: stderr).
Gets current error stream (fallback: stderr).
Falls back to stderr if no thread-local error stream is set.
| FILE * clibs_get_out | ( | void | ) |
Gets current output stream (fallback: stdout).
Gets current output stream (fallback: stdout).
Falls back to stdout if no thread-local output stream is set.
| void clibs_set_output | ( | FILE * | out, |
| FILE * | err ) |
Sets thread-local output and error streams.
| out | Stream for normal output (default: stdout). |
| err | Stream for error output (default: stderr). |
Sets thread-local output and error streams.
| out | Output stream for general messages (default fallback: stdout). |
| err | Output stream for log messages (default fallback: stderr). |