Make it possible to enter server credentials with curses input if none are specified on the command line.
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
diff --git a/main.c b/main.c
index 309b0c6..06fcf74 100644
--- a/main.c
+++ b/main.c
@@ -2629,9 +2629,6 @@ int main (int argc, char *argv[])
if (argc != 1)
quit(1, "Unexpected extra commandline arguments");
- if (!total_pools)
- quit(1, "No server specified");
-
if (total_devices) {
if (total_devices > nDevs)
quit(1, "More devices specified than exist");
@@ -2671,6 +2668,48 @@ int main (int argc, char *argv[])
test_and_set(&curses_active);
}
+ if (!total_pools) {
+ if (curses_active) {
+ char *input, *seterr;
+
+ immedok(logwin, true);
+ leaveok(logwin, false);
+ wprintw(logwin, "No server specified on command line. Enter details manually\n");
+
+ input = malloc(255);
+ if (!input)
+ quit(1, "Failed to malloc input");
+ wprintw(logwin, "URL: ");
+ wgetnstr(logwin, input, 255);
+ seterr = set_url(input, NULL);
+ if (seterr)
+ quit(1, "%s", seterr);
+
+ input = malloc(255);
+ if (!input)
+ quit(1, "Failed to malloc input");
+ wprintw(logwin, "Username: ");
+ wgetnstr(logwin, input, 255);
+ seterr = set_user(input, NULL);
+ if (seterr)
+ quit(1, "%s", seterr);
+
+ input = malloc(255);
+ if (!input)
+ quit(1, "Failed to malloc input");
+ wprintw(logwin, "Password: ");
+ wgetnstr(logwin, input, 255);
+ seterr = set_pass(input, NULL);
+ if (seterr)
+ quit(1, "%s", seterr);
+
+ wclear(logwin);
+ leaveok(logwin, true);
+ immedok(logwin, false);
+ } else
+ quit(1, "No server specified");
+ }
+
for (i = 0; i < total_pools; i++) {
struct pool *pool = &pools[i];