Browse files

Allow specification of username in URL

  • Loading branch information...
1 parent b53230c commit 5b9fd9c73193466ace6b183d6ea233c388ce0d9b @pooler committed Aug 21, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 cpu-miner.c
View
13 cpu-miner.c
@@ -880,14 +880,17 @@ static void parse_arg (int key, char *arg)
rpc_url = malloc((strlen(arg) + 8) * sizeof(char));
sprintf(rpc_url, "http://%s", arg);
}
- p = strchr(rpc_url, '@');
+ p = strrchr(rpc_url, '@');
if (p) {
char *ap = strstr(rpc_url, "://") + 3;
*p = '\0';
- if (!strchr(ap, ':'))
- show_usage_and_exit(1);
- free(rpc_userpass);
- rpc_userpass = strdup(ap);
+ if (strchr(ap, ':')) {
+ free(rpc_userpass);
+ rpc_userpass = strdup(ap);
+ } else {
+ free(rpc_user);
+ rpc_user = strdup(ap);
+ }
memmove(ap, p + 1, (strlen(p + 1) + 1) * sizeof(char));
}
break;

0 comments on commit 5b9fd9c

Please sign in to comment.