From 0cda2d50cb64ccae46dc39ab779ed79c4c96bfcc Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 5 Oct 2011 10:14:03 +0200 Subject: [PATCH] t/stest: add log.o smaller helper Signed-off-by: Jens Axboe --- Makefile | 2 +- t/log.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 t/log.c diff --git a/Makefile b/Makefile index b361603b..84f30883 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ endif OBJS = $(SOURCE:.c=.o) T_OBJS = t/stest.o -T_OBJS += mutex.o smalloc.o +T_OBJS += mutex.o smalloc.o t/log.o T_PROGS = t/stest ifneq ($(findstring $(MAKEFLAGS),s),s) diff --git a/t/log.c b/t/log.c new file mode 100644 index 00000000..7f1de27f --- /dev/null +++ b/t/log.c @@ -0,0 +1,15 @@ +#include +#include + +int 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); + + return fwrite(buffer, len, 1, stderr); +} -- 2.25.1