[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated: Args parsing.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated: Args parsing. |
Date: |
Wed, 04 Jul 2018 16:37:36 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new dc921db Args parsing.
dc921db is described below
commit dc921dbc58d129db304ebd3e7c877cbe8e61c7f0
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jul 4 16:36:51 2018 +0200
Args parsing.
Fix problem reported here:
https://gnunet.org/bugs/view.php?id=5378#c13134,
and closing #5378.
---
src/merchant-tools/taler-merchant-benchmark.c | 54 +++++++++++++++------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/src/merchant-tools/taler-merchant-benchmark.c
b/src/merchant-tools/taler-merchant-benchmark.c
index 6f58e95..6f4daba 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -564,6 +564,8 @@ main (int argc,
loglev,
logfile);
+ struct GNUNET_GETOPT_CommandLineOption *options;
+
struct GNUNET_GETOPT_CommandLineOption root_options[] = {
GNUNET_GETOPT_option_cfgfile
@@ -707,42 +709,46 @@ main (int argc,
GNUNET_GETOPT_OPTION_END
};
-
- if (GNUNET_SYSERR != (result = GNUNET_GETOPT_run
- ("taler-merchant-benchmark",
- root_options,
- argc,
- argv)) && (NULL == argv[result]))
+
+ options = root_options;
+ if (0 == strcmp ("ordinary", argv[1]))
{
- if (GNUNET_YES == root_help)
- fprintf (stderr, root_help_str);
-
- /* either --version or "root" --help at this point. */
- return 0;
+ ordinary = GNUNET_YES;
+ options = ordinary_options;
+ }
+ if (0 == strcmp ("corner", argv[1]))
+ {
+ corner = GNUNET_YES;
+ options = corner_options;
}
- if ((GNUNET_SYSERR != (result = GNUNET_GETOPT_run
+ if (GNUNET_SYSERR != (result = GNUNET_GETOPT_run
("taler-merchant-benchmark",
- ordinary_options,
+ options,
argc,
- argv))) && (0 == strcmp ("ordinary", argv[result])))
+ argv)))
{
- ordinary = 1;
+
+ if (GNUNET_YES == root_help)
+ {
+ fprintf (stdout, root_help_str);
+ return 0;
+ }
+
+ /* --help was given. */
+ if (0 == result)
+ return 0;
}
- if ((GNUNET_SYSERR != (result = GNUNET_GETOPT_run
- ("taler-merchant-benchmark",
- corner_options,
- argc,
- argv))) && (0 == strcmp ("corner", argv[result])))
+ if (-1 == result)
{
- corner = 1;
+ return 1;
}
- if ((GNUNET_YES != ordinary) && (GNUNET_YES != corner))
+ if ((GNUNET_YES == corner) && (NULL == alt_instance))
{
- TALER_LOG_ERROR
- ("Neither 'ordinary' or 'corner' were given\n");
+ fprintf (stderr, "option '-i' is mandatory"
+ " with sub-command 'corner'!\n");
return 1;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant] branch master updated: Args parsing.,
gnunet <=