Make extra_shell_arg a mch_call_shell parameter

This commit is contained in:
Thiago de Arruda 2014-03-29 12:53:11 -03:00
parent 8a61c27b1e
commit c791922224
8 changed files with 15 additions and 16 deletions

View File

@ -840,7 +840,7 @@ static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff)
tmp_orig, tmp_new);
append_redir(cmd, (int)len, p_srr, tmp_diff);
block_autocmds(); /* Avoid ShellCmdPost stuff */
(void)call_shell(cmd, SHELL_FILTER | SHELL_SILENT | SHELL_DOOUT);
(void)call_shell(cmd, SHELL_FILTER | SHELL_SILENT | SHELL_DOOUT, NULL);
unblock_autocmds();
vim_free(cmd);
}
@ -943,7 +943,7 @@ void ex_diffpatch(exarg_T *eap)
#endif // ifdef UNIX
// Avoid ShellCmdPost stuff
block_autocmds();
(void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
(void)call_shell(buf, SHELL_FILTER | SHELL_COOKED, NULL);
unblock_autocmds();
}

View File

@ -1102,7 +1102,7 @@ do_filter (
* like ":r !cat" hangs.
* Pass on the SHELL_DOOUT flag when the output is being redirected.
*/
if (call_shell(cmd_buf, SHELL_FILTER | SHELL_COOKED | shell_flags)) {
if (call_shell(cmd_buf, SHELL_FILTER | SHELL_COOKED | shell_flags, NULL)) {
redraw_later_clear();
wait_return(FALSE);
}
@ -1256,7 +1256,7 @@ do_shell (
if (!swapping_screen())
windgoto(msg_row, msg_col);
cursor_on();
(void)call_shell(cmd, SHELL_COOKED | flags);
(void)call_shell(cmd, SHELL_COOKED | flags, NULL);
did_check_timestamps = FALSE;
need_check_timestamps = TRUE;

View File

@ -3670,7 +3670,7 @@ get_cmd_output (
* Don't check timestamps here.
*/
++no_check_timestamps;
call_shell(command, SHELL_DOOUT | SHELL_EXPAND | flags);
call_shell(command, SHELL_DOOUT | SHELL_EXPAND | flags, NULL);
--no_check_timestamps;
vim_free(command);

View File

@ -1531,7 +1531,7 @@ int default_fileformat(void)
/*
* Call shell. Calls mch_call_shell, with 'shellxquote' added.
*/
int call_shell(char_u *cmd, int opt)
int call_shell(char_u *cmd, int opt, char_u *extra_shell_arg)
{
char_u *ncmd;
int retval;
@ -1557,7 +1557,7 @@ int call_shell(char_u *cmd, int opt)
tag_freematch();
if (cmd == NULL || *p_sxq == NUL)
retval = mch_call_shell(cmd, opt);
retval = mch_call_shell(cmd, opt, extra_shell_arg);
else {
char_u *ecmd = cmd;
@ -1575,7 +1575,7 @@ int call_shell(char_u *cmd, int opt)
STRCAT(ncmd, STRCMP(p_sxq, "(") == 0 ? (char_u *)")"
: STRCMP(p_sxq, "\"(") == 0 ? (char_u *)")\""
: p_sxq);
retval = mch_call_shell(ncmd, opt);
retval = mch_call_shell(ncmd, opt, extra_shell_arg);
vim_free(ncmd);
} else
retval = -1;

View File

@ -64,7 +64,7 @@ int get_fileformat(buf_T *buf);
int get_fileformat_force(buf_T *buf, exarg_T *eap);
void set_fileformat(int t, int opt_flags);
int default_fileformat(void);
int call_shell(char_u *cmd, int opt);
int call_shell(char_u *cmd, int opt, char_u *extra_shell_arg);
int get_real_state(void);
int after_pathsep(char_u *b, char_u *p);
int same_directory(char_u *f1, char_u *f2);

View File

@ -53,3 +53,5 @@ int shell_count_argc(char_u **ptr)
return rv;
}
char ** shell_build_argv(char_u **ptr, int argc);

View File

@ -143,7 +143,6 @@ static int save_patterns(int num_pat, char_u **pat, int *num_file,
/* volatile because it is used in signal handler sig_winch(). */
static volatile int do_resize = FALSE;
static char_u *extra_shell_arg = NULL;
static int show_shell_mess = TRUE;
/* volatile because it is used in signal handler deathtrap(). */
static volatile int deadly_signal = 0; /* The signal we caught */
@ -1682,9 +1681,7 @@ waitstatus *status;
return wait_pid;
}
int mch_call_shell(cmd, options)
char_u *cmd;
int options; /* SHELL_*, see vim.h */
int mch_call_shell(char_u *cmd, int options, char_u *extra_shell_arg)
{
int tmode = cur_tmode;
@ -2515,6 +2512,7 @@ int flags; /* EW_* flags */
size_t len;
char_u *p;
int dir;
char_u *extra_shell_arg = NULL;
/*
* This is the non-OS/2 implementation (really Unix).
*/
@ -2715,14 +2713,13 @@ int flags; /* EW_* flags */
/*
* execute the shell command
*/
i = call_shell(command, SHELL_EXPAND | SHELL_SILENT);
i = call_shell(command, SHELL_EXPAND | SHELL_SILENT, extra_shell_arg);
/* When running in the background, give it some time to create the temp
* file, but don't wait for it to finish. */
if (ampersent)
os_delay(10L, TRUE);
extra_shell_arg = NULL; /* cleanup */
show_shell_mess = TRUE;
vim_free(command);

View File

@ -42,7 +42,7 @@ int mch_screenmode(char_u *arg);
int mch_get_shellsize(void);
void mch_set_shellsize(void);
void mch_new_shellsize(void);
int mch_call_shell(char_u *cmd, int options);
int mch_call_shell(char_u *cmd, int options, char_u *extra_shell_arg);
int mch_expandpath(garray_T *gap, char_u *path, int flags);
int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
char_u ***file,