diff options
author | Markus Teich <teichm@fs.tum.de> | 2017-01-11 14:50:29 +0100 |
---|---|---|
committer | Markus Teich <teichm@fs.tum.de> | 2017-01-11 14:50:29 +0100 |
commit | 78674f13e2ba87b026d9c242f91f602aee42774d (patch) | |
tree | e202020a20213850a6dbd7f9806bd625ce47ae91 /src/auction/gnunet-auction-create.c | |
parent | 6f79b499450512c4b92d0f9dbe12932a8e8d83b6 (diff) | |
download | gnunet-78674f13e2ba87b026d9c242f91f602aee42774d.tar.gz gnunet-78674f13e2ba87b026d9c242f91f602aee42774d.zip |
cmdline for auction-create
Diffstat (limited to 'src/auction/gnunet-auction-create.c')
-rw-r--r-- | src/auction/gnunet-auction-create.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/auction/gnunet-auction-create.c b/src/auction/gnunet-auction-create.c new file mode 100644 index 000000000..fd3fcdabe --- /dev/null +++ b/src/auction/gnunet-auction-create.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file auction/gnunet-auction-create.c | ||
23 | * @brief tool to create a new auction | ||
24 | * @author Markus Teich | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | /* #include "gnunet_auction_service.h" */ | ||
29 | |||
30 | static int ret; /** Final status code. */ | ||
31 | static char *fndesc; /** filename of the item description */ | ||
32 | static char *fnprices; /** filename of the price map */ | ||
33 | static struct GNUNET_TIME_Relative dround; /** max round duration */ | ||
34 | static struct GNUNET_TIME_Relative dstart; /** time until auction starts */ | ||
35 | static unsigned int m = 0; /** auction parameter m */ | ||
36 | static int public = 0; /** public outcome */ | ||
37 | |||
38 | |||
39 | /** | ||
40 | * Main function that will be run by the scheduler. | ||
41 | * | ||
42 | * @param cls closure | ||
43 | * @param args remaining command-line arguments | ||
44 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
45 | * @param cfg configuration | ||
46 | */ | ||
47 | static void | ||
48 | run (void *cls, | ||
49 | char *const *args, | ||
50 | const char *cfgfile, | ||
51 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
52 | { | ||
53 | /* main code here */ | ||
54 | } | ||
55 | |||
56 | |||
57 | /** | ||
58 | * The main function. | ||
59 | * | ||
60 | * @param argc number of arguments from the command line | ||
61 | * @param argv command line arguments | ||
62 | * @return 0 ok, 1 on error | ||
63 | */ | ||
64 | int | ||
65 | main (int argc, char *const *argv) | ||
66 | { | ||
67 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
68 | {'d', "description", "FILE", | ||
69 | gettext_noop ("description of the item to be sold"), | ||
70 | 1, &GNUNET_GETOPT_set_filename, &fndesc}, | ||
71 | {'c', "costmap", "FILE", | ||
72 | gettext_noop ("mapping of possible prices"), | ||
73 | 1, &GNUNET_GETOPT_set_filename, &fnprices}, | ||
74 | {'r', "roundtime", "DURATION", | ||
75 | gettext_noop ("max duration per round"), | ||
76 | 1, &GNUNET_GETOPT_set_relative_time, &dround}, | ||
77 | {'s', "starttime", "DURATION", | ||
78 | gettext_noop ("duration until auction starts"), | ||
79 | 1, &GNUNET_GETOPT_set_relative_time, &dstart}, | ||
80 | {'m', "m", "NUMBER", | ||
81 | gettext_noop ("number of items to sell, 0 for first price auction"), | ||
82 | 0, &GNUNET_GETOPT_set_uint, &m}, | ||
83 | {'p', "public", NULL, | ||
84 | gettext_noop ("public auction outcome"), | ||
85 | 0, &GNUNET_GETOPT_set_one, &public}, | ||
86 | GNUNET_GETOPT_OPTION_END | ||
87 | }; | ||
88 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | ||
89 | return 2; | ||
90 | |||
91 | ret = (GNUNET_OK == | ||
92 | GNUNET_PROGRAM_run (argc, argv, | ||
93 | "gnunet-auction-create", | ||
94 | gettext_noop ("help text"), | ||
95 | options, | ||
96 | &run, | ||
97 | NULL)) ? ret : 1; | ||
98 | GNUNET_free ((void*) argv); | ||
99 | return ret; | ||
100 | } | ||