gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: fix subcommands log


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: fix subcommands logic.
Date: Tue, 03 Jul 2018 22:38:38 +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 ea58e7d  fix subcommands logic.
ea58e7d is described below

commit ea58e7dc1a708ac19febef2e24602ccbbe90c789
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jul 3 22:38:26 2018 +0200

    fix subcommands logic.
---
 src/merchant-tools/taler-merchant-benchmark.c | 59 +++++++++------------------
 1 file changed, 20 insertions(+), 39 deletions(-)

diff --git a/src/merchant-tools/taler-merchant-benchmark.c 
b/src/merchant-tools/taler-merchant-benchmark.c
index da5aef7..8e77b2e 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -567,7 +567,7 @@ main (int argc,
                     loglev,
                     logfile);
 
-  struct GNUNET_GETOPT_CommandLineOption root[] = {
+  struct GNUNET_GETOPT_CommandLineOption root_options[] = {
 
     GNUNET_GETOPT_option_cfgfile
       (&cfg_filename),
@@ -711,61 +711,42 @@ main (int argc,
     GNUNET_GETOPT_OPTION_END
   };
 
-  result = GNUNET_GETOPT_run
+  if (GNUNET_SYSERR != (result = GNUNET_GETOPT_run
     ("taler-merchant-benchmark",
-     root,
+     root_options,
      argc,
-     argv);
-
-  GNUNET_assert (GNUNET_SYSERR != result);
-
-  if (GNUNET_OK == root_help && (NULL == argv[result]))
+     argv)) && (NULL == argv[result]))
   {
-    fprintf (stderr, root_help_str); 
-    return 0; 
-  }
+    if (GNUNET_YES == root_help)
+      fprintf (stderr, root_help_str);
 
-  if (GNUNET_NO == result)
-  {
-    /* --version was given, just return.  */ 
+    /* either --version or "root" --help at this point.  */
     return 0;
   }
 
-  /* extract subcommand.  */
-  if (0 == strcmp ("ordinary", argv[result]))
-  {
-    TALER_LOG_DEBUG ("'ordinary' subcommand found\n"); 
-
-    ordinary = GNUNET_OK;
-    result = GNUNET_GETOPT_run
+  if ((GNUNET_SYSERR != (result = GNUNET_GETOPT_run
       ("taler-merchant-benchmark",
        ordinary_options,
        argc,
-       argv);
-    GNUNET_assert (GNUNET_SYSERR != result);
-    if (GNUNET_NO == result)
-      /* --help was given.  */
-      return 0;
-  }
-  else if (0 == strcmp ("corner", argv[result]))
+       argv))) && (0 == strcmp ("ordinary", argv[result])))
   {
-    TALER_LOG_DEBUG ("'corner' subcommand found\n"); 
+    ordinary = 1; 
+  }
 
-    corner = GNUNET_OK;
-    result = GNUNET_GETOPT_run
+  if ((GNUNET_SYSERR != (result = GNUNET_GETOPT_run
       ("taler-merchant-benchmark",
        corner_options,
        argc,
-       argv);
-    GNUNET_assert (GNUNET_SYSERR != result);
-    if (GNUNET_NO == result)
-      /* --help was given.  */
-      return 0;
+       argv))) && (0 == strcmp ("corner", argv[result])))
+  {
+    corner = 1; 
   }
-  else
+
+  if ((GNUNET_YES != ordinary) && (GNUNET_YES != corner))
   {
-    TALER_LOG_ERROR ("Unknown subcommand given.\n"); 
-    return 1;  
+    TALER_LOG_ERROR
+      ("Neither 'ordinary' or 'corner' were given\n");
+    return 1;
   }
 
   if (NULL == cfg_filename)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]