aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-06 14:28:29 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-06 14:28:29 +0100
commitb0f1f0f3fac0120b116132dfd90742b0115b152f (patch)
treea4702cf93a42274635da22c171a0a0a0f6d58325 /src/fs
parentc9e6bedfb094fe75dda634938206fc408520717c (diff)
downloadgnunet-b0f1f0f3fac0120b116132dfd90742b0115b152f.tar.gz
gnunet-b0f1f0f3fac0120b116132dfd90742b0115b152f.zip
indentation fixes
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_getopt.c29
-rw-r--r--src/fs/gnunet-publish.c35
-rw-r--r--src/fs/gnunet-search.c49
3 files changed, 59 insertions, 54 deletions
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 @@
38 * @param scls must be of type "struct GNUNET_FS_Uri **" 38 * @param scls must be of type "struct GNUNET_FS_Uri **"
39 * @param option name of the option (typically 'k') 39 * @param option name of the option (typically 'k')
40 * @param value command line argument given 40 * @param value command line argument given
41 * @return GNUNET_OK on success 41 * @return #GNUNET_OK on success
42 */ 42 */
43static int 43static int
44getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext 44getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
45 *ctx, void *scls, const char *option, 45 void *scls,
46 const char *value) 46 const char *option,
47 const char *value)
47{ 48{
48 struct GNUNET_FS_Uri **uri = scls; 49 struct GNUNET_FS_Uri **uri = scls;
49 struct GNUNET_FS_Uri *u = *uri; 50 struct GNUNET_FS_Uri *u = *uri;
50 char *val; 51 char *val;
51 size_t slen; 52 size_t slen;
52 53
53 if (u == NULL) 54 if (NULL == u)
54 { 55 {
55 u = GNUNET_new (struct GNUNET_FS_Uri); 56 u = GNUNET_new (struct GNUNET_FS_Uri);
56 *uri = u; 57 *uri = u;
@@ -60,10 +61,10 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
60 } 61 }
61 else 62 else
62 { 63 {
63 GNUNET_assert (u->type == GNUNET_FS_URI_KSK); 64 GNUNET_assert (GNUNET_FS_URI_KSK == u->type);
64 } 65 }
65 slen = strlen (value); 66 slen = strlen (value);
66 if (slen == 0) 67 if (0 == slen)
67 return GNUNET_SYSERR; /* cannot be empty */ 68 return GNUNET_SYSERR; /* cannot be empty */
68 if (value[0] == '+') 69 if (value[0] == '+')
69 { 70 {
@@ -75,7 +76,9 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
75 /* remove the quotes, keep the '+' */ 76 /* remove the quotes, keep the '+' */
76 val = GNUNET_malloc (slen - 1); 77 val = GNUNET_malloc (slen - 1);
77 val[0] = '+'; 78 val[0] = '+';
78 GNUNET_memcpy (&val[1], &value[2], slen - 3); 79 GNUNET_memcpy (&val[1],
80 &value[2],
81 slen - 3);
79 val[slen - 2] = '\0'; 82 val[slen - 2] = '\0';
80 } 83 }
81 else 84 else
@@ -91,7 +94,9 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
91 /* remove the quotes, add a space */ 94 /* remove the quotes, add a space */
92 val = GNUNET_malloc (slen); 95 val = GNUNET_malloc (slen);
93 val[0] = ' '; 96 val[0] = ' ';
94 GNUNET_memcpy (&val[1], &value[1], slen - 2); 97 GNUNET_memcpy (&val[1],
98 &value[1],
99 slen - 2);
95 val[slen - 1] = '\0'; 100 val[slen - 1] = '\0';
96 } 101 }
97 else 102 else
@@ -102,10 +107,13 @@ getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
102 strcat (val, value); 107 strcat (val, value);
103 } 108 }
104 } 109 }
105 GNUNET_array_append (u->data.ksk.keywords, u->data.ksk.keywordCount, val); 110 GNUNET_array_append (u->data.ksk.keywords,
111 u->data.ksk.keywordCount,
112 val);
106 return GNUNET_OK; 113 return GNUNET_OK;
107} 114}
108 115
116
109/** 117/**
110 * Allow user to specify keywords. 118 * Allow user to specify keywords.
111 * 119 *
@@ -135,6 +143,7 @@ GNUNET_FS_GETOPT_KEYWORDS (char shortName,
135 return clo; 143 return clo;
136} 144}
137 145
146
138/** 147/**
139 * Command-line option parser function that allows the user to specify 148 * Command-line option parser function that allows the user to specify
140 * one or more '-m' options with metadata. Each specified entry of 149 * 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)
728 GNUNET_SCHEDULER_shutdown (); 728 GNUNET_SCHEDULER_shutdown ();
729 return; 729 return;
730 } 730 }
731 GNUNET_FS_publish_ksk (ctx, topKeywords, 731 GNUNET_FS_publish_ksk (ctx,
732 topKeywords,
732 meta, uri, 733 meta, uri,
733 &bo, 734 &bo,
734 GNUNET_FS_PUBLISH_OPTION_NONE, 735 GNUNET_FS_PUBLISH_OPTION_NONE,
@@ -889,7 +890,8 @@ run (void *cls,
889 * @return 0 ok, 1 on error 890 * @return 0 ok, 1 on error
890 */ 891 */
891int 892int
892main (int argc, char *const *argv) 893main (int argc,
894 char *const *argv)
893{ 895{
894 struct GNUNET_GETOPT_CommandLineOption options[] = { 896 struct GNUNET_GETOPT_CommandLineOption options[] = {
895 GNUNET_GETOPT_option_uint ('a', 897 GNUNET_GETOPT_option_uint ('a',
@@ -922,26 +924,22 @@ main (int argc, char *const *argv)
922 "TYPE:VALUE", 924 "TYPE:VALUE",
923 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), 925 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
924 &meta), 926 &meta),
925
926 GNUNET_GETOPT_option_flag ('n', 927 GNUNET_GETOPT_option_flag ('n',
927 "noindex", 928 "noindex",
928 gettext_noop ("do not index, perform full insertion (stores " 929 gettext_noop ("do not index, perform full insertion (stores "
929 "entire file in encrypted form in GNUnet database)"), 930 "entire file in encrypted form in GNUnet database)"),
930 &do_insert), 931 &do_insert),
931
932 GNUNET_GETOPT_option_string ('N', 932 GNUNET_GETOPT_option_string ('N',
933 "next", 933 "next",
934 "ID", 934 "ID",
935 gettext_noop ("specify ID of an updated version to be " 935 gettext_noop ("specify ID of an updated version to be "
936 "published in the future (for namespace insertions only)"), 936 "published in the future (for namespace insertions only)"),
937 &next_id), 937 &next_id),
938
939 GNUNET_GETOPT_option_uint ('p', 938 GNUNET_GETOPT_option_uint ('p',
940 "priority", 939 "priority",
941 "PRIORITY", 940 "PRIORITY",
942 gettext_noop ("specify the priority of the content"), 941 gettext_noop ("specify the priority of the content"),
943 &bo.content_priority), 942 &bo.content_priority),
944
945 GNUNET_GETOPT_option_string ('P', 943 GNUNET_GETOPT_option_string ('P',
946 "pseudonym", 944 "pseudonym",
947 "NAME", 945 "NAME",
@@ -964,7 +962,6 @@ main (int argc, char *const *argv)
964 gettext_noop ("set the ID of this version of the publication " 962 gettext_noop ("set the ID of this version of the publication "
965 "(for namespace insertions only)"), 963 "(for namespace insertions only)"),
966 &this_id), 964 &this_id),
967
968 GNUNET_GETOPT_option_string ('u', 965 GNUNET_GETOPT_option_string ('u',
969 "uri", 966 "uri",
970 "URI", 967 "URI",
@@ -982,10 +979,14 @@ main (int argc, char *const *argv)
982 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 979 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
983 return 2; 980 return 2;
984 ret = (GNUNET_OK == 981 ret = (GNUNET_OK ==
985 GNUNET_PROGRAM_run (argc, argv, "gnunet-publish [OPTIONS] FILENAME", 982 GNUNET_PROGRAM_run (argc,
983 argv,
984 "gnunet-publish [OPTIONS] FILENAME",
986 gettext_noop 985 gettext_noop
987 ("Publish a file or directory on GNUnet"), 986 ("Publish a file or directory on GNUnet"),
988 options, &run, NULL)) ? ret : 1; 987 options,
988 &run,
989 NULL)) ? ret : 1;
989 GNUNET_free ((void*) argv); 990 GNUNET_free ((void*) argv);
990 return ret; 991 return ret;
991} 992}
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
304main (int argc, char *const *argv) 304main (int argc, char *const *argv)
305{ 305{
306 struct GNUNET_GETOPT_CommandLineOption options[] = { 306 struct GNUNET_GETOPT_CommandLineOption options[] = {
307
308 GNUNET_GETOPT_option_uint ('a', 307 GNUNET_GETOPT_option_uint ('a',
309 "anonymity", 308 "anonymity",
310 "LEVEL", 309 "LEVEL",
311 gettext_noop ("set the desired LEVEL of receiver-anonymity"), 310 gettext_noop ("set the desired LEVEL of receiver-anonymity"),
312 &anonymity), 311 &anonymity),
313
314
315 GNUNET_GETOPT_option_flag ('n', 312 GNUNET_GETOPT_option_flag ('n',
316 "no-network", 313 "no-network",
317 gettext_noop ("only search the local peer (no P2P network search)"), 314 gettext_noop ("only search the local peer (no P2P network search)"),
318 &local_only), 315 &local_only),
319
320 GNUNET_GETOPT_option_string ('o', 316 GNUNET_GETOPT_option_string ('o',
321 "output", 317 "output",
322 "PREFIX", 318 "PREFIX",
323 gettext_noop ("write search results to file starting with PREFIX"), 319 gettext_noop ("write search results to file starting with PREFIX"),
324 &output_filename), 320 &output_filename),
325
326 GNUNET_GETOPT_option_relative_time ('t', 321 GNUNET_GETOPT_option_relative_time ('t',
327 "timeout", 322 "timeout",
328 "DELAY", 323 "DELAY",
329 gettext_noop ("automatically terminate search after DELAY"), 324 gettext_noop ("automatically terminate search after DELAY"),
330 &timeout), 325 &timeout),
331
332
333 GNUNET_GETOPT_option_verbose (&verbose), 326 GNUNET_GETOPT_option_verbose (&verbose),
334
335 GNUNET_GETOPT_option_uint ('N', 327 GNUNET_GETOPT_option_uint ('N',
336 "results", 328 "results",
337 "VALUE", 329 "VALUE",
338 gettext_noop ("automatically terminate search " 330 gettext_noop ("automatically terminate search "
339 "after VALUE results are found"), 331 "after VALUE results are found"),
340 &results_limit), 332 &results_limit),
341
342 GNUNET_GETOPT_OPTION_END 333 GNUNET_GETOPT_OPTION_END
343 }; 334 };
344 335
345 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 336 if (GNUNET_OK !=
337 GNUNET_STRINGS_get_utf8_args (argc, argv,
338 &argc, &argv))
346 return 2; 339 return 2;
347 340
348 ret = (GNUNET_OK == 341 ret = (GNUNET_OK ==
349 GNUNET_PROGRAM_run (argc, argv, "gnunet-search [OPTIONS] KEYWORD", 342 GNUNET_PROGRAM_run (argc,
343 argv,
344 "gnunet-search [OPTIONS] KEYWORD",
350 gettext_noop 345 gettext_noop
351 ("Search GNUnet for files that were published on GNUnet"), 346 ("Search GNUnet for files that were published on GNUnet"),
352 options, &run, NULL)) ? ret : 1; 347 options, &run, NULL)) ? ret : 1;