start_process (struct ServiceList *sl)
{
char *loprefix;
+ char *options;
char **argv;
unsigned int argv_size;
char *lopos;
+ char *optpos;
const char *firstarg;
int use_debug;
GNUNET_CONFIGURATION_get_value_string (cfg,
sl->name, "PREFIX", &loprefix))
loprefix = GNUNET_strdup (prefix_command);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ sl->name, "OPTIONS", &options))
+ options = GNUNET_strdup ("");
use_debug = GNUNET_CONFIGURATION_get_value_yesno (cfg, sl->name, "DEBUG");
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Starting service `%s'\n"), sl->name);
"Starting service `%s' using binary `%s' and configuration `%s'\n",
sl->name, sl->binary, sl->config);
#endif
- argv_size = 5;
+ argv_size = 6;
if (use_debug)
argv_size += 2;
lopos = loprefix;
argv_size++;
lopos++;
}
+ optpos = options;
+ while ('\0' != *optpos)
+ {
+ if (*optpos == ' ')
+ argv_size++;
+ optpos++;
+ }
firstarg = NULL;
argv = GNUNET_malloc (argv_size * sizeof (char *));
argv_size = 0;
lopos = loprefix;
+
while ('\0' != *lopos)
{
while (*lopos == ' ')
argv[argv_size++] = "-L";
argv[argv_size++] = "DEBUG";
}
+ optpos = options;
+ while ('\0' != *optpos)
+ {
+ while (*optpos == ' ')
+ optpos++;
+ if (*optpos == '\0')
+ continue;
+ argv[argv_size++] = optpos;
+ while (('\0' != *optpos) && (' ' != *optpos))
+ optpos++;
+ if ('\0' == *optpos)
+ continue;
+ *optpos = '\0';
+ optpos++;
+ }
argv[argv_size++] = NULL;
sl->pid = GNUNET_OS_start_process_v (firstarg, argv);
GNUNET_free (argv);
GNUNET_free (loprefix);
+ GNUNET_free (options);
}
GNUNET_free (config);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Preparing to start `%s'\n"), servicename);
sl = GNUNET_malloc (sizeof (struct ServiceList));
sl->name = GNUNET_strdup (servicename);
sl->next = running;