aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--doc/man/Makefile.am1
-rw-r--r--doc/man/gnunet-directory.135
-rw-r--r--src/fs/gnunet-directory.c61
4 files changed, 68 insertions, 30 deletions
diff --git a/TODO b/TODO
index 6487c218a..82bea4f77 100644
--- a/TODO
+++ b/TODO
@@ -27,7 +27,6 @@ Urgent items (before announcing ng.gnunet.org):
27 + need to bound queueing of replies for other peers 27 + need to bound queueing of replies for other peers
28 - test multi-peer search/download 28 - test multi-peer search/download
29* new webpage 29* new webpage
30 - migrate Mantis, Subversion
31 - run peer => have a 0.9.x hostlist 30 - run peer => have a 0.9.x hostlist
32 - improve basic documentation (configure, dependencies, what works, etc.) 31 - improve basic documentation (configure, dependencies, what works, etc.)
33 - write minimal welcome/introduction to 0.9.x-development/webpage/status 32 - write minimal welcome/introduction to 0.9.x-development/webpage/status
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index aa8c737d7..11b687bbe 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -1,5 +1,6 @@
1man_MANS = \ 1man_MANS = \
2 gnunet-arm.1 \ 2 gnunet-arm.1 \
3 gnunet-directory.1 \
3 gnunet-download.1 \ 4 gnunet-download.1 \
4 gnunet-peerinfo.1 \ 5 gnunet-peerinfo.1 \
5 gnunet-publish.1 \ 6 gnunet-publish.1 \
diff --git a/doc/man/gnunet-directory.1 b/doc/man/gnunet-directory.1
new file mode 100644
index 000000000..07732530a
--- /dev/null
+++ b/doc/man/gnunet-directory.1
@@ -0,0 +1,35 @@
1.TH gnunet-directory "1" "10 Dec 2009" "GNUnet"
2.SH NAME
3gnunet\-directory \- display directories
4
5.SH SYNOPSIS
6.B gnunet\-directory
7[\fIOPTIONS\fR] (FILENAME)*
8.SH DESCRIPTION
9.PP
10gnunet\-directory lists the contents of one or more GNUnet directories. A GNUnet directory is a binary file that contains a list of GNUnet file\-sharing URIs and meta data. The names of the directory files must be passed as command\-line arguments to gnunet\-directory.
11.TP
12\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
13configuration file to use (useless option since gnunet\-directory does not really depend on any configuration options)
14.TP
15\fB\-h\fR, \fB\-\-help\fR
16print help page
17.TP
18\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR
19Change the loglevel. Possible values for LOGLEVEL are ERROR, WARNING, INFO and DEBUG.
20.TP
21\fB\-v\fR, \fB\-\-version\fR
22print the version number
23.SH NOTES
24A GNUnet directory is a file containing a list of GNUnet URIs and meta data. The keys can point to files, other directories or files in namespaces. In other words, a GNUnet directory is similar to UNIX directories. The difference to tar and zip is that GNUnet directory does not contain the actual files (except if they are really small, in which case they may be inlined), just symbolic (links), similar to directories with symbolic links in UNIX filesystems. The benefit is that the individual files can be retrieved separately (if desired) and if some of the files are inserted to another node in GNUnet, this just increases their availability but does not produce useless duplicates (for example, it is a better idea to publish a collection of pictures or compressed sound files using a GNUnet directory instead of processing them with archivers such as tar or zip first). Directories can contain arbitrary meta data for each file.
25
26If a directory has missing blocks (for example, some blocks failed to download), GNUnet is typically able to retrieve information about other files in the directory. Files in a GNUnet directory have no particular order; the GNUnet code that generates a directory can reorder the entries in order to better fit the information about files into blocks of 32k. Respecting 32k boundaries where possible makes it easier for gnunet\-directory (and other tools) to recover information from partially downloaded directory files.
27
28At the moment, directories can be created by \fBgnunet\-gtk\fP and \fBgnunet\-publish\fP. Just like ordinary files, a directory can be published in a namespace.
29
30GNUnet directories use the (unregistered) mimetype \fBapplication/gnunet\-directory\fP. They can show up among normal search results. The directory file can be downloaded to disk by \fBgnunet\-download\fP(1) for later processing or be handled more directly by \fBgnunet\-gtk\fP(1).
31
32.SH "REPORTING BUGS"
33Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
34.SH "SEE ALSO"
35\fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1)
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index 6c7bcdaf3..22eecdb19 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -102,50 +102,53 @@ run (void *cls,
102 void *data; 102 void *data;
103 size_t len; 103 size_t len;
104 uint64_t size; 104 uint64_t size;
105 const char *filename = args[0]; 105 const char *filename;
106 int i;
106 107
107 if (NULL == filename) 108 if (NULL == argv[0])
108 { 109 {
109 fprintf (stderr, 110 fprintf (stderr,
110 _("You must specify a filename to inspect.")); 111 _("You must specify a filename to inspect."));
111 ret = 1; 112 ret = 1;
112 return; 113 return;
113 } 114 }
114 if ( (GNUNET_OK != 115 i = 0;
115 GNUNET_DISK_file_size (filename, 116 while (NULL != (filename = args[i++]))
116 &size,
117 GNUNET_YES)) ||
118 (NULL == (h = GNUNET_DISK_file_open (filename,
119 GNUNET_DISK_OPEN_READ,
120 GNUNET_DISK_PERM_NONE))) )
121 { 117 {
122 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 118 if ( (GNUNET_OK !=
123 _("Failed to read directory `%s'\n"), 119 GNUNET_DISK_file_size (filename,
124 filename); 120 &size,
125 ret = 1; 121 GNUNET_YES)) ||
126 return; 122 (NULL == (h = GNUNET_DISK_file_open (filename,
123 GNUNET_DISK_OPEN_READ,
124 GNUNET_DISK_PERM_NONE))) )
125 {
126 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
127 _("Failed to read directory `%s'\n"),
128 filename);
129 ret = 1;
130 continue;
131 }
132 len = (size_t) size;
133 data = GNUNET_DISK_file_map (h,
134 &map,
135 GNUNET_DISK_MAP_TYPE_READ,
136 len);
137 GNUNET_assert (NULL != data);
138 GNUNET_FS_directory_list_contents (len,
139 data,
140 0,
141 &print_entry,
142 NULL);
143 GNUNET_DISK_file_unmap (map);
144 GNUNET_DISK_file_close (h);
127 } 145 }
128 len = (size_t) size;
129 data = GNUNET_DISK_file_map (h,
130 &map,
131 GNUNET_DISK_MAP_TYPE_READ,
132 len);
133 GNUNET_assert (NULL != data);
134 GNUNET_FS_directory_list_contents (len,
135 data,
136 0,
137 &print_entry,
138 NULL);
139 GNUNET_DISK_file_unmap (map);
140 GNUNET_DISK_file_close (h);
141} 146}
142 147
143
144/** 148/**
145 * gnunet-directory command line options 149 * gnunet-directory command line options
146 */ 150 */
147static struct GNUNET_GETOPT_CommandLineOption options[] = { 151static struct GNUNET_GETOPT_CommandLineOption options[] = {
148 // FIXME: options!
149 GNUNET_GETOPT_OPTION_END 152 GNUNET_GETOPT_OPTION_END
150}; 153};
151 154