#include <stdio.h> #include <stdarg.h> #include "../minmax.h" size_t log_err(const char *format, ...) { char buffer[1024]; va_list args; size_t len; va_start(args, format); len = vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); len = min(len, sizeof(buffer) - 1); return fwrite(buffer, len, 1, stderr); } size_t log_info(const char *format, ...) { char buffer[1024]; va_list args; size_t len; va_start(args, format); len = vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); len = min(len, sizeof(buffer) - 1); return fwrite(buffer, len, 1, stdout); }