diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-29 10:07:38 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-31 08:07:46 -0300 |
commit | 2d28251a6e2850998f475c76a886121554c9b7e9 (patch) | |
tree | 48cf4ae9525577fd6bc7d35068f1519a44e05b37 /src/os_unix.c | |
parent | 1ab6cf47bd4218c303459efd288456e51f46033b (diff) | |
download | rneovim-2d28251a6e2850998f475c76a886121554c9b7e9.tar.gz rneovim-2d28251a6e2850998f475c76a886121554c9b7e9.tar.bz2 rneovim-2d28251a6e2850998f475c76a886121554c9b7e9.zip |
Extract `shell_skip_word` from `mch_call_shell`
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index b8d42b5b42..7324f1318b 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -53,6 +53,7 @@ #include "os/time.h" #include "os/event.h" #include "os/input.h" +#include "os/shell.h" #include "os_unixx.h" /* unix includes for os_unix.c only */ @@ -1705,7 +1706,6 @@ int options; /* SHELL_*, see vim.h */ char_u *p_shcf_copy = NULL; int i; char_u *p; - int inquote; int pty_master_fd = -1; /* for pty's */ int fd_toshell[2]; /* for pipes */ int fd_fromshell[2]; @@ -1723,18 +1723,10 @@ int options; /* SHELL_*, see vim.h */ // Count the number of arguments for the shell p = newcmd; - inquote = FALSE; argc = 0; while (true) { ++argc; - // Move `p` to the end of shell word by advancing the pointer it while it's - // inside a quote or it's a non-whitespace character - while (*p && (inquote || (*p != ' ' && *p != TAB))) { - if (*p == '"') - // Found a quote character, switch the `inquote` flag - inquote = !inquote; - ++p; - } + shell_skip_word(&p); if (*p == NUL) break; // Move to the next word @@ -1759,16 +1751,11 @@ int options; /* SHELL_*, see vim.h */ // Build argv[] p = newcmd; - inquote = FALSE; argc = 0; while (true) { argv[argc] = (char *)p; ++argc; - while (*p && (inquote || (*p != ' ' && *p != TAB))) { - if (*p == '"') - inquote = !inquote; - ++p; - } + shell_skip_word(&p); if (*p == NUL) break; // Terminate the word |