1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-23 13:04:29 +00:00

Allow the user/pass userpass urls to be input in any order.

This commit is contained in:
Con Kolivas 2011-07-19 23:16:30 +10:00
parent b56ed74867
commit 0afab92cd4

34
main.c
View File

@ -184,6 +184,7 @@ static struct pool *pools = NULL;
static struct pool *currentpool; static struct pool *currentpool;
static int pool_no; static int pool_no;
static int total_pools; static int total_pools;
static int total_urls, total_users, total_passes, total_userpasses;
static bool curses_active = false; static bool curses_active = false;
@ -349,8 +350,10 @@ static char *set_url(const char *arg, char **p)
{ {
struct pool *pool; struct pool *pool;
add_pool(); total_urls++;
pool = &pools[total_pools - 1]; if (total_urls > total_pools)
add_pool();
pool = &pools[total_urls - 1];
opt_set_charp(arg, &pool->rpc_url); opt_set_charp(arg, &pool->rpc_url);
if (strncmp(arg, "http://", 7) && if (strncmp(arg, "http://", 7) &&
@ -364,10 +367,13 @@ static char *set_user(const char *arg, char **p)
{ {
struct pool *pool; struct pool *pool;
if (!total_pools) if (total_userpasses)
return "No URL set for user"; return "Use only user + pass or userpass, but not both";
total_users++;
if (total_users > total_pools)
add_pool();
pool = &pools[total_pools - 1]; pool = &pools[total_users - 1];
opt_set_charp(arg, &pool->rpc_user); opt_set_charp(arg, &pool->rpc_user);
return NULL; return NULL;
@ -377,10 +383,13 @@ static char *set_pass(const char *arg, char **p)
{ {
struct pool *pool; struct pool *pool;
if (!total_pools) if (total_userpasses)
return "No URL set for pass"; return "Use only user + pass or userpass, but not both";
total_passes++;
if (total_passes > total_pools)
add_pool();
pool = &pools[total_pools - 1]; pool = &pools[total_passes - 1];
opt_set_charp(arg, &pool->rpc_pass); opt_set_charp(arg, &pool->rpc_pass);
return NULL; return NULL;
@ -390,10 +399,13 @@ static char *set_userpass(const char *arg, char **p)
{ {
struct pool *pool; struct pool *pool;
if (!total_pools) if (total_users || total_passes)
return "No URL set for userpass"; return "Use only user + pass or userpass, but not both";
total_userpasses++;
if (total_userpasses > total_pools)
add_pool();
pool = &pools[total_pools - 1]; pool = &pools[total_userpasses - 1];
opt_set_charp(arg, &pool->rpc_userpass); opt_set_charp(arg, &pool->rpc_userpass);
return NULL; return NULL;