Revert "replace string_to_argv() with g_strsplit()"

This reverts commit 023473ac2557f37d842c81c67192feac1f898eb8.

Conflicts:
	dunst.c
This commit is contained in:
Sascha Kruse 2013-03-25 13:47:12 +01:00
parent 1a9c20ad63
commit db27662e78
3 changed files with 22 additions and 1 deletions

View File

@ -12,6 +12,7 @@
#include "option_parser.h"
#include "settings.h"
#include "config.h"
#include "utils.h"
settings_t settings;
@ -174,7 +175,7 @@ void load_settings(char *cmdline_config_path)
settings.dmenu =
option_get_string("global", "dmenu", "-dmenu", dmenu,
"path to dmenu");
settings.dmenu_cmd = g_strsplit(dmenu, " ", 0);
settings.dmenu_cmd = string_to_argv(settings.dmenu);
settings.browser =
option_get_string("global", "browser", "-browser", browser,

18
utils.c
View File

@ -68,6 +68,24 @@ char *string_append(char *a, const char *b, const char *sep)
}
char **string_to_argv(const char *s)
{
char *str = strdup(s);
char **argv = NULL;
char *p = strtok (str, " ");
int n_spaces = 0;
while (p) {
argv = realloc (argv, sizeof (char*) * ++n_spaces);
argv[n_spaces-1] = p;
p = strtok (NULL, " ");
}
argv = realloc (argv, sizeof (char*) * (n_spaces+1));
argv[n_spaces] = NULL;
return argv;
}
int digit_count(int i)
{
i = ABS(i);

View File

@ -15,6 +15,8 @@ char *string_replace(const char *needle, const char *replacement,
char *string_append(char *a, const char *b, const char *sep);
char **string_to_argv(const char *s);
/* exit with an error message */
void die(char *msg, int exit_value);