Only enable curses on failure if curses is desired.
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
diff --git a/cgminer.c b/cgminer.c
index 12bb343..adbdc40 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4217,12 +4217,11 @@ int main (int argc, char *argv[])
use_curses = false;
if (!total_pools) {
- enable_curses();
+ if (use_curses)
+ enable_curses();
applog(LOG_WARNING, "Need to specify at least one pool server.");
- if (!input_pool(false))
+ if (!use_curses || (use_curses && !input_pool(false)))
quit(1, "Pool setup failed");
- if (!use_curses)
- disable_curses();
}
for (i = 0; i < total_pools; i++) {
@@ -4326,7 +4325,8 @@ retry_pools:
}
if (!pools_active) {
- enable_curses();
+ if (use_curses)
+ enable_curses();
applog(LOG_ERR, "No servers were found that could be used to get work from.");
applog(LOG_ERR, "Please check the details from the list below of the servers you have input");
applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers");
@@ -4337,11 +4337,14 @@ retry_pools:
applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s",
i, pool->rpc_url, pool->rpc_user, pool->rpc_pass);
}
- halfdelay(150);
- applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s.");
- if (getch() != ERR)
+ if (use_curses) {
+ halfdelay(150);
+ applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s.");
+ if (getch() != ERR)
+ quit(0, "No servers could be used! Exiting.");
+ nocbreak();
+ } else
quit(0, "No servers could be used! Exiting.");
- nocbreak();
goto retry_pools;
}
diff --git a/device-gpu.c b/device-gpu.c
index 17f1e01..f8813b2 100644
--- a/device-gpu.c
+++ b/device-gpu.c
@@ -993,7 +993,8 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
clStates[i] = initCl(virtual_gpu, name, sizeof(name));
if (!clStates[i]) {
- enable_curses();
+ if (use_curses)
+ enable_curses();
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) {
char *buf;
@@ -1001,9 +1002,11 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer.");
failmessage = true;
- buf = curses_input("Press enter to continue");
- if (buf)
- free(buf);
+ if (use_curses) {
+ buf = curses_input("Press enter to continue");
+ if (buf)
+ free(buf);
+ }
}
cgpu->enabled = false;
cgpu->status = LIFE_NOSTART;
diff --git a/main.c b/main.c
index ef1872a..9a3a18b 100644
--- a/main.c
+++ b/main.c
@@ -5664,7 +5664,8 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
clStates[i] = initCl(virtual_gpu, name, sizeof(name));
if (!clStates[i]) {
- enable_curses();
+ if (use_curses)
+ enable_curses();
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) {
char *buf;
@@ -5672,9 +5673,11 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer.");
failmessage = true;
- buf = curses_input("Press enter to continue");
- if (buf)
- free(buf);
+ if (use_curses) {
+ buf = curses_input("Press enter to continue");
+ if (buf)
+ free(buf);
+ }
}
cgpu->enabled = false;
cgpu->status = LIFE_NOSTART;
@@ -6071,12 +6074,11 @@ int main (int argc, char *argv[])
use_curses = false;
if (!total_pools) {
- enable_curses();
+ if (use_curses)
+ enable_curses();
applog(LOG_WARNING, "Need to specify at least one pool server.");
- if (!input_pool(false))
+ if (!use_curses || (use_curses && !input_pool(false)))
quit(1, "Pool setup failed");
- if (!use_curses)
- disable_curses();
}
for (i = 0; i < total_pools; i++) {
@@ -6180,7 +6182,8 @@ retry_pools:
}
if (!pools_active) {
- enable_curses();
+ if (use_curses)
+ enable_curses();
applog(LOG_ERR, "No servers were found that could be used to get work from.");
applog(LOG_ERR, "Please check the details from the list below of the servers you have input");
applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers");
@@ -6191,11 +6194,14 @@ retry_pools:
applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s",
i, pool->rpc_url, pool->rpc_user, pool->rpc_pass);
}
- halfdelay(150);
- applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s.");
- if (getch() != ERR)
+ if (use_curses) {
+ halfdelay(150);
+ applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s.");
+ if (getch() != ERR)
+ quit(0, "No servers could be used! Exiting.");
+ nocbreak();
+ } else
quit(0, "No servers could be used! Exiting.");
- nocbreak();
goto retry_pools;
}