Do not log to history with -h/-t/-m
This commit is contained in:
@@ -481,12 +481,14 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// short help
|
// short help
|
||||||
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
|
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
|
||||||
|
g_disableLogging = true;
|
||||||
show_help(true, exec_name);
|
show_help(true, exec_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump help
|
// dump help
|
||||||
if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--text") == 0) {
|
if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--text") == 0) {
|
||||||
|
g_disableLogging = true;
|
||||||
show_help(false, exec_name);
|
show_help(false, exec_name);
|
||||||
dumpAllHelp(0);
|
dumpAllHelp(0);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -494,6 +496,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// dump markup
|
// dump markup
|
||||||
if (strcmp(argv[i], "-m") == 0 || strcmp(argv[i], "--markdown") == 0) {
|
if (strcmp(argv[i], "-m") == 0 || strcmp(argv[i], "--markdown") == 0) {
|
||||||
|
g_disableLogging = true;
|
||||||
dumpAllHelp(1);
|
dumpAllHelp(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) {
|
|||||||
// lock this section to avoid interlacing prints from different threads
|
// lock this section to avoid interlacing prints from different threads
|
||||||
pthread_mutex_lock(&print_lock);
|
pthread_mutex_lock(&print_lock);
|
||||||
|
|
||||||
if (logging && !logfile) {
|
if (!g_disableLogging && logging && !logfile) {
|
||||||
char *my_logfile_path = NULL;
|
char *my_logfile_path = NULL;
|
||||||
char filename[40];
|
char filename[40];
|
||||||
struct tm *timenow;
|
struct tm *timenow;
|
||||||
@@ -284,7 +284,7 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (logging && logfile) {
|
if (!g_disableLogging && logging && logfile) {
|
||||||
if (filter_ansi) { // already done
|
if (filter_ansi) { // already done
|
||||||
fprintf(logfile, "%s\n", buffer2);
|
fprintf(logfile, "%s\n", buffer2);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
#define UTIL_BUFFER_SIZE_SPRINT 4097
|
#define UTIL_BUFFER_SIZE_SPRINT 4097
|
||||||
// global client debug variable
|
// global client debug variable
|
||||||
uint8_t g_debugMode = 0;
|
uint8_t g_debugMode = 0;
|
||||||
|
// global client disable logging variable
|
||||||
|
bool g_disableLogging = false;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t g_debugMode;
|
uint8_t g_debugMode;
|
||||||
|
bool g_disableLogging;
|
||||||
|
|
||||||
int kbd_enter_pressed(void);
|
int kbd_enter_pressed(void);
|
||||||
void AddLogLine(const char *fn, const char *data, const char *c);
|
void AddLogLine(const char *fn, const char *data, const char *c);
|
||||||
|
|||||||
Reference in New Issue
Block a user