if (NULL == args[0])
{
- fprintf (stderr, _("You must specify a filename to inspect."));
+ FPRINTF (stderr, "%s", _("You must specify a filename to inspect.\n"));
ret = 1;
return;
}
i = 0;
while (NULL != (filename = args[i++]))
{
- if ((GNUNET_OK != GNUNET_DISK_file_size (filename, &size, GNUNET_YES)) ||
+ if ((GNUNET_OK != GNUNET_DISK_file_size (filename, &size, GNUNET_YES, GNUNET_YES)) ||
(NULL ==
(h =
GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
len = (size_t) size;
data = GNUNET_DISK_file_map (h, &map, GNUNET_DISK_MAP_TYPE_READ, len);
GNUNET_assert (NULL != data);
- GNUNET_FS_directory_list_contents (len, data, 0, &print_entry, NULL);
- printf ("\n");
+ if (GNUNET_OK != GNUNET_FS_directory_list_contents (len, data, 0, &print_entry, NULL))
+ fprintf (stdout, _("`%s' is not a GNUnet directory\n"),
+ filename);
+ else
+ printf ("\n");
GNUNET_DISK_file_unmap (map);
GNUNET_DISK_file_close (h);
}
static struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-directory [OPTIONS] FILENAME",
- gettext_noop
- ("Display contents of a GNUnet directory"),
- options, &run, NULL)) ? ret : 1;
+
+ if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ return 2;
+
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-directory [OPTIONS] FILENAME",
+ gettext_noop
+ ("Display contents of a GNUnet directory"),
+ options, &run, NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of gnunet-directory.c */