diff options
author | Seppia <seppia@seppio.fish> | 2018-07-06 11:31:03 +0200 |
---|---|---|
committer | Seppia <seppia@seppio.fish> | 2018-07-06 11:31:03 +0200 |
commit | ceb8b34275423e4e3ec12a8b9f43d4df90ab7833 (patch) | |
tree | 0ed695fa523d2d2fbf156dc6e0fdce1873b03ff0 /src/libluh.c | |
parent | cd5d8fcfa37dd2321a54168c5784cada8da6035c (diff) | |
download | onetimebluh-ceb8b34275423e4e3ec12a8b9f43d4df90ab7833.tar.gz onetimebluh-ceb8b34275423e4e3ec12a8b9f43d4df90ab7833.tar.bz2 onetimebluh-ceb8b34275423e4e3ec12a8b9f43d4df90ab7833.zip |
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.
Diffstat (limited to 'src/libluh.c')
-rw-r--r-- | src/libluh.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <stdint.h> #include <stdlib.h> #include <string.h> +#include <stdarg.h> #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; +} |