summaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs.c')
-rw-r--r--src/fs/gnunet-fs.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 3fa65d6cb..a44fcdf7a 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -55,20 +55,20 @@ static unsigned int verbose;
55 * @return GNUNET_OK to continue iteration 55 * @return GNUNET_OK to continue iteration
56 */ 56 */
57static int 57static int
58print_indexed(void *cls, 58print_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 */
84static void 84static void
85run(void *cls, 85run (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)
91 { 99 {
92 fs = GNUNET_FS_start(cfg, 100 ret = 1;
93 "gnunet-fs", 101 return;
94 NULL, 102 }
95 NULL, 103 if (NULL == GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL))
96 GNUNET_FS_FLAGS_NONE, 104 {
97 GNUNET_FS_OPTIONS_END); 105 ret = 2;
98 if (NULL == fs) 106 GNUNET_FS_stop (fs);
99 { 107 fs = NULL;
100 ret = 1; 108 return;
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 }
110 } 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 */
120int 120int
121main(int argc, char *const *argv) 121main (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', 124 GNUNET_GETOPT_option_flag ('i',
125 "list-indexed", 125 "list-indexed",
126 gettext_noop( 126 gettext_noop (
127 "print a list of all indexed files"), 127 "print a list of all indexed files"),
128 &list_indexed_files), 128 &list_indexed_files),
129 129
130 GNUNET_GETOPT_option_verbose(&verbose), 130 GNUNET_GETOPT_option_verbose (&verbose),
131 GNUNET_GETOPT_OPTION_END 131 GNUNET_GETOPT_OPTION_END
132 }; 132 };
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