gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10539 - gnunet/src/arm


From: gnunet
Subject: [GNUnet-SVN] r10539 - gnunet/src/arm
Date: Wed, 10 Mar 2010 17:16:27 +0100

Author: grothoff
Date: 2010-03-10 17:16:27 +0100 (Wed, 10 Mar 2010)
New Revision: 10539

Modified:
   gnunet/src/arm/gnunet-service-arm.c
Log:
enable $ expansion for GLOBAL_POSTFIX

Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2010-03-10 16:16:13 UTC (rev 10538)
+++ gnunet/src/arm/gnunet-service-arm.c 2010-03-10 16:16:27 UTC (rev 10539)
@@ -357,7 +357,11 @@
   char *loprefix;
   char *options;
   char *optpos;
+  char *optend;
+  const char *next;
   int use_debug;
+  char b;
+  char *val;
 
   /* start service */
   if (GNUNET_OK !=
@@ -369,9 +373,9 @@
                                             sl->name, "OPTIONS", &options))
     {      
       options = GNUNET_strdup (final_option);
-      /* replace '{}' with service name */
       if (NULL == strstr (options, "%"))
        {
+         /* replace '{}' with service name */
          while (NULL != (optpos = strstr (options, "{}")))
            {
              optpos[0] = '%';
@@ -382,6 +386,33 @@
              GNUNET_free (options);
              options = optpos;
            }
+         /* replace '$PATH' with value associated with "PATH" */
+         while (NULL != (optpos = strstr (options, "$")))
+           {
+             optend = optpos + 1;
+             while (isupper (*optend)) optend++;             
+             b = *optend;
+             if ('\0' == b)
+               next = "";
+             else
+               next = optend+1;
+             *optend = '\0';
+             if (GNUNET_OK !=
+                 GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS",
+                                                        optpos+1,
+                                                        &val))
+               val = GNUNET_strdup ("");
+             *optpos = '\0';
+             GNUNET_asprintf (&optpos,
+                              "%s%s%c%s",
+                              options,
+                              val,
+                              b,
+                              next);
+             GNUNET_free (options);
+             GNUNET_free (val);
+             options = optpos;
+           }
        }
     }
   use_debug = GNUNET_CONFIGURATION_get_value_yesno (cfg, sl->name, "DEBUG");





reply via email to

[Prev in Thread] Current Thread [Next in Thread]