![]() |
GNUnet
0.11.x
|
implements command line that sets option More...
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 int | 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 int | 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 char *about) |
Defining the option to print the command line help text (-h option). More... | |
static int | 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 int | 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 int | 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 int | 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 int | 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 int | 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 int | 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 int | 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 int | 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 integer. More... | |
static int | 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 int | 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... | |
implements command line that sets option
Definition in file getopt_helpers.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) |
Definition at line 29 of file getopt_helpers.c.
#define BORDER 29 |
At what offset does the help text start?
Definition at line 82 of file getopt_helpers.c.
Referenced by format_help().
|
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 42 of file getopt_helpers.c.
References GNUNET_GETOPT_CommandLineProcessorContext::binaryName, and GNUNET_NO.
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 94 of file getopt_helpers.c.
References _, GNUNET_GETOPT_CommandLineProcessorContext::allOptions, GNUNET_GETOPT_CommandLineProcessorContext::binaryOptions, BORDER, GNUNET_OS_ProjectData::bug_email, gettext, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OS_project_data_get(), GNUNET_OS_ProjectData::homepage, GNUNET_OS_ProjectData::is_gnu, name, p, and GNUNET_GETOPT_CommandLineOption::scls.
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 GNUNET_OK, and GNUNET_GETOPT_CommandLineOption::scls.
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 312 of file getopt_helpers.c.
References GNUNET_OK, and GNUNET_GETOPT_CommandLineOption::scls.
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 370 of file getopt_helpers.c.
References GNUNET_assert, GNUNET_free, GNUNET_OK, GNUNET_strdup, and GNUNET_GETOPT_CommandLineOption::scls.
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 451 of file getopt_helpers.c.
References GNUNET_assert, GNUNET_free, GNUNET_OK, GNUNET_STRINGS_filename_expand(), and GNUNET_GETOPT_CommandLineOption::scls.
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 556 of file getopt_helpers.c.
References _, dummy, GNUNET_OK, GNUNET_SYSERR, and GNUNET_GETOPT_CommandLineOption::scls.
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 620 of file getopt_helpers.c.
References _, delta, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_SYSERR, GNUNET_TIME_set_offset(), and GNUNET_TIME_Relative::rel_value_us.
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 709 of file getopt_helpers.c.
References _, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_relative(), and GNUNET_SYSERR.
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 774 of file getopt_helpers.c.
References _, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_absolute(), and GNUNET_SYSERR.
Referenced by GNUNET_GETOPT_option_absolute_time().
|
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 839 of file getopt_helpers.c.
References _, dummy, GNUNET_OK, GNUNET_SYSERR, and GNUNET_GETOPT_CommandLineOption::scls.
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 911 of file getopt_helpers.c.
References _, dummy, GNUNET_OK, GNUNET_SYSERR, and GNUNET_GETOPT_CommandLineOption::scls.
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 1002 of file getopt_helpers.c.
References _, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, Base32Context::val, and Base32Context::val_size.
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 1033 of file getopt_helpers.c.
References GNUNET_free.
Referenced by GNUNET_GETOPT_option_base32_fixed_size().