Commit 23710c75 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'yamling' into 'master'

Yamling

Warn when overriding parameters from the command-line.

See merge request !402
parents e5196580 c7692764
...@@ -396,8 +396,12 @@ int main(int argc, char *argv[]) { ...@@ -396,8 +396,12 @@ int main(int argc, char *argv[]) {
parser_read_file(paramFileName, params); parser_read_file(paramFileName, params);
/* Handle any command-line overrides. */ /* Handle any command-line overrides. */
if (nparams > 0) if (nparams > 0) {
message(
"Overwriting values read from the YAML file with command-line "
"values.");
for (int k = 0; k < nparams; k++) parser_set_param(params, cmdparams[k]); for (int k = 0; k < nparams; k++) parser_set_param(params, cmdparams[k]);
}
/* And dump the parameters as used. */ /* And dump the parameters as used. */
// parser_print_params(&params); // parser_print_params(&params);
......
...@@ -133,6 +133,8 @@ void parser_set_param(struct swift_params *params, const char *namevalue) { ...@@ -133,6 +133,8 @@ void parser_set_param(struct swift_params *params, const char *namevalue) {
int updated = 0; int updated = 0;
for (int i = 0; i < params->paramCount; i++) { for (int i = 0; i < params->paramCount; i++) {
if (strcmp(name, params->data[i].name) == 0) { if (strcmp(name, params->data[i].name) == 0) {
message("Value of '%s' changed from '%s' to '%s'",
params->data[i].name, params->data[i].value, value);
strcpy(params->data[i].value, value); strcpy(params->data[i].value, value);
updated = 1; updated = 1;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment