Browse Source

Make it possible to enter server credentials with curses input if none are specified on the command line.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
365c90096c
  1. 45
      main.c

45
main.c

@ -2629,9 +2629,6 @@ int main (int argc, char *argv[])
if (argc != 1) if (argc != 1)
quit(1, "Unexpected extra commandline arguments"); quit(1, "Unexpected extra commandline arguments");
if (!total_pools)
quit(1, "No server specified");
if (total_devices) { if (total_devices) {
if (total_devices > nDevs) if (total_devices > nDevs)
quit(1, "More devices specified than exist"); quit(1, "More devices specified than exist");
@ -2671,6 +2668,48 @@ int main (int argc, char *argv[])
test_and_set(&curses_active); 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++) { for (i = 0; i < total_pools; i++) {
struct pool *pool = &pools[i]; struct pool *pool = &pools[i];

Loading…
Cancel
Save