diff options
author | Markus Teich <teichm@fs.tum.de> | 2017-01-12 12:30:02 +0100 |
---|---|---|
committer | Markus Teich <teichm@fs.tum.de> | 2017-01-12 12:30:02 +0100 |
commit | 0eb8cdd10f29874f572e215cf91ff42c2a8f9c03 (patch) | |
tree | 8c58a2f372e526b8098ab5b82b5e5fee8ecd3cd9 /src/auction | |
parent | 78674f13e2ba87b026d9c242f91f602aee42774d (diff) | |
download | gnunet-0eb8cdd10f29874f572e215cf91ff42c2a8f9c03.tar.gz gnunet-0eb8cdd10f29874f572e215cf91ff42c2a8f9c03.zip |
update cmdline parsing
Diffstat (limited to 'src/auction')
-rw-r--r-- | src/auction/gnunet-auction-create.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/auction/gnunet-auction-create.c b/src/auction/gnunet-auction-create.c index fd3fcdabe..13c84f49a 100644 --- a/src/auction/gnunet-auction-create.c +++ b/src/auction/gnunet-auction-create.c | |||
@@ -27,13 +27,18 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | /* #include "gnunet_auction_service.h" */ | 28 | /* #include "gnunet_auction_service.h" */ |
29 | 29 | ||
30 | #define FIRST_PRICE 0 | ||
31 | #define OUTCOME_PRIVATE 0 | ||
32 | #define OUTCOME_PUBLIC 1 | ||
33 | |||
30 | static int ret; /** Final status code. */ | 34 | static int ret; /** Final status code. */ |
31 | static char *fndesc; /** filename of the item description */ | 35 | static char *fndesc; /** filename of the item description */ |
32 | static char *fnprices; /** filename of the price map */ | 36 | static char *fnprices; /** filename of the price map */ |
33 | static struct GNUNET_TIME_Relative dround; /** max round duration */ | 37 | static struct GNUNET_TIME_Relative dround; /** max round duration */ |
34 | static struct GNUNET_TIME_Relative dstart; /** time until auction starts */ | 38 | static struct GNUNET_TIME_Relative dstart; /** time until auction starts */ |
35 | static unsigned int m = 0; /** auction parameter m */ | 39 | static unsigned int m = FIRST_PRICE; /** auction parameter m */ |
36 | static int public = 0; /** public outcome */ | 40 | static int outcome = OUTCOME_PRIVATE; /** outcome */ |
41 | static int interactive; /** keep running in foreground */ | ||
37 | 42 | ||
38 | 43 | ||
39 | /** | 44 | /** |
@@ -68,21 +73,26 @@ main (int argc, char *const *argv) | |||
68 | {'d', "description", "FILE", | 73 | {'d', "description", "FILE", |
69 | gettext_noop ("description of the item to be sold"), | 74 | gettext_noop ("description of the item to be sold"), |
70 | 1, &GNUNET_GETOPT_set_filename, &fndesc}, | 75 | 1, &GNUNET_GETOPT_set_filename, &fndesc}, |
71 | {'c', "costmap", "FILE", | 76 | {'p', "pricemap", "FILE", |
72 | gettext_noop ("mapping of possible prices"), | 77 | gettext_noop ("mapping of possible prices"), |
73 | 1, &GNUNET_GETOPT_set_filename, &fnprices}, | 78 | 1, &GNUNET_GETOPT_set_filename, &fnprices}, |
74 | {'r', "roundtime", "DURATION", | 79 | {'r', "roundtime", "DURATION", |
75 | gettext_noop ("max duration per round"), | 80 | gettext_noop ("max duration per round"), |
76 | 1, &GNUNET_GETOPT_set_relative_time, &dround}, | 81 | 1, &GNUNET_GETOPT_set_relative_time, &dround}, |
77 | {'s', "starttime", "DURATION", | 82 | {'s', "regtime", "DURATION", |
78 | gettext_noop ("duration until auction starts"), | 83 | gettext_noop ("duration until auction starts"), |
79 | 1, &GNUNET_GETOPT_set_relative_time, &dstart}, | 84 | 1, &GNUNET_GETOPT_set_relative_time, &dstart}, |
80 | {'m', "m", "NUMBER", | 85 | {'m', "m", "NUMBER", |
81 | gettext_noop ("number of items to sell, 0 for first price auction"), | 86 | gettext_noop ("number of items to sell\n" |
82 | 0, &GNUNET_GETOPT_set_uint, &m}, | 87 | "0 for first price auction\n" |
83 | {'p', "public", NULL, | 88 | ">0 for vickrey/M+1st price auction"), |
89 | 1, &GNUNET_GETOPT_set_uint, &m}, | ||
90 | {'u', "public", NULL, | ||
84 | gettext_noop ("public auction outcome"), | 91 | gettext_noop ("public auction outcome"), |
85 | 0, &GNUNET_GETOPT_set_one, &public}, | 92 | 0, &GNUNET_GETOPT_set_one, &outcome}, |
93 | {'i', "interactive", NULL, | ||
94 | gettext_noop ("keep running in foreground until auction completes"), | ||
95 | 0, &GNUNET_GETOPT_set_one, &interactive}, | ||
86 | GNUNET_GETOPT_OPTION_END | 96 | GNUNET_GETOPT_OPTION_END |
87 | }; | 97 | }; |
88 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 98 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
@@ -91,7 +101,8 @@ main (int argc, char *const *argv) | |||
91 | ret = (GNUNET_OK == | 101 | ret = (GNUNET_OK == |
92 | GNUNET_PROGRAM_run (argc, argv, | 102 | GNUNET_PROGRAM_run (argc, argv, |
93 | "gnunet-auction-create", | 103 | "gnunet-auction-create", |
94 | gettext_noop ("help text"), | 104 | gettext_noop ("create a new auction and " |
105 | "start listening for bidders"), | ||
95 | options, | 106 | options, |
96 | &run, | 107 | &run, |
97 | NULL)) ? ret : 1; | 108 | NULL)) ? ret : 1; |