working on gnunet-directory
authorChristian Grothoff <christian@grothoff.org>
Thu, 10 Dec 2009 13:55:48 +0000 (13:55 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 10 Dec 2009 13:55:48 +0000 (13:55 +0000)
TODO
doc/man/Makefile.am
doc/man/gnunet-directory.1 [new file with mode: 0644]
src/fs/gnunet-directory.c

diff --git a/TODO b/TODO
index 6487c218a7ad7d5dbbade95dccb99e3380206d4a..82bea4f77de06ff27181777215645a4e35711dfd 100644 (file)
--- a/TODO
+++ b/TODO
@@ -27,7 +27,6 @@ Urgent items (before announcing ng.gnunet.org):
     + need to bound queueing of replies for other peers    
   - test multi-peer search/download
 * new webpage
-  - migrate Mantis, Subversion
   - run peer => have a 0.9.x hostlist
   - improve basic documentation (configure, dependencies, what works, etc.)
   - write minimal welcome/introduction to 0.9.x-development/webpage/status
index aa8c737d7ca81e1311d079cba39049032b543f3e..11b687bbee3466dddf9b0497ed91211f42501492 100644 (file)
@@ -1,5 +1,6 @@
 man_MANS = \
   gnunet-arm.1 \
+  gnunet-directory.1 \
   gnunet-download.1 \
   gnunet-peerinfo.1 \
   gnunet-publish.1 \
diff --git a/doc/man/gnunet-directory.1 b/doc/man/gnunet-directory.1
new file mode 100644 (file)
index 0000000..0773253
--- /dev/null
@@ -0,0 +1,35 @@
+.TH gnunet-directory "1" "10 Dec 2009" "GNUnet"
+.SH NAME
+gnunet\-directory \- display directories
+
+.SH SYNOPSIS
+.B gnunet\-directory
+[\fIOPTIONS\fR] (FILENAME)*
+.SH DESCRIPTION
+.PP
+gnunet\-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.
+.TP
+\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
+configuration file to use (useless option since gnunet\-directory does not really depend on any configuration options)
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+print help page
+.TP
+\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR
+Change the loglevel.  Possible values for LOGLEVEL are ERROR, WARNING, INFO and DEBUG.
+.TP
+\fB\-v\fR, \fB\-\-version\fR
+print the version number
+.SH NOTES
+A 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.
+
+If 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.
+
+At 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.
+
+GNUnet 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).
+
+.SH "REPORTING BUGS"
+Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
+.SH "SEE ALSO"
+\fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1)
index 6c7bcdaf3751be7c82a639005e488e94ea849707..22eecdb1934f3566e879d56d6be42529d727b030 100644 (file)
@@ -102,50 +102,53 @@ run (void *cls,
   void *data;
   size_t len;
   uint64_t size;
-  const char *filename = args[0];
+  const char *filename;
+  int i;
 
-  if (NULL == filename)
+  if (NULL == argv[0])
     {
       fprintf (stderr,
               _("You must specify a filename to inspect."));
       ret = 1;
       return;
     }
-  if ( (GNUNET_OK !=
-       GNUNET_DISK_file_size (filename,
-                              &size,
-                              GNUNET_YES)) ||
-       (NULL == (h = GNUNET_DISK_file_open (filename,
-                                           GNUNET_DISK_OPEN_READ,
-                                           GNUNET_DISK_PERM_NONE))) )
+  i = 0;
+  while (NULL != (filename = args[i++]))
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                 _("Failed to read directory `%s'\n"),
-                 filename);
-      ret = 1;
-      return;
+      if ( (GNUNET_OK !=
+           GNUNET_DISK_file_size (filename,
+                                  &size,
+                                  GNUNET_YES)) ||
+          (NULL == (h = GNUNET_DISK_file_open (filename,
+                                               GNUNET_DISK_OPEN_READ,
+                                               GNUNET_DISK_PERM_NONE))) )
+       {
+         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                     _("Failed to read directory `%s'\n"),
+                     filename);
+         ret = 1;
+         continue;
+       }
+      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);
+      GNUNET_DISK_file_unmap (map);
+      GNUNET_DISK_file_close (h);
     }
-  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);
-  GNUNET_DISK_file_unmap (map);
-  GNUNET_DISK_file_close (h);
 }
 
-
 /**
  * gnunet-directory command line options
  */
 static struct GNUNET_GETOPT_CommandLineOption options[] = {
-  // FIXME: options!
   GNUNET_GETOPT_OPTION_END
 };