From ba47ac36cbc65aeb669119889b67d4bb5e7de747 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Mon, 9 Sep 2019 21:01:43 +0200 Subject: [PATCH] Do not log to history with -h/-t/-m --- client/proxmark3.c | 3 +++ client/ui.c | 4 ++-- client/util.c | 2 ++ client/util.h | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index f1a8bb05f..58b082078 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -481,12 +481,14 @@ int main(int argc, char *argv[]) { // short help if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { + g_disableLogging = true; show_help(true, exec_name); return 0; } // dump help if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--text") == 0) { + g_disableLogging = true; show_help(false, exec_name); dumpAllHelp(0); return 0; @@ -494,6 +496,7 @@ int main(int argc, char *argv[]) { // dump markup if (strcmp(argv[i], "-m") == 0 || strcmp(argv[i], "--markdown") == 0) { + g_disableLogging = true; dumpAllHelp(1); return 0; } diff --git a/client/ui.c b/client/ui.c index 68c8b197c..2055ab972 100644 --- a/client/ui.c +++ b/client/ui.c @@ -223,7 +223,7 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { // lock this section to avoid interlacing prints from different threads pthread_mutex_lock(&print_lock); - if (logging && !logfile) { + if (!g_disableLogging && logging && !logfile) { char *my_logfile_path = NULL; char filename[40]; struct tm *timenow; @@ -284,7 +284,7 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { } #endif - if (logging && logfile) { + if (!g_disableLogging && logging && logfile) { if (filter_ansi) { // already done fprintf(logfile, "%s\n", buffer2); } else { diff --git a/client/util.c b/client/util.c index 52321689b..2261684e9 100644 --- a/client/util.c +++ b/client/util.c @@ -28,6 +28,8 @@ #define UTIL_BUFFER_SIZE_SPRINT 4097 // global client debug variable uint8_t g_debugMode = 0; +// global client disable logging variable +bool g_disableLogging = false; #ifdef _WIN32 #include diff --git a/client/util.h b/client/util.h index 09aeeaecb..072c04cfb 100644 --- a/client/util.h +++ b/client/util.h @@ -22,6 +22,7 @@ #endif uint8_t g_debugMode; +bool g_disableLogging; int kbd_enter_pressed(void); void AddLogLine(const char *fn, const char *data, const char *c);