Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

replace string_to_argv() with g_strsplit()

  • Loading branch information...
commit 023473ac2557f37d842c81c67192feac1f898eb8 1 parent e2dc187
@knopwob authored
Showing with 2 additions and 22 deletions.
  1. +2 −2 dunst.c
  2. +0 −18 utils.c
  3. +0 −2  utils.h
View
4 dunst.c
@@ -235,7 +235,7 @@ void context_menu(void) {
exit(0);
} else {
browser = string_append(browser, buf, " ");
- char **cmd = string_to_argv(browser);
+ char **cmd = g_strsplit(browser, " ", 0);
execvp(cmd[0], cmd);
}
}
@@ -1711,7 +1711,7 @@ void load_options(char *cmdline_config_path)
dmenu = option_get_string("global", "dmenu", "-dmenu", dmenu, "path to dmenu");
- dmenu_cmd = string_to_argv(dmenu);
+ dmenu_cmd = g_strsplit(dmenu, " ", 0);
browser = option_get_string("global", "browser", "-browser", browser, "path to browser");
View
18 utils.c
@@ -60,24 +60,6 @@ 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)
{
int len = 0;
View
2  utils.h
@@ -10,8 +10,6 @@ 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);
Please sign in to comment.
Something went wrong with that request. Please try again.