diff options
Diffstat (limited to 'src/fs/gnunet-fs.c')
-rw-r--r-- | src/fs/gnunet-fs.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c index 26970c06a..ad2a8d6c5 100644 --- a/src/fs/gnunet-fs.c +++ b/src/fs/gnunet-fs.c | |||
@@ -55,7 +55,9 @@ static unsigned int verbose; | |||
55 | * @return GNUNET_OK to continue iteration | 55 | * @return GNUNET_OK to continue iteration |
56 | */ | 56 | */ |
57 | static int | 57 | static int |
58 | print_indexed (void *cls, const char *filename, const struct GNUNET_HashCode * file_id) | 58 | print_indexed (void *cls, |
59 | const char *filename, | ||
60 | const struct GNUNET_HashCode *file_id) | ||
59 | { | 61 | { |
60 | if (NULL == filename) | 62 | if (NULL == filename) |
61 | { | 63 | { |
@@ -64,9 +66,9 @@ print_indexed (void *cls, const char *filename, const struct GNUNET_HashCode * f | |||
64 | return GNUNET_OK; | 66 | return GNUNET_OK; |
65 | } | 67 | } |
66 | if (verbose) | 68 | if (verbose) |
67 | FPRINTF (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename); | 69 | fprintf (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename); |
68 | else | 70 | else |
69 | FPRINTF (stdout, "%s\n", filename); | 71 | fprintf (stdout, "%s\n", filename); |
70 | return GNUNET_OK; | 72 | return GNUNET_OK; |
71 | } | 73 | } |
72 | 74 | ||
@@ -80,12 +82,18 @@ print_indexed (void *cls, const char *filename, const struct GNUNET_HashCode * f | |||
80 | * @param cfg configuration | 82 | * @param cfg configuration |
81 | */ | 83 | */ |
82 | static void | 84 | static void |
83 | run (void *cls, char *const *args, const char *cfgfile, | 85 | run (void *cls, |
86 | char *const *args, | ||
87 | const char *cfgfile, | ||
84 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 88 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
85 | { | 89 | { |
86 | if (list_indexed_files) | 90 | if (list_indexed_files) |
87 | { | 91 | { |
88 | fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE, | 92 | fs = GNUNET_FS_start (cfg, |
93 | "gnunet-fs", | ||
94 | NULL, | ||
95 | NULL, | ||
96 | GNUNET_FS_FLAGS_NONE, | ||
89 | GNUNET_FS_OPTIONS_END); | 97 | GNUNET_FS_OPTIONS_END); |
90 | if (NULL == fs) | 98 | if (NULL == fs) |
91 | { | 99 | { |
@@ -115,21 +123,27 @@ main (int argc, char *const *argv) | |||
115 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 123 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
116 | 124 | ||
117 | GNUNET_GETOPT_option_flag ('i', | 125 | GNUNET_GETOPT_option_flag ('i', |
118 | "list-indexed", | 126 | "list-indexed", |
119 | gettext_noop ("print a list of all indexed files"), | 127 | gettext_noop ( |
120 | &list_indexed_files), | 128 | "print a list of all indexed files"), |
129 | &list_indexed_files), | ||
121 | 130 | ||
122 | GNUNET_GETOPT_option_verbose (&verbose), | 131 | GNUNET_GETOPT_option_verbose (&verbose), |
123 | GNUNET_GETOPT_OPTION_END | 132 | GNUNET_GETOPT_OPTION_END}; |
124 | }; | ||
125 | 133 | ||
126 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 134 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
127 | return 2; | 135 | return 2; |
128 | ret = (GNUNET_OK == | 136 | ret = (GNUNET_OK == |
129 | GNUNET_PROGRAM_run (argc, argv, "gnunet-fs [OPTIONS]", | 137 | GNUNET_PROGRAM_run (argc, |
130 | gettext_noop ("Special file-sharing operations"), | 138 | argv, |
131 | options, &run, NULL)) ? ret : 1; | 139 | "gnunet-fs [OPTIONS]", |
132 | GNUNET_free ((void*) argv); | 140 | gettext_noop ("Special file-sharing operations"), |
141 | options, | ||
142 | &run, | ||
143 | NULL)) | ||
144 | ? ret | ||
145 | : 1; | ||
146 | GNUNET_free ((void *) argv); | ||
133 | return ret; | 147 | return ret; |
134 | } | 148 | } |
135 | 149 | ||