From 3925d951a15b44f4fbcef89db6b628b79de6bac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Endsj=C3=B8?= Date: Wed, 5 Mar 2014 14:36:10 +0100 Subject: [PATCH] Remove USE_SYSTEM and code only run under USE_SYSTEM --- src/eval.c | 4 +-- src/garray.c | 2 +- src/option.c | 4 --- src/os_unix.c | 72 +++----------------------------------------------- src/os_unixx.h | 4 --- src/version.c | 6 +---- 6 files changed, 8 insertions(+), 84 deletions(-) diff --git a/src/eval.c b/src/eval.c index 4eee644536..59d5d1b185 100644 --- a/src/eval.c +++ b/src/eval.c @@ -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", diff --git a/src/garray.c b/src/garray.c index ebd6748e78..b941233ed1 100644 --- a/src/garray.c +++ b/src/garray.c @@ -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". */ diff --git a/src/option.c b/src/option.c index 375a8f6f4e..127e417e47 100644 --- a/src/option.c +++ b/src/option.c @@ -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, diff --git a/src/os_unix.c b/src/os_unix.c index 4ba7b79611..045c731cd6 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -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) diff --git a/src/os_unixx.h b/src/os_unixx.h index 2a28a6d5f1..e07d2bae67 100644 --- a/src/os_unixx.h +++ b/src/os_unixx.h @@ -22,8 +22,6 @@ # include #endif -#ifndef USE_SYSTEM /* use fork/exec to start the shell */ - # if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT) # include # endif @@ -44,8 +42,6 @@ # endif # endif -#endif /* !USE_SYSTEM */ - #ifdef HAVE_STROPTS_H #ifdef sinix #define buf_T __system_buf_t__ diff --git a/src/version.c b/src/version.c index 2de1105123..085ce49823 100644 --- a/src/version.c +++ b/src/version.c @@ -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