aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-directory.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/fs/gnunet-directory.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/fs/gnunet-directory.c')
-rw-r--r--src/fs/gnunet-directory.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index a6fa42664..f2b99f48d 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -40,11 +40,9 @@ static int ret;
40 * @return always 0 (to continue iterating) 40 * @return always 0 (to continue iterating)
41 */ 41 */
42static int 42static int
43item_printer (void *cls, 43item_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
44 const char *plugin_name, 44 enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
45 enum EXTRACTOR_MetaType type, 45 const char *data, size_t data_size)
46 enum EXTRACTOR_MetaFormat format,
47 const char *data_mime_type, const char *data, size_t data_size)
48{ 46{
49 if (type == EXTRACTOR_METATYPE_GNUNET_FULL_DATA) 47 if (type == EXTRACTOR_METATYPE_GNUNET_FULL_DATA)
50 { 48 {
@@ -81,17 +79,16 @@ item_printer (void *cls,
81 * @param data data available for the file (length bytes) 79 * @param data data available for the file (length bytes)
82 */ 80 */
83static void 81static void
84print_entry (void *cls, 82print_entry (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
85 const char *filename, 83 const struct GNUNET_CONTAINER_MetaData *meta, size_t length,
86 const struct GNUNET_FS_Uri *uri, 84 const void *data)
87 const struct GNUNET_CONTAINER_MetaData *meta,
88 size_t length, const void *data)
89{ 85{
90 char *string; 86 char *string;
91 char *name; 87 char *name;
92 88
93 name = GNUNET_CONTAINER_meta_data_get_by_type (meta, 89 name =
94 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME); 90 GNUNET_CONTAINER_meta_data_get_by_type (meta,
91 EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
95 if (uri == NULL) 92 if (uri == NULL)
96 { 93 {
97 printf (_("Directory `%s' meta data:\n"), name); 94 printf (_("Directory `%s' meta data:\n"), name);
@@ -119,9 +116,8 @@ print_entry (void *cls,
119 * @param cfg configuration 116 * @param cfg configuration
120 */ 117 */
121static void 118static void
122run (void *cls, 119run (void *cls, char *const *args, const char *cfgfile,
123 char *const *args, 120 const struct GNUNET_CONFIGURATION_Handle *cfg)
124 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
125{ 121{
126 struct GNUNET_DISK_MapHandle *map; 122 struct GNUNET_DISK_MapHandle *map;
127 struct GNUNET_DISK_FileHandle *h; 123 struct GNUNET_DISK_FileHandle *h;
@@ -140,16 +136,14 @@ run (void *cls,
140 i = 0; 136 i = 0;
141 while (NULL != (filename = args[i++])) 137 while (NULL != (filename = args[i++]))
142 { 138 {
143 if ((GNUNET_OK != 139 if ((GNUNET_OK != GNUNET_DISK_file_size (filename, &size, GNUNET_YES)) ||
144 GNUNET_DISK_file_size (filename, 140 (NULL ==
145 &size, 141 (h =
146 GNUNET_YES)) || 142 GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
147 (NULL == (h = GNUNET_DISK_file_open (filename, 143 GNUNET_DISK_PERM_NONE))))
148 GNUNET_DISK_OPEN_READ,
149 GNUNET_DISK_PERM_NONE))))
150 { 144 {
151 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 145 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read directory `%s'\n"),
152 _("Failed to read directory `%s'\n"), filename); 146 filename);
153 ret = 1; 147 ret = 1;
154 continue; 148 continue;
155 } 149 }
@@ -177,9 +171,7 @@ main (int argc, char *const *argv)
177 GNUNET_GETOPT_OPTION_END 171 GNUNET_GETOPT_OPTION_END
178 }; 172 };
179 return (GNUNET_OK == 173 return (GNUNET_OK ==
180 GNUNET_PROGRAM_run (argc, 174 GNUNET_PROGRAM_run (argc, argv, "gnunet-directory [OPTIONS] FILENAME",
181 argv,
182 "gnunet-directory [OPTIONS] FILENAME",
183 gettext_noop 175 gettext_noop
184 ("Display contents of a GNUnet directory"), 176 ("Display contents of a GNUnet directory"),
185 options, &run, NULL)) ? ret : 1; 177 options, &run, NULL)) ? ret : 1;