From 371468655c0adbedbe5148fddd2dacaae9eac6e0 Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Thu, 7 Aug 2025 23:33:31 +0200 Subject: options/output: add --quiet to suppress error/warning messages As the LOGERR macro is modified this option will also suppress debug messages in case the executable was built with -DDEBUGBUILD. --- include/options.h | 1 + include/output.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/options.h b/include/options.h index cae9aa0..c92dbdf 100644 --- a/include/options.h +++ b/include/options.h @@ -30,6 +30,7 @@ extern bool option_sort_reverse_order; extern enum esort_type option_sort_type; extern bool option_print_boxed_table; extern bool option_print_header; +extern bool option_quiet; extern bool option_resolve_symlinks; extern bool option_show_hidden_entries; extern bool option_timestamp_long; diff --git a/include/output.h b/include/output.h index 53f0869..38546aa 100644 --- a/include/output.h +++ b/include/output.h @@ -8,10 +8,11 @@ #define OUTPUT_H #include +#include "options.h" #include "data_management.h" -#define LOGERR(...) {fprintf(stderr, "[%s:%d] %s: ", __FILE__, __LINE__, __func__); fprintf(stderr, __VA_ARGS__);} +#define LOGERR(...) {if (!option_quiet){ fprintf(stderr, "[%s:%d] %s: ", __FILE__, __LINE__, __func__); fprintf(stderr, __VA_ARGS__); }} #ifdef DEBUGBUILD #define DBGTRC(...) LOGERR(__VA_ARGS__) -- cgit v1.2.3-70-g09d2