From 6d183c02a50a42743c3031532f458ab5cea0685d Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Thu, 30 May 2019 21:23:44 +0100 Subject: Convert debugprint() from being to file/screen/disabled to always being to file with configurable verbosity. --- functions.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'functions.h') diff --git a/functions.h b/functions.h index d56a295..dc3c4c3 100644 --- a/functions.h +++ b/functions.h @@ -21,12 +21,15 @@ #define OK 0 #define NO_INPUT 1 #define TOO_LONG 2 -#define DEBUG_NONE 0 -#define DEBUG_FILE 1 -#define DEBUG_SCREEN 2 -// Print debugging output if enabled -void debugprint(char *format, ...); +#define DEBUG_CRIT 0 +#define DEBUG_SOME 1 +#define DEBUG_FULL 2 + +// Write debug string to file. +// Debug level is provided by level, set to one of DEBUG_CRIT, DEBUG_SOME or DEBUG_FULL. +// Debug is only written if the global int "debug" is greater than or equal to the level. +void debugprint(int level, char *format, ...); // Get stdin line with buffer overrun protection int getstdin(char *prompt, char *buff, size_t sz); -- cgit v1.2.3