adding single location for no_forcestart configuration list
[oweals/gnunet.git] / src / fs / gnunet-directory.c
index c722f57ff232c581719194460a51449799b19d57..2c83d7a5e8f7c89cbf6bf998f5013d175596250b 100644 (file)
@@ -91,19 +91,19 @@ print_entry (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
                                               EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
   if (uri == NULL)
   {
-    printf (_("Directory `%s' meta data:\n"), name);
+    printf (_("Directory `%s' meta data:\n"), name ? name : "");
     GNUNET_CONTAINER_meta_data_iterate (meta, &item_printer, NULL);
     printf ("\n");
-    printf (_("Directory `%s' contents:\n"), name);
-    GNUNET_free (name);
+    printf (_("Directory `%s' contents:\n"), name ? name : "");
+    GNUNET_free_non_null (name);
     return;
   }
   string = GNUNET_FS_uri_to_string (uri);
-  printf ("%s (%s):\n", name, string);
+  printf ("%s (%s):\n", name ? name : "", string);
   GNUNET_free (string);
   GNUNET_CONTAINER_meta_data_iterate (meta, &item_printer, NULL);
   printf ("\n");
-  GNUNET_free (name);
+  GNUNET_free_non_null (name);
 }
 
 
@@ -173,11 +173,17 @@ main (int argc, char *const *argv)
   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 */