gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (bfd918f36 -> 4a76b973d)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (bfd918f36 -> 4a76b973d)
Date: Thu, 12 Jan 2017 18:13:31 +0100

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

mteich pushed a change to branch master
in repository gnunet.

    from bfd918f36 force non-zero
     new 0eb8cdd10 update cmdline parsing
     new 220d336ce add basic cmdline checking
     new 84dc6a318 include json dependency
     new a707b68b7 Merge branch 'master' into auction
     new 4a76b973d Merge remote-tracking branch 'origin/master'

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/Makefile.am                     |  6 +++-
 src/auction/Makefile.am             |  4 +++
 src/auction/gnunet-auction-create.c | 60 ++++++++++++++++++++++++++++++-------
 3 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index c6f320ae4..56f301ac0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,6 +60,10 @@ if HAVE_JSON
 endif
 endif
 
+if HAVE_JSON
+  AUCTION_DIR = auction
+endif
+
 if TALER_ONLY
 SUBDIRS = \
  include \
@@ -122,7 +126,7 @@ SUBDIRS = \
   psycstore \
   psyc \
   social \
-  auction \
+  $(AUCTION_DIR) \
   $(EXP_DIR) \
   $(PROVIDER_DIR)
 
diff --git a/src/auction/Makefile.am b/src/auction/Makefile.am
index 18a3e5604..8518244fa 100644
--- a/src/auction/Makefile.am
+++ b/src/auction/Makefile.am
@@ -28,24 +28,28 @@ gnunet_auction_create_SOURCES = \
  gnunet-auction-create.c
 gnunet_auction_create_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  -ljansson \
   $(GN_LIBINTL)
 
 gnunet_auction_info_SOURCES = \
  gnunet-auction-info.c
 gnunet_auction_info_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  -ljansson \
   $(GN_LIBINTL)
 
 gnunet_auction_join_SOURCES = \
  gnunet-auction-join.c
 gnunet_auction_join_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  -ljansson \
   $(GN_LIBINTL)
 
 gnunet_service_auction_SOURCES = \
  gnunet-service-auction.c
 gnunet_service_auction_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  -ljansson \
   $(GN_LIBINTL)
 
 
diff --git a/src/auction/gnunet-auction-create.c 
b/src/auction/gnunet-auction-create.c
index fd3fcdabe..c21e93f26 100644
--- a/src/auction/gnunet-auction-create.c
+++ b/src/auction/gnunet-auction-create.c
@@ -25,15 +25,21 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_json_lib.h"
 /* #include "gnunet_auction_service.h" */
 
+#define FIRST_PRICE 0
+#define OUTCOME_PRIVATE 0
+#define OUTCOME_PUBLIC 1
+
 static int ret; /** Final status code. */
 static char *fndesc; /** filename of the item description */
 static char *fnprices; /** filename of the price map */
 static struct GNUNET_TIME_Relative dround; /** max round duration */
 static struct GNUNET_TIME_Relative dstart; /** time until auction starts */
-static unsigned int m = 0; /** auction parameter m */
-static int public = 0; /** public outcome */
+static unsigned int m = FIRST_PRICE; /** auction parameter m */
+static int outcome = OUTCOME_PRIVATE; /** outcome */
+static int interactive; /** keep running in foreground */
 
 
 /**
@@ -50,7 +56,35 @@ run (void *cls,
         const char *cfgfile,
         const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-       /* main code here */
+       /* cmdline parsing */
+       if (GNUNET_TIME_UNIT_ZERO.rel_value_us == dstart.rel_value_us)
+       {
+               GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                           "required argument --regtime missing or invalid 
(zero)\n");
+               goto fail;
+       }
+       if (GNUNET_TIME_UNIT_ZERO.rel_value_us == dround.rel_value_us)
+       {
+               GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                           "required argument --roundtime missing or invalid 
(zero)\n");
+               goto fail;
+       }
+       if (!fndesc)
+       {
+               GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                           "required argument --description missing\n");
+               goto fail;
+       }
+       if (!fnprices)
+       {
+               GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                           "required argument --pricemap missing\n");
+               goto fail;
+       }
+
+fail:
+       ret = 1;
+       return;
 }
 
 
@@ -68,21 +102,26 @@ main (int argc, char *const *argv)
                {'d', "description", "FILE",
                        gettext_noop ("description of the item to be sold"),
                        1, &GNUNET_GETOPT_set_filename, &fndesc},
-               {'c', "costmap", "FILE",
+               {'p', "pricemap", "FILE",
                        gettext_noop ("mapping of possible prices"),
                        1, &GNUNET_GETOPT_set_filename, &fnprices},
                {'r', "roundtime", "DURATION",
                        gettext_noop ("max duration per round"),
                        1, &GNUNET_GETOPT_set_relative_time, &dround},
-               {'s', "starttime", "DURATION",
+               {'s', "regtime", "DURATION",
                        gettext_noop ("duration until auction starts"),
                        1, &GNUNET_GETOPT_set_relative_time, &dstart},
                {'m', "m", "NUMBER",
-                       gettext_noop ("number of items to sell, 0 for first 
price auction"),
-                       0, &GNUNET_GETOPT_set_uint, &m},
-               {'p', "public", NULL,
+                       gettext_noop ("number of items to sell\n"
+                                     "0 for first price auction\n"
+                                     ">0 for vickrey/M+1st price auction"),
+                       1, &GNUNET_GETOPT_set_uint, &m},
+               {'u', "public", NULL,
                        gettext_noop ("public auction outcome"),
-                       0, &GNUNET_GETOPT_set_one, &public},
+                       0, &GNUNET_GETOPT_set_one, &outcome},
+               {'i', "interactive", NULL,
+                       gettext_noop ("keep running in foreground until auction 
completes"),
+                       0, &GNUNET_GETOPT_set_one, &interactive},
                GNUNET_GETOPT_OPTION_END
        };
        if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, 
&argv))
@@ -91,7 +130,8 @@ main (int argc, char *const *argv)
        ret = (GNUNET_OK ==
                   GNUNET_PROGRAM_run (argc, argv,
                                                           
"gnunet-auction-create",
-                                                          gettext_noop ("help 
text"),
+                                                          gettext_noop 
("create a new auction and "
+                                                                        "start 
listening for bidders"),
                                                           options,
                                                           &run,
                                                           NULL)) ? ret : 1;

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



reply via email to

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