From bd227b6f90ab2be4921d82f73d053a71ccb43320 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 30 Mar 2013 15:46:25 +0100 Subject: [PATCH] Removed to much g_strstrip() from commands. Normally we, don't need to trim trailing whitespace to run the commands properly. So it's enough to remove leading whitespace. If also trailing whitespace is removed, commands like 'input :open ' won't work anymore, because they contain essential tailing whitespace. --- src/command.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/command.c b/src/command.c index f00eeb3..6058d86 100644 --- a/src/command.c +++ b/src/command.c @@ -156,7 +156,8 @@ gboolean command_run_string(const char *input) } str =g_strdup(input); - g_strstrip(str); + /* remove leading whitespace */ + g_strchug(str); /* get a possible command count */ vb.state.count = g_ascii_strtoll(str, &command, 10); @@ -181,19 +182,15 @@ gboolean command_run_string(const char *input) gboolean command_run_multi(const Arg *arg) { gboolean result = TRUE; - char **commands, *input; + char **commands; unsigned int len, i; if (!arg->s || *(arg->s) == '\0') { return false; } - input = g_strdup(arg->s); - g_strstrip(input); - /* splits the commands */ - commands = g_strsplit(input, "|", 0); - g_free(input); + commands = g_strsplit(arg->s, "|", 0); len = g_strv_length(commands); if (!len) { -- 2.20.1