From ceb8b34275423e4e3ec12a8b9f43d4df90ab7833 Mon Sep 17 00:00:00 2001 From: Seppia Date: Fri, 6 Jul 2018 11:31:03 +0200 Subject: Print functions Defined macro for an error print function to be used to output errors. Defined also a quiet print function which gets executed only if numeric value passed as first argument is true. Changed also code in main source accordingly. --- src/libluh.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libluh.c') diff --git a/src/libluh.c b/src/libluh.c index 2ef11ca..4f25e53 100644 --- a/src/libluh.c +++ b/src/libluh.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "libluh.h" char* readInput (FILE* inputFile, uint64_t allocSize) { @@ -103,3 +104,17 @@ char* ubinDump (char* inputStr, char* binChars) { return comp; } + +int qprintf (int isQuiet, const char* printStr, ...) { + + int ret; + + if (!isQuiet) { + va_list args; + va_start(args, printStr); + ret = vprintf (printStr, args); + va_end(args); + } + + return ret; +} -- cgit v1.2.3