add keywords from metadata for files
[oweals/gnunet.git] / src / datacache / test_datacache_quota.c
index ada5ae1715c57e7176bfbe55c3802e70c76406af..d956ac36f2b06507d5dfe10d992d646e7fce4ca1 100644 (file)
@@ -45,7 +45,6 @@ static const char *plugin_name;
  */
 static void
 run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *sched,
      char *const *args,
      const char *cfgfile, 
      const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -59,8 +58,7 @@ run (void *cls,
   struct GNUNET_TIME_Absolute exp;
 
   ok = 0;
-  h = GNUNET_DATACACHE_create (sched,
-                              cfg,
+  h = GNUNET_DATACACHE_create (cfg,
                               "testcache");
 
   if (h == NULL)
@@ -70,7 +68,7 @@ run (void *cls,
       return;
     }
   exp = GNUNET_TIME_absolute_get ();
-  exp.value += 20 * 60 * 1000;
+  exp.abs_value += 20 * 60 * 1000;
   memset (buf, 1, sizeof (buf));
   memset (&k, 0, sizeof (GNUNET_HashCode));
   for (i = 0; i < 10; i++)
@@ -79,7 +77,7 @@ run (void *cls,
       GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
       for (j = i; j < sizeof (buf); j += 10)
         {
-         exp.value++;
+         exp.abs_value++;
           buf[j] = i;
           ASSERT (GNUNET_OK == 
                  GNUNET_DATACACHE_put (h,
@@ -123,7 +121,7 @@ FAILURE:
 int
 main (int argc, char *argv[])
 {
-  const char *pos;
+  char *pos;
   char cfg_name[128];
   char *const xargv[] = { 
     "test-datacache-quota",
@@ -145,14 +143,22 @@ main (int argc, char *argv[])
                     "WARNING",
 #endif
                     NULL);
+
   /* determine name of plugin to use */
   plugin_name = argv[0];
   while (NULL != (pos = strstr(plugin_name, "_")))
     plugin_name = pos+1;
+  if (NULL != (pos = strstr(plugin_name, ".")))
+    pos[0] = 0;
+  else
+    pos = (char *) plugin_name;
+  
   GNUNET_snprintf (cfg_name,
                   sizeof (cfg_name),
                   "test_datacache_data_%s.conf",
                   plugin_name);
+  if (pos != plugin_name)
+    pos[0] = '.';
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1,
                       xargv, "test-datacache-quota", "nohelp",
                       options, &run, NULL);