Browse Source

config: handle ints, reals and false

master
Tanguy Pruvot 10 years ago
parent
commit
0317706464
  1. 3
      README.txt
  2. 18
      cpu-miner.c
  3. 4
      example-cfg.json

3
README.txt

@ -155,11 +155,12 @@ features.
>>> RELEASE HISTORY <<< >>> RELEASE HISTORY <<<
Nov. 11th 2014 v1.4.7 Nov. 11th 2014 v1.4.7
Average hashrate (based on the 50 last scans) Average hashrate (based on the 20 last scans)
Rewrite blake algo Rewrite blake algo
Add the -i (gpu threads/intensity parameter) Add the -i (gpu threads/intensity parameter)
Add some X11 optimisations based on sp_ commits Add some X11 optimisations based on sp_ commits
Fix quark reported hashrate and benchmark mode for some algos Fix quark reported hashrate and benchmark mode for some algos
Enhance json config file param (int/float/false) (-c config.json)
Update windows prebuilt curl to 7.38.0 Update windows prebuilt curl to 7.38.0
Oct. 26th 2014 v1.4.6 Oct. 26th 2014 v1.4.6

18
cpu-miner.c

@ -1853,11 +1853,23 @@ static void parse_config(void)
char *s = strdup(json_string_value(val)); char *s = strdup(json_string_value(val));
if (!s) if (!s)
break; break;
// applog(LOG_DEBUG, "%s -%c %s", options[i].name, options[i].val, s);
parse_arg(options[i].val, s); parse_arg(options[i].val, s);
free(s); free(s);
} else if (!options[i].has_arg && json_is_true(val)) }
parse_arg(options[i].val, ""); else if (options[i].has_arg && json_is_integer(val)) {
char buf[16];
sprintf(buf, "%d", json_integer_value(val));
parse_arg(options[i].val, buf);
}
else if (options[i].has_arg && json_is_real(val)) {
char buf[16];
sprintf(buf, "%f", json_real_value(val));
parse_arg(options[i].val, buf);
}
else if (!options[i].has_arg) {
if (json_is_true(val))
parse_arg(options[i].val, "");
}
else else
applog(LOG_ERR, "JSON option %s invalid", applog(LOG_ERR, "JSON option %s invalid",
options[i].name); options[i].name);

4
example-cfg.json

@ -2,8 +2,10 @@
"_comment" : "todo: support /* comments */", "_comment" : "todo: support /* comments */",
"algo" : "blake", "algo" : "blake",
"intensity": 19,
"diff": 0.5,
"_quiet" : true, "quiet" : false,
"url" : "stratum+tcp://www.hashharder.com:9585", "url" : "stratum+tcp://www.hashharder.com:9585",
"user" : "NaEcVrdzoCWHUYXb7X8QoafoKS9UV69Yk4", "user" : "NaEcVrdzoCWHUYXb7X8QoafoKS9UV69Yk4",

Loading…
Cancel
Save