Do not log to history with -h/-t/-m

This commit is contained in:
Philippe Teuwen 2019-09-09 21:01:43 +02:00
parent d5d2c64d50
commit ba47ac36cb
4 changed files with 8 additions and 2 deletions

View file

@ -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;
}

View file

@ -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 {

View file

@ -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 <windows.h>

View file

@ -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);