mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
Remove USE_SYSTEM and code only run under USE_SYSTEM
This commit is contained in:
parent
fafdad2f95
commit
3925d951a1
@ -10243,7 +10243,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
|
||||
"find_in_path",
|
||||
"float",
|
||||
"folding",
|
||||
#if !defined(USE_SYSTEM) && defined(UNIX)
|
||||
#if defined(UNIX)
|
||||
"fork",
|
||||
#endif
|
||||
"gettext",
|
||||
@ -10299,7 +10299,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
|
||||
"statusline",
|
||||
"spell",
|
||||
"syntax",
|
||||
#if defined(USE_SYSTEM) || !defined(UNIX)
|
||||
#if !defined(UNIX)
|
||||
"system",
|
||||
#endif
|
||||
"tag_binary",
|
||||
|
@ -125,7 +125,7 @@ void ga_append(garray_T *gap, int c)
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined(UNIX) && !defined(USE_SYSTEM)) || defined(WIN3264)
|
||||
#if defined(UNIX) || defined(WIN3264)
|
||||
/*
|
||||
* Append the text in "gap" below the cursor line and clear "gap".
|
||||
*/
|
||||
|
@ -1410,11 +1410,7 @@ static struct vimoption
|
||||
{"shellxquote", "sxq", P_STRING|P_VI_DEF|P_SECURE,
|
||||
(char_u *)&p_sxq, PV_NONE,
|
||||
{
|
||||
#if defined(UNIX) && defined(USE_SYSTEM) && !defined(__EMX__)
|
||||
(char_u *)"\"",
|
||||
#else
|
||||
(char_u *)"",
|
||||
#endif
|
||||
(char_u *)0L
|
||||
} SCRIPTID_INIT},
|
||||
{"shellxescape", "sxe", P_STRING|P_VI_DEF|P_SECURE,
|
||||
|
@ -1926,49 +1926,6 @@ char_u *cmd;
|
||||
int options; /* SHELL_*, see vim.h */
|
||||
{
|
||||
int tmode = cur_tmode;
|
||||
#ifdef USE_SYSTEM /* use system() to start the shell: simple but slow */
|
||||
int x;
|
||||
char_u *newcmd; /* only needed for unix */
|
||||
|
||||
out_flush();
|
||||
|
||||
if (options & SHELL_COOKED)
|
||||
settmode(TMODE_COOK); /* set to normal mode */
|
||||
|
||||
|
||||
if (cmd == NULL)
|
||||
x = system((char *)p_sh);
|
||||
else {
|
||||
newcmd = lalloc(STRLEN(p_sh)
|
||||
+ (extra_shell_arg == NULL ? 0 : STRLEN(extra_shell_arg))
|
||||
+ STRLEN(p_shcf) + STRLEN(cmd) + 4, TRUE);
|
||||
if (newcmd == NULL)
|
||||
x = 0;
|
||||
else {
|
||||
sprintf((char *)newcmd, "%s %s %s %s", p_sh,
|
||||
extra_shell_arg == NULL ? "" : (char *)extra_shell_arg,
|
||||
(char *)p_shcf,
|
||||
(char *)cmd);
|
||||
x = system((char *)newcmd);
|
||||
vim_free(newcmd);
|
||||
}
|
||||
}
|
||||
if (emsg_silent)
|
||||
;
|
||||
else if (x == 127)
|
||||
MSG_PUTS(_("\nCannot execute shell sh\n"));
|
||||
else if (x && !(options & SHELL_SILENT)) {
|
||||
MSG_PUTS(_("\nshell returned "));
|
||||
msg_outnum((long)x);
|
||||
msg_putchar('\n');
|
||||
}
|
||||
|
||||
if (tmode == TMODE_RAW)
|
||||
settmode(TMODE_RAW); /* set to raw mode */
|
||||
resettitle();
|
||||
return x;
|
||||
|
||||
#else /* USE_SYSTEM */ /* don't use system(), use fork()/exec() */
|
||||
|
||||
# define EXEC_FAILED 122 /* Exit code when shell didn't execute. Don't use
|
||||
127, some shells use that already */
|
||||
@ -2677,8 +2634,6 @@ error:
|
||||
vim_free(newcmd);
|
||||
|
||||
return retval;
|
||||
|
||||
#endif /* USE_SYSTEM */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2968,16 +2923,12 @@ int flags; /* EW_* flags */
|
||||
for (i = 0; i < num_pat; ++i) {
|
||||
/* Count the length of the patterns in the same way as they are put in
|
||||
* "command" below. */
|
||||
#ifdef USE_SYSTEM
|
||||
len += STRLEN(pat[i]) + 3; /* add space and two quotes */
|
||||
#else
|
||||
++len; /* add space */
|
||||
for (j = 0; pat[i][j] != NUL; ++j) {
|
||||
if (vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL)
|
||||
++len; /* may add a backslash */
|
||||
++len;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
command = alloc(len);
|
||||
if (command == NULL) {
|
||||
@ -3026,14 +2977,8 @@ int flags; /* EW_* flags */
|
||||
|
||||
if (shell_style != STYLE_BT)
|
||||
for (i = 0; i < num_pat; ++i) {
|
||||
/* When using system() always add extra quotes, because the shell
|
||||
* is started twice. Otherwise put a backslash before special
|
||||
/* Put a backslash before special
|
||||
* characters, except inside ``. */
|
||||
#ifdef USE_SYSTEM
|
||||
STRCAT(command, " \"");
|
||||
STRCAT(command, pat[i]);
|
||||
STRCAT(command, "\"");
|
||||
#else
|
||||
int intick = FALSE;
|
||||
|
||||
p = command + STRLEN(command);
|
||||
@ -3060,7 +3005,6 @@ int flags; /* EW_* flags */
|
||||
*p++ = pat[i][j];
|
||||
}
|
||||
*p = NUL;
|
||||
#endif
|
||||
}
|
||||
if (flags & EW_SILENT)
|
||||
show_shell_mess = FALSE;
|
||||
@ -3102,24 +3046,16 @@ int flags; /* EW_* flags */
|
||||
vim_free(tempname);
|
||||
/*
|
||||
* With interactive completion, the error message is not printed.
|
||||
* However with USE_SYSTEM, I don't know how to turn off error messages
|
||||
* from the shell, so screen may still get messed up -- webb.
|
||||
*/
|
||||
#ifndef USE_SYSTEM
|
||||
if (!(flags & EW_SILENT))
|
||||
#endif
|
||||
{
|
||||
redraw_later_clear(); /* probably messed up screen */
|
||||
msg_putchar('\n'); /* clear bottom line quickly */
|
||||
cmdline_row = Rows - 1; /* continue on last line */
|
||||
#ifdef USE_SYSTEM
|
||||
if (!(flags & EW_SILENT))
|
||||
#endif
|
||||
{
|
||||
MSG(_(e_wildexpand));
|
||||
msg_start(); /* don't overwrite this message */
|
||||
}
|
||||
MSG(_(e_wildexpand));
|
||||
msg_start(); /* don't overwrite this message */
|
||||
}
|
||||
|
||||
/* If a `cmd` expansion failed, don't list `cmd` as a match, even when
|
||||
* EW_NOTFOUND is given */
|
||||
if (shell_style == STYLE_BT)
|
||||
|
@ -22,8 +22,6 @@
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifndef USE_SYSTEM /* use fork/exec to start the shell */
|
||||
|
||||
# if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT)
|
||||
# include <sys/wait.h>
|
||||
# endif
|
||||
@ -44,8 +42,6 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* !USE_SYSTEM */
|
||||
|
||||
#ifdef HAVE_STROPTS_H
|
||||
#ifdef sinix
|
||||
#define buf_T __system_buf_t__
|
||||
|
@ -94,7 +94,7 @@ static char *(features[]) =
|
||||
"+folding",
|
||||
"-footer",
|
||||
/* only interesting on Unix systems */
|
||||
#if !defined(USE_SYSTEM) && defined(UNIX)
|
||||
#if defined(UNIX)
|
||||
"+fork()",
|
||||
#endif
|
||||
"+gettext",
|
||||
@ -175,10 +175,6 @@ static char *(features[]) =
|
||||
"+statusline",
|
||||
"-sun_workshop",
|
||||
"+syntax",
|
||||
/* only interesting on Unix systems */
|
||||
#if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
|
||||
"+system()",
|
||||
#endif
|
||||
"+tag_binary",
|
||||
"+tag_old_static",
|
||||
#ifdef FEAT_TAG_ANYWHITE
|
||||
|
Loading…
Reference in New Issue
Block a user