enhance gnunet-qr to support passing arguments beyond just the URI to commands
authorChristian Grothoff <christian@grothoff.org>
Mon, 16 Dec 2019 16:29:38 +0000 (17:29 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 16 Dec 2019 16:29:38 +0000 (17:29 +0100)
src/namestore/namestore.conf.in
src/util/gnunet-qr.c

index b5fb45abc0f76c0d7d216c2737a6ef02bcea2d5d..e6cc74aec52f17cb37fc29a78d763abb4e483dc2 100644 (file)
@@ -36,7 +36,7 @@ TEMPORARY_TABLE = NO
 ASYNC_COMMIT = NO
 
 [uri]
-gns = gnunet-namestore
+gns = gnunet-namestore -u
 
 
 [fcfsd]
index cdeea4db128a7dc2a84418fef8c1d796b3e2d98f..2dcfc12db4e5b7491f5650c91d9ef8fe78663386 100644 (file)
@@ -141,15 +141,37 @@ gnunet_uri (void *cls,
     GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ),
     &maint_child_death,
     NULL);
-  p = GNUNET_OS_start_process (GNUNET_NO,
-                               0,
-                               NULL,
-                               NULL,
-                               NULL,
-                               program,
-                               program,
-                               orig_uri,
-                               NULL);
+  {
+    char **argv = NULL;
+    unsigned int argc = 0;
+    char *u = GNUNET_strdup (orig_uri);
+
+    GNUNET_array_append (argv,
+                         argc,
+                         GNUNET_strdup (program));
+    for (const char *tok = strtok (u, " ");
+         NULL != tok;
+         tok = strtok (NULL, " "))
+      GNUNET_array_append (argv,
+                           argc,
+                           GNUNET_strdup (tok));
+    GNUNET_array_append (argv,
+                         argc,
+                         NULL);
+    p = GNUNET_OS_start_process_vap (GNUNET_NO,
+                                     0,
+                                     NULL,
+                                     NULL,
+                                     NULL,
+                                     program,
+                                     argv);
+    for (unsigned int i = 0; i<argc; i++)
+      GNUNET_free (argv[i]);
+    GNUNET_array_grow (argv,
+                       argc,
+                       0);
+    GNUNET_free (orig_uri);
+  }
   GNUNET_free (program);
   if (NULL == p)
     GNUNET_SCHEDULER_cancel (rt);