fix segfault
[oweals/gnunet.git] / src / namestore / gnunet-namestore.c
index f48d1c23dc96e77e13db0f0210e7cfa42c4386e8..c58d58fd1f50e685fcf702d33231e5b9b25f8e95 100644 (file)
@@ -23,7 +23,6 @@
  * @author Christian Grothoff
  *
  * TODO:
- * - printing records
  * - allow users to set record options (not just 'RF_AUTHORITY')
  * - test
  * - parsing SOA, PTR and MX value specifications (and define format!)
@@ -103,7 +102,7 @@ static char *typestring;
  * Desired expiration time.
  */
 static char *expirationstring;
-               
+
 
 /**
  * Task run on shutdown.  Cleans up everything.
@@ -304,7 +303,8 @@ run (void *cls, char *const *args, const char *cfgfile,
     fprintf (stderr, _("Unsupported type `%s'\n"), typestring);
     GNUNET_SCHEDULER_shutdown ();
     return;
-  } else if (add | del)
+  }
+  if ((NULL == typestring) && (add | del))
   {
     fprintf (stderr,
             _("Missing option `%s' for operation `%s'\n"),
@@ -391,7 +391,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     rd.record_type = type;
     rd.expiration = GNUNET_TIME_relative_to_absolute (etime);
     rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY; // FIXME: not always...
-    del_qe = GNUNET_NAMESTORE_record_create (ns,
+    del_qe = GNUNET_NAMESTORE_record_remove (ns,
                                             zone_pkey,
                                             name,
                                             &rd,
@@ -423,7 +423,7 @@ main (int argc, char *const *argv)
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
     {'a', "add", NULL,
      gettext_noop ("add record"), 0,
-     &GNUNET_GETOPT_set_one, &add},   
+     &GNUNET_GETOPT_set_one, &add},
     {'d', "delete", NULL,
      gettext_noop ("delete record"), 0,
      &GNUNET_GETOPT_set_one, &del},   
@@ -431,7 +431,7 @@ main (int argc, char *const *argv)
      gettext_noop ("display records"), 0,
      &GNUNET_GETOPT_set_one, &list},   
     {'e', "expiration", "TIME",
-     gettext_noop ("expiration time to use (for adding only)"), 1,
+     gettext_noop ("expiration time for record to use (for adding only)"), 1,
      &GNUNET_GETOPT_set_string, &expirationstring},   
     {'n', "name", "NAME",
      gettext_noop ("name of the record to add/delete/display"), 1,