gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] 03/04: Distinguish case based on sub-comma


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 03/04: Distinguish case based on sub-command given.
Date: Tue, 03 Jul 2018 12:07:42 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

commit 2b3b83dc69c745a1c0cca7da9cf86e4fa6ce04c4
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jul 3 11:52:17 2018 +0200

    Distinguish case based on sub-command given.
---
 src/merchant-tools/taler-merchant-benchmark.c | 54 ++++++++++++++++++---------
 1 file changed, 36 insertions(+), 18 deletions(-)

diff --git a/src/merchant-tools/taler-merchant-benchmark.c 
b/src/merchant-tools/taler-merchant-benchmark.c
index ab65e2f..04904ae 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -71,7 +71,15 @@ enum PaymentGeneratorError {
 /**
  * Help string shown if NO subcommand is given on command line.
  */
-char *root_help;
+int root_help;
+
+/**
+ * Root help string.
+ */
+char *root_help_str = \
+  "taler-merchant-benchmark\nPopulates production database"
+  " with fake payments.\nMust be used with either 'ordinary'"
+  " or 'corner' sub-commands.\n";
 
 /**
  * Alternative non default instance.
@@ -433,6 +441,10 @@ main (int argc,
   default_config_file = GNUNET_OS_project_data_get
     ()->user_config_file;
 
+  loglev = NULL;
+  GNUNET_log_setup ("taler-merchant-benchmark",
+                    loglev,
+                    logfile);
 
   struct GNUNET_GETOPT_CommandLineOption root[] = {
 
@@ -445,13 +457,13 @@ main (int argc,
     GNUNET_GETOPT_option_flag
       ('h',
        "help",
-       "root help TBW",
+       NULL,
        &root_help),
 
     GNUNET_GETOPT_OPTION_END
   };
 
-  struct GNUNET_GETOPT_CommandLineOption corner[] = {
+  struct GNUNET_GETOPT_CommandLineOption corner_options[] = {
 
     GNUNET_GETOPT_option_help
       ("Populate databases with corner case payments"),
@@ -516,11 +528,9 @@ main (int argc,
        &logfile),
 
     GNUNET_GETOPT_OPTION_END
-
-
   };
 
-  struct GNUNET_GETOPT_CommandLineOption ordinary[] = {
+  struct GNUNET_GETOPT_CommandLineOption ordinary_options[] = {
 
     GNUNET_GETOPT_option_cfgfile
       (&cfg_filename),
@@ -529,7 +539,8 @@ main (int argc,
       (PACKAGE_VERSION " " VCS_VERSION),
 
     GNUNET_GETOPT_option_help
-      ("Generate Taler payments to populate the database(s)"),
+      ("Generate Taler ordinary payments"
+       " to populate the databases"),
 
     GNUNET_GETOPT_option_loglevel
       (&loglev),
@@ -580,14 +591,17 @@ main (int argc,
   };
 
   result = GNUNET_GETOPT_run
-    ("taler-merchant-generate-payments",
+    ("taler-merchant-benchmark",
      root,
      argc,
      argv);
 
-  if (root_help)
+
+  GNUNET_assert (GNUNET_SYSERR != result);
+
+  if (GNUNET_OK == root_help && (NULL == argv[result]))
   {
-    fprintf (stderr, "Main/root help string\n"); 
+    fprintf (stderr, root_help_str); 
     return 0; 
   }
 
@@ -597,17 +611,27 @@ main (int argc,
     return 0;
   }
 
-  GNUNET_assert (GNUNET_SYSERR != result);
-
   /* extract subcommand.  */
   if (0 == strcmp ("ordinary", argv[result]))
   {
     TALER_LOG_DEBUG ("'ordinary' subcommand found\n"); 
+
+    result = GNUNET_GETOPT_run
+      ("taler-merchant-benchmark",
+       ordinary_options,
+       argc,
+       argv);
     return 0; // DEBUGGISH 
   }
   else if (0 == strcmp ("corner", argv[result]))
   {
     TALER_LOG_DEBUG ("'corner' subcommand found\n"); 
+
+    result = GNUNET_GETOPT_run
+      ("taler-merchant-benchmark",
+       corner_options,
+       argc,
+       argv);
     return 0; // DEBUGGISH 
   }
   else
@@ -618,12 +642,6 @@ main (int argc,
 
   return 0;
 
-  GNUNET_assert (GNUNET_SYSERR != result);
-  loglev = NULL;
-  GNUNET_log_setup ("taler-merchant-generate-payments",
-                    loglev,
-                    logfile);
-
   if (NULL == cfg_filename)
     cfg_filename = (char *) default_config_file;
 

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



reply via email to

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