35#define OUTCOME_PRIVATE 0
36#define OUTCOME_PUBLIC 1
63 double cur, prev = DBL_MAX;
73 "required argument --regtime missing or invalid (zero)\n");
79 "required argument --roundtime missing or invalid (zero)\n");
85 "required argument --description missing\n");
91 "required argument --pricemap missing\n");
96 if (! (
pmap = json_load_file (
fnprices, JSON_DECODE_INT_AS_REAL, &jerr)))
99 "parsing pricemap json at %d:%d: %s\n",
100 jerr.line, jerr.column, jerr.text);
103 if (-1 == json_unpack_ex (
pmap, &jerr, JSON_VALIDATE_ONLY,
104 "{s:s, s:[]}",
"currency",
"prices"))
107 "validating pricemap: %s\n", jerr.text);
110 if (! (parray = json_object_get (
pmap,
"prices")) || ! json_is_array (parray))
113 "could not get `prices` array node from pricemap\n");
116 if (0 == json_array_size (parray))
121 json_array_foreach (parray, i, pnode)
123 if (-1 == json_unpack_ex (pnode, &jerr, 0,
"F", &cur))
126 "validating pricearray index %d: %s\n", i, jerr.text);
132 "validating pricearray index %d: "
133 "prices must be strictly monotonically decreasing\n",
156main (
int argc,
char *
const *argv)
163 "description of the item to be sold"),
182 "duration until auction starts"),
188 "0 for first price auction\n"
189 ">0 for vickrey/M+1st price auction"),
200 "keep running in foreground until auction completes"),
209 "gnunet-auction-create",
211 "start listening for bidders"),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static unsigned int m
time until auction starts
static struct GNUNET_TIME_Relative dstart
max round duration
static char * fnprices
filename of the item description
static struct GNUNET_TIME_Relative dround
filename of the price map
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
keep running in foreground
int main(int argc, char *const *argv)
The main function.
static char * fndesc
Final status code.
static int interactive
outcome
static int outcome
auction parameter m
static const struct ParameterMap pmap[]
Map of names with TeX definitions, used during PDF generation.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_filename(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a filename (automatically path expanded).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned int.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_ERROR
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
Definition of a command line option.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.