Remove EOL spaces from stderr and curses
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
diff --git a/main.c b/main.c
index 11b87ff..d64652e 100644
--- a/main.c
+++ b/main.c
@@ -216,7 +216,7 @@ static int opt_n_threads;
static int mining_threads;
static int num_processors;
static int scan_intensity;
-static bool use_curses = true;
+bool use_curses = true;
static bool opt_submit_stale;
static bool opt_nogpu;
static bool opt_usecpu;
diff --git a/miner.h b/miner.h
index cfcf83f..3c9d376 100644
--- a/miner.h
+++ b/miner.h
@@ -314,6 +314,7 @@ extern char *opt_kernel_path;
extern char *cgminer_path;
extern bool opt_autofan;
extern bool opt_autoengine;
+extern bool use_curses;
extern const uint32_t sha256_init_state[];
extern json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass,
diff --git a/util.c b/util.c
index 1fddead..01dbdd1 100644
--- a/util.c
+++ b/util.c
@@ -84,7 +84,7 @@ void vapplog(int prio, const char *fmt, va_list ap)
len = 40 + strlen(fmt) + 22;
f = alloca(len);
- sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d] %s \n",
+ sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d] %s\n",
tm.tm_year + 1900,
tm.tm_mon + 1,
tm.tm_mday,
@@ -100,7 +100,16 @@ void vapplog(int prio, const char *fmt, va_list ap)
vfprintf(stderr, f, apc); /* atomic write to stderr */
fflush(stderr);
}
- log_curses(prio, f, ap);
+
+ if (use_curses)
+ log_curses(prio, f, ap);
+ else {
+ int len = strlen(f);
+
+ strcpy(f + len - 1, " \n");
+
+ log_curses(prio, f, ap);
+ }
}
}