From b0f1f0f3fac0120b116132dfd90742b0115b152f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 6 Nov 2018 14:28:29 +0100 Subject: indentation fixes --- src/fs/fs_getopt.c | 29 +++++++++++++++++++---------- src/fs/gnunet-publish.c | 35 ++++++++++++++++++----------------- src/fs/gnunet-search.c | 49 ++++++++++++++++++++++--------------------------- 3 files changed, 59 insertions(+), 54 deletions(-) (limited to 'src/fs') diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c index 7b5c2991d..cbd9339c9 100644 --- a/src/fs/fs_getopt.c +++ b/src/fs/fs_getopt.c @@ -38,19 +38,20 @@ * @param scls must be of type "struct GNUNET_FS_Uri **" * @param option name of the option (typically 'k') * @param value command line argument given - * @return GNUNET_OK on success + * @return #GNUNET_OK on success */ static int -getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext - *ctx, void *scls, const char *option, - const char *value) +getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, + void *scls, + const char *option, + const char *value) { struct GNUNET_FS_Uri **uri = scls; struct GNUNET_FS_Uri *u = *uri; char *val; size_t slen; - if (u == NULL) + if (NULL == u) { u = GNUNET_new (struct GNUNET_FS_Uri); *uri = u; @@ -60,10 +61,10 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext } else { - GNUNET_assert (u->type == GNUNET_FS_URI_KSK); + GNUNET_assert (GNUNET_FS_URI_KSK == u->type); } slen = strlen (value); - if (slen == 0) + if (0 == slen) return GNUNET_SYSERR; /* cannot be empty */ if (value[0] == '+') { @@ -75,7 +76,9 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext /* remove the quotes, keep the '+' */ val = GNUNET_malloc (slen - 1); val[0] = '+'; - GNUNET_memcpy (&val[1], &value[2], slen - 3); + GNUNET_memcpy (&val[1], + &value[2], + slen - 3); val[slen - 2] = '\0'; } else @@ -91,7 +94,9 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext /* remove the quotes, add a space */ val = GNUNET_malloc (slen); val[0] = ' '; - GNUNET_memcpy (&val[1], &value[1], slen - 2); + GNUNET_memcpy (&val[1], + &value[1], + slen - 2); val[slen - 1] = '\0'; } else @@ -102,10 +107,13 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext strcat (val, value); } } - GNUNET_array_append (u->data.ksk.keywords, u->data.ksk.keywordCount, val); + GNUNET_array_append (u->data.ksk.keywords, + u->data.ksk.keywordCount, + val); return GNUNET_OK; } + /** * Allow user to specify keywords. * @@ -135,6 +143,7 @@ GNUNET_FS_GETOPT_KEYWORDS (char shortName, return clo; } + /** * Command-line option parser function that allows the user to specify * one or more '-m' options with metadata. Each specified entry of diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 999301c2f..8501141ce 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -728,7 +728,8 @@ identity_continuation (const char *args0) GNUNET_SCHEDULER_shutdown (); return; } - GNUNET_FS_publish_ksk (ctx, topKeywords, + GNUNET_FS_publish_ksk (ctx, + topKeywords, meta, uri, &bo, GNUNET_FS_PUBLISH_OPTION_NONE, @@ -889,7 +890,8 @@ run (void *cls, * @return 0 ok, 1 on error */ int -main (int argc, char *const *argv) +main (int argc, + char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_option_uint ('a', @@ -922,26 +924,22 @@ main (int argc, char *const *argv) "TYPE:VALUE", gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), &meta), - GNUNET_GETOPT_option_flag ('n', - "noindex", - gettext_noop ("do not index, perform full insertion (stores " - "entire file in encrypted form in GNUnet database)"), - &do_insert), - + "noindex", + gettext_noop ("do not index, perform full insertion (stores " + "entire file in encrypted form in GNUnet database)"), + &do_insert), GNUNET_GETOPT_option_string ('N', "next", "ID", gettext_noop ("specify ID of an updated version to be " "published in the future (for namespace insertions only)"), &next_id), - GNUNET_GETOPT_option_uint ('p', - "priority", - "PRIORITY", - gettext_noop ("specify the priority of the content"), - &bo.content_priority), - + "priority", + "PRIORITY", + gettext_noop ("specify the priority of the content"), + &bo.content_priority), GNUNET_GETOPT_option_string ('P', "pseudonym", "NAME", @@ -964,7 +962,6 @@ main (int argc, char *const *argv) gettext_noop ("set the ID of this version of the publication " "(for namespace insertions only)"), &this_id), - GNUNET_GETOPT_option_string ('u', "uri", "URI", @@ -982,10 +979,14 @@ main (int argc, char *const *argv) if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; ret = (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, "gnunet-publish [OPTIONS] FILENAME", + GNUNET_PROGRAM_run (argc, + argv, + "gnunet-publish [OPTIONS] FILENAME", gettext_noop ("Publish a file or directory on GNUnet"), - options, &run, NULL)) ? ret : 1; + options, + &run, + NULL)) ? ret : 1; GNUNET_free ((void*) argv); return ret; } diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index 780b3c93d..2a0a153e7 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c @@ -304,49 +304,44 @@ int main (int argc, char *const *argv) { struct GNUNET_GETOPT_CommandLineOption options[] = { - GNUNET_GETOPT_option_uint ('a', - "anonymity", - "LEVEL", - gettext_noop ("set the desired LEVEL of receiver-anonymity"), - &anonymity), - - + "anonymity", + "LEVEL", + gettext_noop ("set the desired LEVEL of receiver-anonymity"), + &anonymity), GNUNET_GETOPT_option_flag ('n', - "no-network", - gettext_noop ("only search the local peer (no P2P network search)"), - &local_only), - + "no-network", + gettext_noop ("only search the local peer (no P2P network search)"), + &local_only), GNUNET_GETOPT_option_string ('o', "output", "PREFIX", gettext_noop ("write search results to file starting with PREFIX"), &output_filename), - GNUNET_GETOPT_option_relative_time ('t', - "timeout", - "DELAY", - gettext_noop ("automatically terminate search after DELAY"), - &timeout), - - + "timeout", + "DELAY", + gettext_noop ("automatically terminate search after DELAY"), + &timeout), GNUNET_GETOPT_option_verbose (&verbose), - GNUNET_GETOPT_option_uint ('N', - "results", - "VALUE", - gettext_noop ("automatically terminate search " - "after VALUE results are found"), - &results_limit), - + "results", + "VALUE", + gettext_noop ("automatically terminate search " + "after VALUE results are found"), + &results_limit), GNUNET_GETOPT_OPTION_END }; - if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) + if (GNUNET_OK != + GNUNET_STRINGS_get_utf8_args (argc, argv, + &argc, &argv)) return 2; ret = (GNUNET_OK == - GNUNET_PROGRAM_run (argc, argv, "gnunet-search [OPTIONS] KEYWORD", + GNUNET_PROGRAM_run (argc, + argv, + "gnunet-search [OPTIONS] KEYWORD", gettext_noop ("Search GNUnet for files that were published on GNUnet"), options, &run, NULL)) ? ret : 1; -- cgit v1.2.3 From 403957f04d3b27297c204772f2bf77969a7b2d0b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 6 Nov 2018 14:31:15 +0100 Subject: indentation fixes --- src/fs/gnunet-publish.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/fs') diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 8501141ce..ffcf9b5d0 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -496,21 +496,22 @@ uri_ksk_continuation (void *cls, emsg); ret = 1; } - if (NULL != namespace) + if (NULL == namespace) { - priv = GNUNET_IDENTITY_ego_get_private_key (namespace); - GNUNET_FS_publish_sks (ctx, - priv, - this_id, - next_id, - meta, - uri, - &bo, - GNUNET_FS_PUBLISH_OPTION_NONE, - &uri_sks_continuation, NULL); + GNUNET_SCHEDULER_shutdown (); return; } - GNUNET_SCHEDULER_shutdown (); + priv = GNUNET_IDENTITY_ego_get_private_key (namespace); + GNUNET_FS_publish_sks (ctx, + priv, + this_id, + next_id, + meta, + uri, + &bo, + GNUNET_FS_PUBLISH_OPTION_NONE, + &uri_sks_continuation, + NULL); } -- cgit v1.2.3