From a7b743e1f49ceb1a4ac375b198bda22d8f9f4e9e Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Mon, 14 Aug 2017 14:13:13 +0100 Subject: [PATCH] Be verbose when the YAML parameters are overwritten by a -P command-line argument. --- examples/main.c | 6 +++++- src/parser.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/main.c b/examples/main.c index 9afee0b9bf..ee12530624 100644 --- a/examples/main.c +++ b/examples/main.c @@ -396,8 +396,12 @@ int main(int argc, char *argv[]) { parser_read_file(paramFileName, params); /* 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]); + } /* And dump the parameters as used. */ // parser_print_params(¶ms); diff --git a/src/parser.c b/src/parser.c index 02970c0526..641e2fdac6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -133,6 +133,8 @@ void parser_set_param(struct swift_params *params, const char *namevalue) { int updated = 0; for (int i = 0; i < params->paramCount; i++) { if (strcmp(name, params->data[i].name) == 0) { + message("Using the value '%s' instead of '%s' for the parameter '%s'", + value, params->data[i].value, params->data[i].name); strcpy(params->data[i].value, value); updated = 1; } -- GitLab