config: handle ints, reals and false

This commit is contained in:
Tanguy Pruvot 2014-11-11 20:55:25 +01:00
parent 66845a9b36
commit 0317706464
3 changed files with 20 additions and 5 deletions

View File

@ -155,11 +155,12 @@ features.
>>> RELEASE HISTORY <<<
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
Add the -i (gpu threads/intensity parameter)
Add some X11 optimisations based on sp_ commits
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
Oct. 26th 2014 v1.4.6

View File

@ -1853,11 +1853,23 @@ static void parse_config(void)
char *s = strdup(json_string_value(val));
if (!s)
break;
// applog(LOG_DEBUG, "%s -%c %s", options[i].name, options[i].val, s);
parse_arg(options[i].val, 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
applog(LOG_ERR, "JSON option %s invalid",
options[i].name);

View File

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