diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-29 21:34:14 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-31 08:07:47 -0300 |
commit | 0d61b1c470466118c601a107d7a17b9edd107c53 (patch) | |
tree | 297f39c2206f7cb9c87b07821db08e3f8aea1aad /src/ex_cmds.c | |
parent | 607e1c7ee42cb9bfd66cb84d4fb54060f3b4135b (diff) | |
download | rneovim-0d61b1c470466118c601a107d7a17b9edd107c53.tar.gz rneovim-0d61b1c470466118c601a107d7a17b9edd107c53.tar.bz2 rneovim-0d61b1c470466118c601a107d7a17b9edd107c53.zip |
Refactor SHELL_* defines into enum typedef
The SHELL_* defines are the bitflags that can be passed to `mch_call_shell`.
The enum is defined in 'os/shell.h', where all shell-related functions will
eventually be defined.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 335425b919..85b91741aa 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -57,6 +57,7 @@ #include "undo.h" #include "window.h" #include "os/os.h" +#include "os/shell.h" static int linelen(int *has_tab); static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, @@ -1023,21 +1024,21 @@ do_filter ( */ if (do_out) - shell_flags |= SHELL_DOOUT; + shell_flags |= kShellOptDoOut; if (!do_in && do_out && !p_stmp) { // Use a pipe to fetch stdout of the command, do not use a temp file. - shell_flags |= SHELL_READ; + shell_flags |= kShellOptRead; curwin->w_cursor.lnum = line2; } else if (do_in && !do_out && !p_stmp) { // Use a pipe to write stdin of the command, do not use a temp file. - shell_flags |= SHELL_WRITE; + shell_flags |= kShellOptWrite; curbuf->b_op_start.lnum = line1; curbuf->b_op_end.lnum = line2; } else if (do_in && do_out && !p_stmp) { // Use a pipe to write stdin and fetch stdout of the command, do not // use a temp file. - shell_flags |= SHELL_READ|SHELL_WRITE; + shell_flags |= kShellOptRead | kShellOptWrite; curbuf->b_op_start.lnum = line1; curbuf->b_op_end.lnum = line2; curwin->w_cursor.lnum = line2; @@ -1100,9 +1101,13 @@ do_filter ( * 'u' to fix the text * Switch to cooked mode when not redirecting stdin, avoids that something * like ":r !cat" hangs. - * Pass on the SHELL_DOOUT flag when the output is being redirected. + * Pass on the kShellDoOut flag when the output is being redirected. */ - if (call_shell(cmd_buf, SHELL_FILTER | SHELL_COOKED | shell_flags, NULL)) { + if (call_shell( + cmd_buf, + kShellOptFilter | kShellOptCooked | shell_flags, + NULL + )) { redraw_later_clear(); wait_return(FALSE); } @@ -1133,7 +1138,7 @@ do_filter ( read_linecount = curbuf->b_ml.ml_line_count - read_linecount; - if (shell_flags & SHELL_READ) { + if (shell_flags & kShellOptRead) { curbuf->b_op_start.lnum = line2 + 1; curbuf->b_op_end.lnum = curwin->w_cursor.lnum; appended_lines_mark(line2, read_linecount); @@ -1256,7 +1261,7 @@ do_shell ( if (!swapping_screen()) windgoto(msg_row, msg_col); cursor_on(); - (void)call_shell(cmd, SHELL_COOKED | flags, NULL); + (void)call_shell(cmd, kShellOptCooked | flags, NULL); did_check_timestamps = FALSE; need_check_timestamps = TRUE; |