static int verbose;
-/**
- * Shutdown this process.
- *
- * @param cls unused
- * @param tc unused
- */
-static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- GNUNET_FS_stop (fs);
- fs = NULL;
-}
-
-
/**
* Print indexed filenames to stdout.
*
* @return GNUNET_OK to continue iteration
*/
static int
-print_indexed (void *cls, const char *filename, const GNUNET_HashCode * file_id)
+print_indexed (void *cls, const char *filename, const struct GNUNET_HashCode * file_id)
{
+ if (NULL == filename)
+ {
+ GNUNET_FS_stop (fs);
+ fs = NULL;
+ return GNUNET_OK;
+ }
if (verbose)
- fprintf (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename);
+ FPRINTF (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename);
else
- fprintf (stdout, "%s\n", filename);
+ FPRINTF (stdout, "%s\n", filename);
return GNUNET_OK;
}
ret = 1;
return;
}
- GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL, &do_shutdown, NULL);
+ if (NULL == GNUNET_FS_get_indexed_files (fs, &print_indexed, NULL))
+ {
+ ret = 2;
+ GNUNET_FS_stop (fs);
+ fs = NULL;
+ return;
+ }
}
}
GNUNET_GETOPT_OPTION_VERBOSE (&verbose),
GNUNET_GETOPT_OPTION_END
};
+
+ if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ return 2;
+
return (GNUNET_OK ==
GNUNET_PROGRAM_run (argc, argv, "gnunet-fs [OPTIONS]",
gettext_noop ("Special file-sharing operations"),