From 5532fdfdd1bc986afc5d52e9ba909b826afbb86e Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Tue, 5 Mar 2019 17:41:57 +0100 Subject: Benchmark. Taking the currency from CLI arguments as well, as there was no need to parse the config just to fetch this value. --- src/merchant-tools/taler-merchant-benchmark.c | 35 ++++++++++----------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c index 0d5cf83a..1a870de6 100644 --- a/src/merchant-tools/taler-merchant-benchmark.c +++ b/src/merchant-tools/taler-merchant-benchmark.c @@ -46,7 +46,7 @@ enum PaymentGeneratorError { MISSING_BANK_URL, FAILED_TO_LAUNCH_BANK, BAD_CLI_ARG, - BAD_CONFIG_FILE + MISSING_CURRENCY }; /* Hard-coded params. Note, the bank is expected to @@ -520,7 +520,6 @@ run (void *cls, fprintf (stderr, "None of 'ordinary' or 'corner'" " subcommands were given\n"); - result = 1; } @@ -613,6 +612,13 @@ main (int argc, "merchant base url, mandatory", &merchant_url), + GNUNET_GETOPT_option_string + ('k', + "currency", + "K", + "Used currency, mandatory", + ¤cy), + GNUNET_GETOPT_option_string ('i', "alt-instance", @@ -729,7 +735,8 @@ main (int argc, if (GNUNET_YES == root_help) { - fprintf (stdout, root_help_str); + fprintf (stdout, + root_help_str); return 0; } @@ -760,27 +767,11 @@ main (int argc, if (NULL == cfg_filename) cfg_filename = (char *) default_config_file; - cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != GNUNET_CONFIGURATION_load - (cfg, - cfg_filename)) - { - TALER_LOG_ERROR ("Could not parse configuration\n"); - return BAD_CONFIG_FILE; - } - if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string - (cfg, - "taler", - "currency", - ¤cy)) + if (NULL == currency) { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "taler", - "currency"); - GNUNET_CONFIGURATION_destroy (cfg); - return BAD_CONFIG_FILE; + TALER_LOG_ERROR ("Option -k is mandatory!\n"); + return MISSING_CURRENCY; } - GNUNET_CONFIGURATION_destroy (cfg); if (NULL == merchant_url) { -- cgit v1.2.3