support GLOBAL_POSTFIX
authorChristian Grothoff <christian@grothoff.org>
Wed, 10 Mar 2010 14:26:14 +0000 (14:26 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 10 Mar 2010 14:26:14 +0000 (14:26 +0000)
contrib/defaults.conf
src/arm/gnunet-service-arm.c

index f98014b5aec8ee782e9a744d22c8aac4c736ec6f..d469bf2a88eb2d9429a0fb3d928167cb040a2a1a 100644 (file)
@@ -32,6 +32,7 @@ ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 ALLOW_SHUTDOWN = YES
 DEFAULTSERVICES = resolver transport core topology hostlist
+GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs
 # GLOBAL_PREFIX =
 # USERNAME =
 # MAXBUF =
index 9c9661287db83e50115aa90c1736fb672c455309..acef4a1e1be0ae2eb474b0864d841e374ef2f8c2 100644 (file)
@@ -141,6 +141,11 @@ static struct GNUNET_SCHEDULER_Handle *sched;
  */
 static char *prefix_command;
 
+/**
+ * Option to append to each actual command.
+ */
+static char *final_option;
+
 /**
  * ID of task called whenever we get a SIGCHILD.
  */
@@ -349,6 +354,7 @@ static void
 start_process (struct ServiceList *sl)
 {
   char *loprefix;
+  char *lopostfix;
   char *options;
   char **argv;
   unsigned int argv_size;
@@ -365,7 +371,23 @@ start_process (struct ServiceList *sl)
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_string (cfg,
                                             sl->name, "OPTIONS", &options))
-    options = GNUNET_strdup ("");
+    {      
+      options = GNUNET_strdup (lopostfix);
+      /* replace '{}' with service name */
+      if (NULL == strstr (options, "%"))
+       {
+         while (NULL != (optpos = strstr (options, "{}")))
+           {
+             optpos[0] = '%';
+             optpos[1] = 's';
+             GNUNET_asprintf (&optpos,
+                              options,
+                              sl->name);
+             GNUNET_free (options);
+             options = optpos;
+           }
+       }
+    }
   use_debug = GNUNET_CONFIGURATION_get_value_yesno (cfg, sl->name, "DEBUG");
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Starting service `%s'\n"), sl->name);
@@ -1011,6 +1033,12 @@ run (void *cls,
                                             "GLOBAL_PREFIX",
                                             &prefix_command))
     prefix_command = GNUNET_strdup ("");
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (cfg,
+                                            "ARM",
+                                            "GLOBAL_POSTFIX",
+                                            &final_option))
+    final_option = GNUNET_strdup ("");
   /* start default services... */
   if (GNUNET_OK ==
       GNUNET_CONFIGURATION_get_value_string (cfg,