aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os/shell.c')
-rw-r--r--src/nvim/os/shell.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 8f2018c1f4..461a79c37b 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -25,6 +25,7 @@
#include "nvim/os/shell.h"
#include "nvim/os/signal.h"
#include "nvim/path.h"
+#include "nvim/profile.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
@@ -54,7 +55,7 @@ static void save_patterns(int num_pat, char **pat, int *num_file, char ***file)
char_u *s = vim_strsave((char_u *)pat[i]);
// Be compatible with expand_filename(): halve the number of
// backslashes.
- backslash_halve(s);
+ backslash_halve((char *)s);
(*file)[i] = (char *)s;
}
*num_file = num_pat;
@@ -73,7 +74,7 @@ static bool have_wildcard(int num, char **file)
static bool have_dollars(int num, char **file)
{
for (int i = 0; i < num; i++) {
- if (vim_strchr((char *)file[i], '$') != NULL) {
+ if (vim_strchr(file[i], '$') != NULL) {
return true;
}
}
@@ -248,10 +249,16 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
}
STRCAT(command, ">");
} else {
- if (flags & EW_NOTFOUND) {
- STRCPY(command, "set nonomatch; ");
- } else {
- STRCPY(command, "unset nonomatch; ");
+ STRCPY(command, "");
+ if (shell_style == STYLE_GLOB) {
+ // Assume the nonomatch option is valid only for csh like shells,
+ // otherwise, this may set the positional parameters for the shell,
+ // e.g. "$*".
+ if (flags & EW_NOTFOUND) {
+ STRCAT(command, "set nonomatch; ");
+ } else {
+ STRCAT(command, "unset nonomatch; ");
+ }
}
if (shell_style == STYLE_GLOB) {
STRCAT(command, "glob >");
@@ -501,7 +508,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
}
// check if this entry should be included
- dir = (os_isdir((char_u *)(*file)[i]));
+ dir = (os_isdir((*file)[i]));
if ((dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE))) {
continue;
}
@@ -904,7 +911,7 @@ static int do_os_system(char **argv, const char *input, size_t len, char **outpu
out_data_ring(NULL, SIZE_MAX);
}
if (forward_output) {
- // caller should decide if wait_return is invoked
+ // caller should decide if wait_return() is invoked
no_wait_return++;
msg_end();
no_wait_return--;