From 5a7cef0202631204485cbcb1e36671e4321a936f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 25 Mar 2017 21:25:44 +0100 Subject: rename GNUNET_GETOPT functions to achieve better consistency --- src/util/getopt_helpers.c | 34 +++++++++++++++++----------------- src/util/gnunet-config.c | 12 ++++++------ src/util/gnunet-ecc.c | 10 +++++----- src/util/gnunet-resolver.c | 2 +- src/util/gnunet-scrypt.c | 8 ++++---- src/util/program.c | 10 +++++----- src/util/service.c | 12 ++++++------ src/util/test_getopt.c | 16 ++++++++-------- src/util/test_program.c | 14 +++++++------- 9 files changed, 59 insertions(+), 59 deletions(-) (limited to 'src/util') diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index 76342a6c9..c3d0e4c7c 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c @@ -60,7 +60,7 @@ print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param version string with the version number */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_VERSION (const char *version) +GNUNET_GETOPT_option_version (const char *version) { struct GNUNET_GETOPT_CommandLineOption clo = { .shortName = 'v', @@ -191,7 +191,7 @@ OUTER: * @param about string with brief description of the application */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_HELP (const char *about) +GNUNET_GETOPT_option_help (const char *about) { struct GNUNET_GETOPT_CommandLineOption clo = { .shortName = 'h', @@ -242,7 +242,7 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] val increment by 1 each time the option is present */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_INCREMENT_VALUE (char shortName, +GNUNET_GETOPT_option_increment_uint (char shortName, const char *name, const char *description, unsigned int *val) @@ -266,7 +266,7 @@ GNUNET_GETOPT_OPTION_INCREMENT_VALUE (char shortName, * @param[out] level set to the verbosity level */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_VERBOSE (unsigned int *level) +GNUNET_GETOPT_option_verbose (unsigned int *level) { struct GNUNET_GETOPT_CommandLineOption clo = { .shortName = 'V', @@ -318,7 +318,7 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] val set to 1 if the option is present */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_SET_ONE (char shortName, +GNUNET_GETOPT_option_flag (char shortName, const char *name, const char *description, int *val) @@ -374,7 +374,7 @@ set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] str set to the string */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_STRING (char shortName, +GNUNET_GETOPT_option_string (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -401,7 +401,7 @@ GNUNET_GETOPT_OPTION_STRING (char shortName, * @param[out] level set to the log level */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_LOGLEVEL (char **level) +GNUNET_GETOPT_option_loglevel (char **level) { struct GNUNET_GETOPT_CommandLineOption clo = { .shortName = 'L', @@ -453,7 +453,7 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] str set to the string */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_FILENAME (char shortName, +GNUNET_GETOPT_option_filename (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -479,7 +479,7 @@ GNUNET_GETOPT_OPTION_FILENAME (char shortName, * @param[out] logfn set to the name of the logfile */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_LOGFILE (char **logfn) +GNUNET_GETOPT_option_logfile (char **logfn) { struct GNUNET_GETOPT_CommandLineOption clo = { .shortName = 'l', @@ -501,7 +501,7 @@ GNUNET_GETOPT_OPTION_LOGFILE (char **logfn) * @param[out] fn set to the name of the configuration file */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_CFG_FILE (char **fn) +GNUNET_GETOPT_option_cfgfile (char **fn) { struct GNUNET_GETOPT_CommandLineOption clo = { .shortName = 'c', @@ -561,7 +561,7 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] val set to the value specified at the command line */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_SET_ULONG (char shortName, +GNUNET_GETOPT_option_ulong (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -626,7 +626,7 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] val set to the time specified at the command line */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME (char shortName, +GNUNET_GETOPT_option_relative_time (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -691,7 +691,7 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] val set to the time specified at the command line */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_SET_ABSOLUTE_TIME (char shortName, +GNUNET_GETOPT_option_absolute_time (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -755,7 +755,7 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, * @param[out] val set to the value specified at the command line */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_SET_UINT (char shortName, +GNUNET_GETOPT_option_uint (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -830,7 +830,7 @@ set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, /** * Helper function to clean up after - * #GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE. + * #GNUNET_GETOPT_option_base32_fixed_size. * * @param cls value to GNUNET_free() */ @@ -853,7 +853,7 @@ free_bc (void *cls) * @param val_size size of @a val in bytes */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, +GNUNET_GETOPT_option_base32_fixed_size (char shortName, const char *name, const char *argumentHelp, const char *description, @@ -885,7 +885,7 @@ GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, * @return @a opt with the mandatory flag set. */ struct GNUNET_GETOPT_CommandLineOption -GNUNET_GETOPT_OPTION_MANDATORY (struct GNUNET_GETOPT_CommandLineOption opt) +GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt) { opt.option_mandatory = 1; return opt; diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 2beb772a9..fb3b9ebf9 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -224,30 +224,30 @@ int main (int argc, char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('f', + GNUNET_GETOPT_option_flag ('f', "filename", gettext_noop ("obtain option of value as a filename (with $-expansion)"), &is_filename), - GNUNET_GETOPT_OPTION_STRING ('s', + GNUNET_GETOPT_option_string ('s', "section", "SECTION", gettext_noop ("name of the section to access"), §ion), - GNUNET_GETOPT_OPTION_STRING ('o', + GNUNET_GETOPT_option_string ('o', "option", "OPTION", gettext_noop ("name of the option to access"), &option), - GNUNET_GETOPT_OPTION_STRING ('V', + GNUNET_GETOPT_option_string ('V', "value", "VALUE", gettext_noop ("value to set"), &value), - GNUNET_GETOPT_OPTION_SET_ONE ('S', + GNUNET_GETOPT_option_flag ('S', "list-sections", gettext_noop ("print available configuration sections"), &list_sections), - GNUNET_GETOPT_OPTION_SET_ONE ('w', + GNUNET_GETOPT_option_flag ('w', "rewrite", gettext_noop ("write configuration file that only contains delta to defaults"), &rewrite), diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 732228b52..2a712f4eb 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c @@ -411,25 +411,25 @@ main (int argc, { list_keys_count = UINT32_MAX; struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('i', + GNUNET_GETOPT_option_flag ('i', "iterate", gettext_noop ("list keys included in a file (for testing)"), &list_keys), - GNUNET_GETOPT_OPTION_SET_UINT ('e', + GNUNET_GETOPT_option_uint ('e', "end=", "COUNT", gettext_noop ("number of keys to list included in a file (for testing)"), &list_keys_count), - GNUNET_GETOPT_OPTION_SET_UINT ('g', + GNUNET_GETOPT_option_uint ('g', "generate-keys", "COUNT", gettext_noop ("create COUNT public-private key pairs (for testing)"), &make_keys), - GNUNET_GETOPT_OPTION_SET_ONE ('p', + GNUNET_GETOPT_option_flag ('p', "print-public-key", gettext_noop ("print the public key in ASCII format"), &print_public_key), - GNUNET_GETOPT_OPTION_SET_ONE ('E', + GNUNET_GETOPT_option_flag ('E', "examples", gettext_noop ("print examples of ECC operations (used for compatibility testing)"), &print_examples_flag), diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 563cf9fce..7ffafee32 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c @@ -145,7 +145,7 @@ int main (int argc, char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('r', + GNUNET_GETOPT_option_flag ('r', "reverse", gettext_noop ("perform a reverse lookup"), &reverse), diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 7c73cfe1e..3b3b7d695 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c @@ -311,22 +311,22 @@ main (int argc, char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_OPTION_SET_ULONG ('b', + GNUNET_GETOPT_option_ulong ('b', "bits", "BITS", gettext_noop ("number of bits to require for the proof of work"), &nse_work_required), - GNUNET_GETOPT_OPTION_FILENAME ('k', + GNUNET_GETOPT_option_filename ('k', "keyfile", "FILE", gettext_noop ("file with private key, otherwise default is used"), &pkfn), - GNUNET_GETOPT_OPTION_FILENAME ('o', + GNUNET_GETOPT_option_filename ('o', "outfile", "FILE", gettext_noop ("file with proof of work, otherwise default is used"), &pwfn), - GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', + GNUNET_GETOPT_option_relative_time ('t', "timeout", "TIME", gettext_noop ("time to wait between calculations"), diff --git a/src/util/program.c b/src/util/program.c index e2b356f88..92a9750f3 100644 --- a/src/util/program.c +++ b/src/util/program.c @@ -148,11 +148,11 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName, struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_GETOPT_CommandLineOption defoptions[] = { - GNUNET_GETOPT_OPTION_CFG_FILE (&cc.cfgfile), - GNUNET_GETOPT_OPTION_HELP (binaryHelp), - GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev), - GNUNET_GETOPT_OPTION_LOGFILE (&logfile), - GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION) + GNUNET_GETOPT_option_cfgfile (&cc.cfgfile), + GNUNET_GETOPT_option_help (binaryHelp), + GNUNET_GETOPT_option_loglevel (&loglev), + GNUNET_GETOPT_option_logfile (&logfile), + GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION) }; struct GNUNET_GETOPT_CommandLineOption *allopts; const char *gargs; diff --git a/src/util/service.c b/src/util/service.c index 800d09a42..f63737e56 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -1722,15 +1722,15 @@ GNUNET_SERVICE_run_ (int argc, int err; struct GNUNET_GETOPT_CommandLineOption service_options[] = { - GNUNET_GETOPT_OPTION_CFG_FILE (&opt_cfg_filename), - GNUNET_GETOPT_OPTION_SET_ONE ('d', + GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename), + GNUNET_GETOPT_option_flag ('d', "daemonize", gettext_noop ("do daemonize (detach from terminal)"), &do_daemonize), - GNUNET_GETOPT_OPTION_HELP (NULL), - GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev), - GNUNET_GETOPT_OPTION_LOGFILE (&logfile), - GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION), + GNUNET_GETOPT_option_help (NULL), + GNUNET_GETOPT_option_loglevel (&loglev), + GNUNET_GETOPT_option_logfile (&logfile), + GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION), GNUNET_GETOPT_OPTION_END }; diff --git a/src/util/test_getopt.c b/src/util/test_getopt.c index 13cedd7f5..16f2df8d1 100644 --- a/src/util/test_getopt.c +++ b/src/util/test_getopt.c @@ -56,7 +56,7 @@ testVerbose () unsigned int vflags = 0; const struct GNUNET_GETOPT_CommandLineOption verboseoptionlist[] = { - GNUNET_GETOPT_OPTION_VERBOSE (&vflags), + GNUNET_GETOPT_option_verbose (&vflags), GNUNET_GETOPT_OPTION_END }; @@ -83,7 +83,7 @@ testVersion () NULL }; const struct GNUNET_GETOPT_CommandLineOption versionoptionlist[] = { - GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION), + GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION), GNUNET_GETOPT_OPTION_END }; @@ -105,7 +105,7 @@ testAbout () NULL }; const struct GNUNET_GETOPT_CommandLineOption aboutoptionlist[] = { - GNUNET_GETOPT_OPTION_HELP ("Testing"), + GNUNET_GETOPT_option_help ("Testing"), GNUNET_GETOPT_OPTION_END }; @@ -131,8 +131,8 @@ testLogOpts () char *fn = NULL; const struct GNUNET_GETOPT_CommandLineOption logoptionlist[] = { - GNUNET_GETOPT_OPTION_LOGFILE (&fn), - GNUNET_GETOPT_OPTION_LOGLEVEL (&level), + GNUNET_GETOPT_option_logfile (&fn), + GNUNET_GETOPT_option_loglevel (&level), GNUNET_GETOPT_OPTION_END }; @@ -173,16 +173,16 @@ testFlagNum () unsigned long long lnum = 0; const struct GNUNET_GETOPT_CommandLineOption logoptionlist[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('f', + GNUNET_GETOPT_option_flag ('f', "--flag", "helptext", &flag), - GNUNET_GETOPT_OPTION_SET_UINT ('n', + GNUNET_GETOPT_option_uint ('n', "--num", "ARG", "helptext", &num), - GNUNET_GETOPT_OPTION_SET_ULONG ('N', + GNUNET_GETOPT_option_ulong ('N', "--lnum", "ARG", "helptext", diff --git a/src/util/test_program.c b/src/util/test_program.c index d206952af..6d51b1872 100644 --- a/src/util/test_program.c +++ b/src/util/test_program.c @@ -64,40 +64,40 @@ main (int argc, char *argv[]) NULL }; struct GNUNET_GETOPT_CommandLineOption options1[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('n', + GNUNET_GETOPT_option_flag ('n', "name", "description", &setme1), GNUNET_GETOPT_OPTION_END }; struct GNUNET_GETOPT_CommandLineOption options2[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('n', + GNUNET_GETOPT_option_flag ('n', "name", "description", &setme1), - GNUNET_GETOPT_OPTION_SET_ONE ('N', + GNUNET_GETOPT_option_flag ('N', "number", "description", &setme2), GNUNET_GETOPT_OPTION_END }; struct GNUNET_GETOPT_CommandLineOption options3[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('N', + GNUNET_GETOPT_option_flag ('N', "number", "description", &setme1), - GNUNET_GETOPT_OPTION_SET_ONE ('n', + GNUNET_GETOPT_option_flag ('n', "name", "description", &setme2), GNUNET_GETOPT_OPTION_END }; struct GNUNET_GETOPT_CommandLineOption options4[] = { - GNUNET_GETOPT_OPTION_SET_ONE ('n', + GNUNET_GETOPT_option_flag ('n', "name", "description", &setme1), - GNUNET_GETOPT_OPTION_SET_ONE ('n', + GNUNET_GETOPT_option_flag ('n', "name", "description", &setme2), -- cgit v1.2.3