aboutsummaryrefslogtreecommitdiff
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.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index 9b3602d73..310c8a1ae 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -53,8 +53,7 @@ static int verbose;
53 * @param tc unused 53 * @param tc unused
54 */ 54 */
55static void 55static void
56do_shutdown (void *cls, 56do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
57 const struct GNUNET_SCHEDULER_TaskContext *tc)
58{ 57{
59 GNUNET_FS_stop (fs); 58 GNUNET_FS_stop (fs);
60 fs = NULL; 59 fs = NULL;
@@ -70,18 +69,12 @@ do_shutdown (void *cls,
70 * @return GNUNET_OK to continue iteration 69 * @return GNUNET_OK to continue iteration
71 */ 70 */
72static int 71static int
73print_indexed (void *cls, const char *filename, 72print_indexed (void *cls, const char *filename, const GNUNET_HashCode * file_id)
74 const GNUNET_HashCode * file_id)
75{ 73{
76 if (verbose) 74 if (verbose)
77 fprintf (stdout, 75 fprintf (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename);
78 "%s: %s\n",
79 GNUNET_h2s (file_id),
80 filename);
81 else 76 else
82 fprintf (stdout, 77 fprintf (stdout, "%s\n", filename);
83 "%s\n",
84 filename);
85 return GNUNET_OK; 78 return GNUNET_OK;
86} 79}
87 80
@@ -100,18 +93,13 @@ run (void *cls, char *const *args, const char *cfgfile,
100{ 93{
101 if (list_indexed_files) 94 if (list_indexed_files)
102 { 95 {
103 fs = GNUNET_FS_start (cfg, 96 fs = GNUNET_FS_start (cfg, "gnunet-fs", NULL, NULL, GNUNET_FS_FLAGS_NONE);
104 "gnunet-fs",
105 NULL, NULL,
106 GNUNET_FS_FLAGS_NONE);
107 if (NULL == fs) 97 if (NULL == fs)
108 { 98 {
109 ret = 1; 99 ret = 1;
110 return; 100 return;
111 } 101 }
112 GNUNET_FS_get_indexed_files (fs, 102 GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL, &do_shutdown, NULL);
113 &print_indexed, NULL,
114 &do_shutdown, NULL);
115 } 103 }
116} 104}
117 105
@@ -134,8 +122,7 @@ main (int argc, char *const *argv)
134 }; 122 };
135 return (GNUNET_OK == 123 return (GNUNET_OK ==
136 GNUNET_PROGRAM_run (argc, argv, "gnunet-fs [OPTIONS]", 124 GNUNET_PROGRAM_run (argc, argv, "gnunet-fs [OPTIONS]",
137 gettext_noop 125 gettext_noop ("Special file-sharing operations"),
138 ("Special file-sharing operations"),
139 options, &run, NULL)) ? ret : 1; 126 options, &run, NULL)) ? ret : 1;
140} 127}
141 128