diff options
Diffstat (limited to 'src/fs/gnunet-fs.c')
-rw-r--r-- | src/fs/gnunet-fs.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c index ad2a8d6c5..3fa65d6cb 100644 --- a/src/fs/gnunet-fs.c +++ b/src/fs/gnunet-fs.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file fs/gnunet-fs.c | 21 | * @file fs/gnunet-fs.c |
22 | * @brief special file-sharing functions | 22 | * @brief special file-sharing functions |
@@ -55,20 +55,20 @@ 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, | 58 | print_indexed(void *cls, |
59 | const char *filename, | 59 | const char *filename, |
60 | const struct GNUNET_HashCode *file_id) | 60 | const struct GNUNET_HashCode *file_id) |
61 | { | 61 | { |
62 | if (NULL == filename) | 62 | if (NULL == filename) |
63 | { | 63 | { |
64 | GNUNET_FS_stop (fs); | 64 | GNUNET_FS_stop(fs); |
65 | fs = NULL; | 65 | fs = NULL; |
66 | return GNUNET_OK; | 66 | return GNUNET_OK; |
67 | } | 67 | } |
68 | if (verbose) | 68 | if (verbose) |
69 | fprintf (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename); | 69 | fprintf(stdout, "%s: %s\n", GNUNET_h2s(file_id), filename); |
70 | else | 70 | else |
71 | fprintf (stdout, "%s\n", filename); | 71 | fprintf(stdout, "%s\n", filename); |
72 | return GNUNET_OK; | 72 | return GNUNET_OK; |
73 | } | 73 | } |
74 | 74 | ||
@@ -82,32 +82,32 @@ print_indexed (void *cls, | |||
82 | * @param cfg configuration | 82 | * @param cfg configuration |
83 | */ | 83 | */ |
84 | static void | 84 | static void |
85 | run (void *cls, | 85 | run(void *cls, |
86 | char *const *args, | 86 | char *const *args, |
87 | const char *cfgfile, | 87 | const char *cfgfile, |
88 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 88 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
89 | { | 89 | { |
90 | if (list_indexed_files) | 90 | if (list_indexed_files) |
91 | { | ||
92 | fs = GNUNET_FS_start (cfg, | ||
93 | "gnunet-fs", | ||
94 | NULL, | ||
95 | NULL, | ||
96 | GNUNET_FS_FLAGS_NONE, | ||
97 | GNUNET_FS_OPTIONS_END); | ||
98 | if (NULL == fs) | ||
99 | { | 91 | { |
100 | ret = 1; | 92 | fs = GNUNET_FS_start(cfg, |
101 | return; | 93 | "gnunet-fs", |
94 | NULL, | ||
95 | NULL, | ||
96 | GNUNET_FS_FLAGS_NONE, | ||
97 | GNUNET_FS_OPTIONS_END); | ||
98 | if (NULL == fs) | ||
99 | { | ||
100 | ret = 1; | ||
101 | return; | ||
102 | } | ||
103 | if (NULL == GNUNET_FS_get_indexed_files(fs, &print_indexed, NULL)) | ||
104 | { | ||
105 | ret = 2; | ||
106 | GNUNET_FS_stop(fs); | ||
107 | fs = NULL; | ||
108 | return; | ||
109 | } | ||
102 | } | 110 | } |
103 | if (NULL == GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL)) | ||
104 | { | ||
105 | ret = 2; | ||
106 | GNUNET_FS_stop (fs); | ||
107 | fs = NULL; | ||
108 | return; | ||
109 | } | ||
110 | } | ||
111 | } | 111 | } |
112 | 112 | ||
113 | /** | 113 | /** |
@@ -118,32 +118,32 @@ run (void *cls, | |||
118 | * @return 0 ok, 1 on error | 118 | * @return 0 ok, 1 on error |
119 | */ | 119 | */ |
120 | int | 120 | int |
121 | main (int argc, char *const *argv) | 121 | main(int argc, char *const *argv) |
122 | { | 122 | { |
123 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 123 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
124 | GNUNET_GETOPT_option_flag('i', | ||
125 | "list-indexed", | ||
126 | gettext_noop( | ||
127 | "print a list of all indexed files"), | ||
128 | &list_indexed_files), | ||
124 | 129 | ||
125 | GNUNET_GETOPT_option_flag ('i', | 130 | GNUNET_GETOPT_option_verbose(&verbose), |
126 | "list-indexed", | 131 | GNUNET_GETOPT_OPTION_END |
127 | gettext_noop ( | 132 | }; |
128 | "print a list of all indexed files"), | ||
129 | &list_indexed_files), | ||
130 | |||
131 | GNUNET_GETOPT_option_verbose (&verbose), | ||
132 | GNUNET_GETOPT_OPTION_END}; | ||
133 | 133 | ||
134 | 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)) |
135 | return 2; | 135 | return 2; |
136 | ret = (GNUNET_OK == | 136 | ret = (GNUNET_OK == |
137 | GNUNET_PROGRAM_run (argc, | 137 | GNUNET_PROGRAM_run(argc, |
138 | argv, | 138 | argv, |
139 | "gnunet-fs [OPTIONS]", | 139 | "gnunet-fs [OPTIONS]", |
140 | gettext_noop ("Special file-sharing operations"), | 140 | gettext_noop("Special file-sharing operations"), |
141 | options, | 141 | options, |
142 | &run, | 142 | &run, |
143 | NULL)) | 143 | NULL)) |
144 | ? ret | 144 | ? ret |
145 | : 1; | 145 | : 1; |
146 | GNUNET_free ((void *) argv); | 146 | GNUNET_free((void *)argv); |
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | 149 | ||