-improve UDP logging
[oweals/gnunet.git] / src / scalarproduct / gnunet-scalarproduct.c
index b3b954211390bc5dc60e0c20ff47ee71668152f8..f44f4c518a6f1e3edf28280886b0ff901bd8f33b 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2013, 2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2013, 2014 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -243,13 +243,20 @@ run (void *cls,
          input_peer_id);
     return;
   }
-
+  if ( ('\'' == *begin) &&
+       ('\'' == begin[strlen(begin)-1]) )
+  {
+    begin[strlen(begin)-1] = '\0';
+    if (strlen (begin) > 0)
+      begin++;
+  }
   for (end = begin; 0 != *end; end++)
     if (*end == ';')
       element_count++;
-  if (0 == element_count) {
+  if (0 == element_count)
+  {
     LOG (GNUNET_ERROR_TYPE_ERROR,
-         _("Need elements to compute the vectorproduct, got none.\n"));
+         _("Need elements to compute the scalarproduct, got none.\n"));
     return;
   }
 
@@ -276,9 +283,8 @@ run (void *cls,
       GNUNET_free (elements);
       return;
     }
-
-    /* read the element's key */
     *separator = 0;
+    /* read the element's key */
     GNUNET_CRYPTO_hash (begin,
                         strlen (begin),
                         &element.key);
@@ -316,7 +322,8 @@ run (void *cls,
                                                               &responder_callback,
                                                               NULL))) ) )
   {
-    GNUNET_break (0);
+    fprintf (stderr,
+             _("Failed to initiate computation, were all keys unique?\n"));
     GNUNET_free (elements);
     return;
   }