Go to the source code of this file.
Data Structures | |
struct | Base32Context |
Closure for set_base32(). More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) |
#define | BORDER 29 |
At what offset does the help text start? More... | |
Functions | |
static enum GNUNET_GenericReturnValue | print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Print out program version (implements –version). More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_version (const char *version) |
Define the option to print the version of the application (-v option) More... | |
static enum GNUNET_GenericReturnValue | format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Print out details on command line options (implements –help). More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_help (const struct GNUNET_OS_ProjectData *pd, const char *about) |
Defining the option to print the command line help text (-h option). More... | |
static enum GNUNET_GenericReturnValue | increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'unsigned int' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_increment_uint (char shortName, const char *name, const char *description, unsigned int *val) |
Increment val each time the option flag is given by one. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_verbose (unsigned int *level) |
Define the '-V' verbosity option. More... | |
static enum GNUNET_GenericReturnValue | set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'int' from the command line to 1 if the given option is present. More... | |
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. More... | |
static enum GNUNET_GenericReturnValue | set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'char *' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_string (char shortName, const char *name, const char *argumentHelp, const char *description, char **str) |
Allow user to specify a string. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_loglevel (char **level) |
Define the '-L' log level option. More... | |
static enum GNUNET_GenericReturnValue | set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'char *' from the command line with filename expansion a la GNUNET_STRINGS_filename_expand(). More... | |
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). More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_logfile (char **logfn) |
Allow user to specify log file name (-l option) More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_cfgfile (char **fn) |
Allow user to specify configuration file name (-c option) More... | |
static enum GNUNET_GenericReturnValue | set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'unsigned long long' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_ulong (char shortName, const char *name, const char *argumentHelp, const char *description, unsigned long long *val) |
Allow user to specify an unsigned long long . More... | |
static enum GNUNET_GenericReturnValue | set_timetravel_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'struct GNUNET_TIME_Relative' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_timetravel (char shortName, const char *name) |
Allow user to specify a long long with an offset to add to the current system time to construct the time seen by the application. More... | |
static enum GNUNET_GenericReturnValue | set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'struct GNUNET_TIME_Relative' from the command line. More... | |
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). More... | |
static enum GNUNET_GenericReturnValue | set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'struct GNUNET_TIME_Absolute' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_absolute_time (char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Absolute *val) |
Allow user to specify a struct GNUNET_TIME_Absolute (using human-readable "fancy" time). More... | |
static enum GNUNET_GenericReturnValue | set_timestamp (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'struct GNUNET_TIME_Timestamp' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_timestamp (char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Timestamp *val) |
Allow user to specify a struct GNUNET_TIME_Timestamp (using human-readable "fancy" time). More... | |
static enum GNUNET_GenericReturnValue | set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'unsigned int' from the command line. More... | |
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 . More... | |
static enum GNUNET_GenericReturnValue | set_uint16 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'uint16_t' from the command line. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_uint16 (char shortName, const char *name, const char *argumentHelp, const char *description, uint16_t *val) |
Allow user to specify an uint16_t. More... | |
static enum GNUNET_GenericReturnValue | set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, void *scls, const char *option, const char *value) |
Set an option of type 'unsigned int' from the command line. More... | |
static void | free_bc (void *cls) |
Helper function to clean up after GNUNET_GETOPT_option_base32_fixed_size. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_base32_fixed_size (char shortName, const char *name, const char *argumentHelp, const char *description, void *val, size_t val_size) |
Allow user to specify a binary value using Crockford Base32 encoding. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt) |
Make the given option mandatory. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_GETOPT_option_exclusive (struct GNUNET_GETOPT_CommandLineOption opt) |
Make the given option mutually exclusive with other options. More... | |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) |
Definition at line 30 of file getopt_helpers.c.
#define BORDER 29 |
At what offset does the help text start?
Definition at line 79 of file getopt_helpers.c.
|
static |
Print out program version (implements –version).
ctx | command line processing context |
scls | additional closure (points to version string) |
option | name of the option |
value | not used (NULL) |
Definition at line 43 of file getopt_helpers.c.
References ctx, GNUNET_NO, and value.
Referenced by GNUNET_GETOPT_option_version().
|
static |
Print out details on command line options (implements –help).
ctx | command line processing context |
scls | additional closure (points to about text) |
option | name of the option |
value | not used (NULL) |
Definition at line 91 of file getopt_helpers.c.
References _, GNUNET_GETOPT_CommandLineOption::argumentHelp, BORDER, GNUNET_OS_ProjectData::bug_email, ctx, GNUNET_GETOPT_CommandLineOption::description, gettext, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OS_ProjectData::homepage, consensus-simulation::int, GNUNET_OS_ProjectData::is_gnu, name, p, GNUNET_GETOPT_CommandLineOption::shortName, and value.
Referenced by GNUNET_GETOPT_option_help().
|
static |
Set an option of type 'unsigned int' from the command line.
Each time the option flag is given, the value is incremented by one. A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'int'.
ctx | command line processing context |
scls | additional closure (will point to the 'unsigned int') |
option | name of the option |
value | not used (NULL) |
Definition at line 233 of file getopt_helpers.c.
References ctx, GNUNET_OK, GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_increment_uint(), and GNUNET_GETOPT_option_verbose().
|
static |
Set an option of type 'int' from the command line to 1 if the given option is present.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'int'.
ctx | command line processing context |
scls | additional closure (will point to the 'int') |
option | name of the option |
value | not used (NULL) |
Definition at line 297 of file getopt_helpers.c.
References ctx, GNUNET_OK, GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_flag().
|
static |
Set an option of type 'char *' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'char *', which will be allocated with the requested string.
ctx | command line processing context |
scls | additional closure (will point to the 'char *', which will be allocated) |
option | name of the option |
value | actual value of the option (a string) |
Definition at line 345 of file getopt_helpers.c.
References ctx, GNUNET_assert, GNUNET_free, GNUNET_OK, GNUNET_strdup, GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_loglevel(), and GNUNET_GETOPT_option_string().
|
static |
Set an option of type 'char *' from the command line with filename expansion a la GNUNET_STRINGS_filename_expand().
ctx | command line processing context |
scls | additional closure (will point to the char * , which will be allocated) |
option | name of the option |
value | actual value of the option (a string) |
Definition at line 411 of file getopt_helpers.c.
References ctx, GNUNET_assert, GNUNET_free, GNUNET_OK, GNUNET_STRINGS_filename_expand(), GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_cfgfile(), GNUNET_GETOPT_option_filename(), and GNUNET_GETOPT_option_logfile().
|
static |
Set an option of type 'unsigned long long' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'unsigned long long'.
ctx | command line processing context |
scls | additional closure (will point to the 'unsigned long long') |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 497 of file getopt_helpers.c.
References _, ctx, dummy, GNUNET_OK, GNUNET_SYSERR, GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_ulong().
|
static |
Set an option of type 'struct GNUNET_TIME_Relative' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'struct GNUNET_TIME_Relative'.
ctx | command line processing context |
scls | additional closure (will point to the 'struct GNUNET_TIME_Relative') |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 552 of file getopt_helpers.c.
References _, ctx, delta, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_SYSERR, GNUNET_TIME_set_offset(), GNUNET_TIME_Relative::rel_value_us, and value.
Referenced by GNUNET_GETOPT_option_timetravel().
|
static |
Set an option of type 'struct GNUNET_TIME_Relative' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'struct GNUNET_TIME_Relative'.
ctx | command line processing context |
scls | additional closure (will point to the 'struct GNUNET_TIME_Relative') |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 631 of file getopt_helpers.c.
References _, ctx, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_SYSERR, and value.
Referenced by GNUNET_GETOPT_option_relative_time().
|
static |
Set an option of type 'struct GNUNET_TIME_Absolute' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'struct GNUNET_TIME_Absolute'.
ctx | command line processing context |
scls | additional closure (will point to the struct GNUNET_TIME_Absolute ) |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 685 of file getopt_helpers.c.
References _, ctx, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_SYSERR, and value.
Referenced by GNUNET_GETOPT_option_absolute_time().
|
static |
Set an option of type 'struct GNUNET_TIME_Timestamp' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'struct GNUNET_TIME_Absolute'.
ctx | command line processing context |
scls | additional closure (will point to the struct GNUNET_TIME_Absolute ) |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 739 of file getopt_helpers.c.
References _, GNUNET_TIME_Absolute::abs_value_us, ctx, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_SYSERR, GNUNET_TIME_UNIT_SECONDS, t, and value.
Referenced by GNUNET_GETOPT_option_timestamp().
|
static |
Set an option of type 'unsigned int' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'unsigned int'.
ctx | command line processing context |
scls | additional closure (will point to the 'unsigned int') |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 803 of file getopt_helpers.c.
References _, ctx, dummy, GNUNET_OK, GNUNET_SYSERR, GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_uint().
|
static |
Set an option of type 'uint16_t' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'uint16_t'.
ctx | command line processing context |
scls | additional closure (will point to the 'unsigned int') |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 866 of file getopt_helpers.c.
References _, ctx, dummy, GNUNET_OK, GNUNET_SYSERR, GNUNET_GETOPT_CommandLineOption::scls, and value.
Referenced by GNUNET_GETOPT_option_uint16().
|
static |
Set an option of type 'unsigned int' from the command line.
A pointer to this function should be passed as part of the 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options of this type. It should be followed by a pointer to a value of type 'unsigned int'.
ctx | command line processing context |
scls | additional closure (will point to the 'unsigned int') |
option | name of the option |
value | actual value of the option as a string. |
Definition at line 948 of file getopt_helpers.c.
References _, ctx, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, Base32Context::val, Base32Context::val_size, and value.
Referenced by GNUNET_GETOPT_option_base32_fixed_size().
|
static |
Helper function to clean up after GNUNET_GETOPT_option_base32_fixed_size.
cls | value to GNUNET_free() |
Definition at line 980 of file getopt_helpers.c.
References GNUNET_free.
Referenced by GNUNET_GETOPT_option_base32_fixed_size().