diff options
| author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-02-01 11:17:43 -0300 |
|---|---|---|
| committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-02-01 11:17:43 -0300 |
| commit | 3da78364cc96b97948608ff685ef8b9cac71e96e (patch) | |
| tree | 1cf11cd043a0f6c683403bf45106e78a35339e0a /src | |
| parent | 2d00ead2e57653b771354a564f9a760c2ce0d18e (diff) | |
| download | rneovim-3da78364cc96b97948608ff685ef8b9cac71e96e.tar.gz rneovim-3da78364cc96b97948608ff685ef8b9cac71e96e.tar.bz2 rneovim-3da78364cc96b97948608ff685ef8b9cac71e96e.zip | |
Remove more #ifdef dead code
Diffstat (limited to 'src')
| -rw-r--r-- | src/globals.h | 31 | ||||
| -rw-r--r-- | src/main.c | 1241 | ||||
| -rw-r--r-- | src/os_unix.c | 83 | ||||
| -rw-r--r-- | src/vim.h | 151 |
4 files changed, 595 insertions, 911 deletions
diff --git a/src/globals.h b/src/globals.h index bb60aa98c1..e6db0d866b 100644 --- a/src/globals.h +++ b/src/globals.h @@ -734,15 +734,12 @@ EXTERN int msg_silent INIT(= 0); /* don't print messages */ EXTERN int emsg_silent INIT(= 0); /* don't print error messages */ EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */ -#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \ - || defined(FEAT_AUTOCMD) -# define HAS_SWAP_EXISTS_ACTION +#define HAS_SWAP_EXISTS_ACTION EXTERN int swap_exists_action INIT(= SEA_NONE); /* For dialog when swap file already * exists. */ EXTERN int swap_exists_did_quit INIT(= FALSE); /* Selected "quit" at the dialog. */ -#endif EXTERN char_u *IObuff; /* sprintf's are done in this buffer, size is IOSIZE */ @@ -906,12 +903,9 @@ EXTERN int lcs_tab2 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); EXTERN int lcs_conceal INIT(= '-'); -#if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \ - || defined(FEAT_FOLDING) /* Characters from 'fillchars' option */ EXTERN int fill_stl INIT(= ' '); EXTERN int fill_stlnc INIT(= ' '); -#endif EXTERN int fill_vert INIT(= ' '); EXTERN int fill_fold INIT(= '-'); EXTERN int fill_diff INIT(= '-'); @@ -1002,13 +996,8 @@ EXTERN option_table_T printer_opts[OPT_PRINT_NUM_OPTIONS] # define PRT_UNIT_POINT 3 # define PRT_UNIT_NAMES {"pc", "in", "mm", "pt"} -#if (defined(FEAT_PRINTER) && defined(FEAT_STL_OPT)) \ - || defined(FEAT_GUI_TABLINE) /* Page number used for %N in 'pageheader' and 'guitablabel'. */ EXTERN linenr_T printer_page_num; -#endif - - EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client @@ -1073,10 +1062,6 @@ EXTERN char_u e_while[] INIT(= N_("E588: :endwhile without :while")); EXTERN char_u e_for[] INIT(= N_("E588: :endfor without :for")); EXTERN char_u e_exists[] INIT(= N_("E13: File exists (add ! to override)")); EXTERN char_u e_failed[] INIT(= N_("E472: Command failed")); -#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(MACOS) \ - || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) -EXTERN char_u e_font[] INIT(= N_("E235: Unknown font: %s")); -#endif EXTERN char_u e_internal[] INIT(= N_("E473: Internal error")); EXTERN char_u e_interr[] INIT(= N_("Interrupted")); EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address")); @@ -1089,17 +1074,6 @@ EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory")); #ifdef FEAT_LIBCALL EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"")); #endif -#if defined(DYNAMIC_PERL) \ - || defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) \ - || defined(DYNAMIC_RUBY) \ - || defined(DYNAMIC_TCL) \ - || defined(DYNAMIC_ICONV) \ - || defined(DYNAMIC_GETTEXT) \ - || defined(DYNAMIC_MZSCHEME) \ - || defined(DYNAMIC_LUA) -EXTERN char_u e_loadlib[] INIT(= N_("E370: Could not load library %s")); -EXTERN char_u e_loadfunc[] INIT(= N_("E448: Could not load library function %s")); -#endif EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number")); EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set")); EXTERN char_u e_modifiable[] INIT(= N_( @@ -1186,10 +1160,7 @@ EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer")); EXTERN char_u e_invalpat[] INIT(= N_( "E682: Invalid search pattern or delimiter")); EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer")); -#if defined(FEAT_SYN_HL) || \ - (defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC)) EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set")); -#endif EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); diff --git a/src/main.c b/src/main.c index 53f02a8b75..0c06781be8 100644 --- a/src/main.c +++ b/src/main.c @@ -10,11 +10,6 @@ #define EXTERN #include "vim.h" -#ifdef SPAWNO -# include <spawno.h> /* special MS-DOS swapping library */ -#endif - - /* Maximum number of commands from + or -c arguments. */ #define MAX_ARG_CMDS 10 @@ -75,7 +70,6 @@ static int get_number_arg __ARGS((char_u *p, int *idx, int def)); static void init_locale __ARGS((void)); # endif static void parse_command_name __ARGS((mparm_T *parmp)); -static void early_arg_scan __ARGS((mparm_T *parmp)); static void command_line_scan __ARGS((mparm_T *parmp)); static void check_tty __ARGS((mparm_T *parmp)); static void read_stdin __ARGS((void)); @@ -111,13 +105,10 @@ static char *(main_errors[]) = }; #ifndef NO_VIM_MAIN /* skip this for unittests */ -int -# ifdef VIMDLL -_export -# endif + int main(argc, argv) -int argc; -char **argv; + int argc; + char **argv; { char_u *fname = NULL; /* file name from command line */ mparm_T params; /* various parameters passed between @@ -167,17 +158,9 @@ char **argv; qnx_init(); /* PhAttach() for clipboard, (and gui) */ #endif -#ifdef MAC_OS_CLASSIC - /* Prepare for possibly starting GUI sometime */ - /* Macintosh needs this before any memory is allocated. */ - gui_prepare(¶ms.argc, params.argv); - TIME_MSG("GUI prepared"); -#endif - /* Init the table of Normal mode commands. */ init_normal_cmds(); - /* * Allocate space for the generic buffers (needed for set_init_1() and * EMSG2()). @@ -200,17 +183,6 @@ char **argv; /* - * Do a first scan of the arguments in "argv[]": - * -display or --display - * --server... - * --socketid - * --windowid - */ - early_arg_scan(¶ms); - - - - /* * Check if we have an interactive window. * On the Amiga: If there is no window, we open one with a newcli command * (needed for :! to * work). mch_check_win() will also handle the -d or @@ -358,282 +330,273 @@ char **argv; #endif /* NO_VIM_MAIN */ -/* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when - * NO_VIM_MAIN is defined. */ + /* vim_main2() needs to be produced when FEAT_MZSCHEME is defined even when + * NO_VIM_MAIN is defined. */ #ifndef NO_VIM_MAIN -/* Execute --cmd arguments. */ -exe_pre_commands(¶ms); - -/* Source startup scripts. */ -source_startup_scripts(¶ms); - -/* - * Read all the plugin files. - * Only when compiled with +eval, since most plugins need it. - */ -if (p_lpl) { - source_runtime((char_u *)"plugin/**/*.vim", TRUE); - TIME_MSG("loading plugins"); -} - -/* Decide about window layout for diff mode after reading vimrc. */ -if (params.diff_mode && params.window_layout == 0) { - if (diffopt_horizontal()) - params.window_layout = WIN_HOR; /* use horizontal split */ - else - params.window_layout = WIN_VER; /* use vertical split */ -} + /* Execute --cmd arguments. */ + exe_pre_commands(¶ms); -/* - * Recovery mode without a file name: List swap files. - * This uses the 'dir' option, therefore it must be after the - * initializations. - */ -if (recoverymode && fname == NULL) { - recover_names(NULL, TRUE, 0, NULL); - mch_exit(0); -} - -/* - * Set a few option defaults after reading .vimrc files: - * 'title' and 'icon', Unix: 'shellpipe' and 'shellredir'. - */ -set_init_3(); -TIME_MSG("inits 3"); + /* Source startup scripts. */ + source_startup_scripts(¶ms); -/* - * "-n" argument: Disable swap file by setting 'updatecount' to 0. - * Note that this overrides anything from a vimrc file. - */ -if (params.no_swap_file) - p_uc = 0; + /* + * Read all the plugin files. + * Only when compiled with +eval, since most plugins need it. + */ + if (p_lpl) { + source_runtime((char_u *)"plugin/**/*.vim", TRUE); + TIME_MSG("loading plugins"); + } -if (curwin->w_p_rl && p_altkeymap) { - p_hkmap = FALSE; /* Reset the Hebrew keymap mode */ - curwin->w_p_arab = FALSE; /* Reset the Arabic keymap mode */ - p_fkmap = TRUE; /* Set the Farsi keymap mode */ -} + /* Decide about window layout for diff mode after reading vimrc. */ + if (params.diff_mode && params.window_layout == 0) { + if (diffopt_horizontal()) + params.window_layout = WIN_HOR; /* use horizontal split */ + else + params.window_layout = WIN_VER; /* use vertical split */ + } + /* + * Recovery mode without a file name: List swap files. + * This uses the 'dir' option, therefore it must be after the + * initializations. + */ + if (recoverymode && fname == NULL) { + recover_names(NULL, TRUE, 0, NULL); + mch_exit(0); + } -#ifdef SPAWNO /* special MSDOS swapping library */ -init_SPAWNO("", SWAP_ANY); -#endif + /* + * Set a few option defaults after reading .vimrc files: + * 'title' and 'icon', Unix: 'shellpipe' and 'shellredir'. + */ + set_init_3(); + TIME_MSG("inits 3"); -/* - * Read in registers, history etc, but not marks, from the viminfo file. - * This is where v:oldfiles gets filled. - */ -if (*p_viminfo != NUL) { - read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); - TIME_MSG("reading viminfo"); -} -/* It's better to make v:oldfiles an empty list than NULL. */ -if (get_vim_var_list(VV_OLDFILES) == NULL) - set_vim_var_list(VV_OLDFILES, list_alloc()); + /* + * "-n" argument: Disable swap file by setting 'updatecount' to 0. + * Note that this overrides anything from a vimrc file. + */ + if (params.no_swap_file) + p_uc = 0; -/* - * "-q errorfile": Load the error file now. - * If the error file can't be read, exit before doing anything else. - */ -if (params.edit_type == EDIT_QF) { - if (params.use_ef != NULL) - set_string_option_direct((char_u *)"ef", -1, - params.use_ef, OPT_FREE, SID_CARG); - vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); - if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff) < 0) { - out_char('\n'); - mch_exit(3); + if (curwin->w_p_rl && p_altkeymap) { + p_hkmap = FALSE; /* Reset the Hebrew keymap mode */ + curwin->w_p_arab = FALSE; /* Reset the Arabic keymap mode */ + p_fkmap = TRUE; /* Set the Farsi keymap mode */ } - TIME_MSG("reading errorfile"); -} - -/* - * Start putting things on the screen. - * Scroll screen down before drawing over it - * Clear screen now, so file message will not be cleared. - */ -starting = NO_BUFFERS; -no_wait_return = FALSE; -if (!exmode_active) - msg_scroll = FALSE; - + /* + * Read in registers, history etc, but not marks, from the viminfo file. + * This is where v:oldfiles gets filled. + */ + if (*p_viminfo != NUL) { + read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); + TIME_MSG("reading viminfo"); + } + /* It's better to make v:oldfiles an empty list than NULL. */ + if (get_vim_var_list(VV_OLDFILES) == NULL) + set_vim_var_list(VV_OLDFILES, list_alloc()); + /* + * "-q errorfile": Load the error file now. + * If the error file can't be read, exit before doing anything else. + */ + if (params.edit_type == EDIT_QF) { + if (params.use_ef != NULL) + set_string_option_direct((char_u *)"ef", -1, + params.use_ef, OPT_FREE, SID_CARG); + vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); + if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff) < 0) { + out_char('\n'); + mch_exit(3); + } + TIME_MSG("reading errorfile"); + } + /* + * Start putting things on the screen. + * Scroll screen down before drawing over it + * Clear screen now, so file message will not be cleared. + */ + starting = NO_BUFFERS; + no_wait_return = FALSE; + if (!exmode_active) + msg_scroll = FALSE; -/* - * If "-" argument given: Read file from stdin. - * Do this before starting Raw mode, because it may change things that the - * writing end of the pipe doesn't like, e.g., in case stdin and stderr - * are the same terminal: "cat | vim -". - * Using autocommands here may cause trouble... - */ -if (params.edit_type == EDIT_STDIN && !recoverymode) - read_stdin(); + /* + * If "-" argument given: Read file from stdin. + * Do this before starting Raw mode, because it may change things that the + * writing end of the pipe doesn't like, e.g., in case stdin and stderr + * are the same terminal: "cat | vim -". + * Using autocommands here may cause trouble... + */ + if (params.edit_type == EDIT_STDIN && !recoverymode) + read_stdin(); #if defined(UNIX) || defined(VMS) -/* When switching screens and something caused a message from a vimrc - * script, need to output an extra newline on exit. */ -if ((did_emsg || msg_didout) && *T_TI != NUL) - newline_on_exit = TRUE; + /* When switching screens and something caused a message from a vimrc + * script, need to output an extra newline on exit. */ + if ((did_emsg || msg_didout) && *T_TI != NUL) + newline_on_exit = TRUE; #endif -/* - * When done something that is not allowed or error message call - * wait_return. This must be done before starttermcap(), because it may - * switch to another screen. It must be done after settmode(TMODE_RAW), - * because we want to react on a single key stroke. - * Call settmode and starttermcap here, so the T_KS and T_TI may be - * defined by termcapinit and redefined in .exrc. - */ -settmode(TMODE_RAW); -TIME_MSG("setting raw mode"); + /* + * When done something that is not allowed or error message call + * wait_return. This must be done before starttermcap(), because it may + * switch to another screen. It must be done after settmode(TMODE_RAW), + * because we want to react on a single key stroke. + * Call settmode and starttermcap here, so the T_KS and T_TI may be + * defined by termcapinit and redefined in .exrc. + */ + settmode(TMODE_RAW); + TIME_MSG("setting raw mode"); -if (need_wait_return || msg_didany) { - wait_return(TRUE); - TIME_MSG("waiting for return"); -} + if (need_wait_return || msg_didany) { + wait_return(TRUE); + TIME_MSG("waiting for return"); + } -starttermcap(); /* start termcap if not done by wait_return() */ -TIME_MSG("start termcap"); -may_req_ambiguous_char_width(); + starttermcap(); /* start termcap if not done by wait_return() */ + TIME_MSG("start termcap"); + may_req_ambiguous_char_width(); -setmouse(); /* may start using the mouse */ -if (scroll_region) - scroll_region_reset(); /* In case Rows changed */ -scroll_start(); /* may scroll the screen to the right position */ + setmouse(); /* may start using the mouse */ + if (scroll_region) + scroll_region_reset(); /* In case Rows changed */ + scroll_start(); /* may scroll the screen to the right position */ -/* - * Don't clear the screen when starting in Ex mode, unless using the GUI. - */ -if (exmode_active - ) - must_redraw = CLEAR; -else { - screenclear(); /* clear screen */ - TIME_MSG("clearing screen"); -} + /* + * Don't clear the screen when starting in Ex mode, unless using the GUI. + */ + if (exmode_active + ) + must_redraw = CLEAR; + else { + screenclear(); /* clear screen */ + TIME_MSG("clearing screen"); + } -if (params.ask_for_key) { - (void)blowfish_self_test(); - (void)get_crypt_key(TRUE, TRUE); - TIME_MSG("getting crypt key"); -} + if (params.ask_for_key) { + (void)blowfish_self_test(); + (void)get_crypt_key(TRUE, TRUE); + TIME_MSG("getting crypt key"); + } -no_wait_return = TRUE; + no_wait_return = TRUE; -/* - * Create the requested number of windows and edit buffers in them. - * Also does recovery if "recoverymode" set. - */ -create_windows(¶ms); -TIME_MSG("opening buffers"); + /* + * Create the requested number of windows and edit buffers in them. + * Also does recovery if "recoverymode" set. + */ + create_windows(¶ms); + TIME_MSG("opening buffers"); -/* clear v:swapcommand */ -set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); + /* clear v:swapcommand */ + set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); -/* Ex starts at last line of the file */ -if (exmode_active) - curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; + /* Ex starts at last line of the file */ + if (exmode_active) + curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; -apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); -TIME_MSG("BufEnter autocommands"); -setpcmark(); + apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); + TIME_MSG("BufEnter autocommands"); + setpcmark(); -/* - * When started with "-q errorfile" jump to first error now. - */ -if (params.edit_type == EDIT_QF) { - qf_jump(NULL, 0, 0, FALSE); - TIME_MSG("jump to first error"); -} + /* + * When started with "-q errorfile" jump to first error now. + */ + if (params.edit_type == EDIT_QF) { + qf_jump(NULL, 0, 0, FALSE); + TIME_MSG("jump to first error"); + } -/* - * If opened more than one window, start editing files in the other - * windows. - */ -edit_buffers(¶ms); + /* + * If opened more than one window, start editing files in the other + * windows. + */ + edit_buffers(¶ms); -if (params.diff_mode) { - win_T *wp; + if (params.diff_mode) { + win_T *wp; - /* set options in each window for "vimdiff". */ - for (wp = firstwin; wp != NULL; wp = wp->w_next) - diff_win_options(wp, TRUE); -} + /* set options in each window for "vimdiff". */ + for (wp = firstwin; wp != NULL; wp = wp->w_next) + diff_win_options(wp, TRUE); + } -/* - * Shorten any of the filenames, but only when absolute. - */ -shorten_fnames(FALSE); + /* + * Shorten any of the filenames, but only when absolute. + */ + shorten_fnames(FALSE); -/* - * Need to jump to the tag before executing the '-c command'. - * Makes "vim -c '/return' -t main" work. - */ -if (params.tagname != NULL) { + /* + * Need to jump to the tag before executing the '-c command'. + * Makes "vim -c '/return' -t main" work. + */ + if (params.tagname != NULL) { #if defined(HAS_SWAP_EXISTS_ACTION) - swap_exists_did_quit = FALSE; + swap_exists_did_quit = FALSE; #endif - vim_snprintf((char *)IObuff, IOSIZE, "ta %s", params.tagname); - do_cmdline_cmd(IObuff); - TIME_MSG("jumping to tag"); + vim_snprintf((char *)IObuff, IOSIZE, "ta %s", params.tagname); + do_cmdline_cmd(IObuff); + TIME_MSG("jumping to tag"); #if defined(HAS_SWAP_EXISTS_ACTION) - /* If the user doesn't want to edit the file then we quit here. */ - if (swap_exists_did_quit) - getout(1); + /* If the user doesn't want to edit the file then we quit here. */ + if (swap_exists_did_quit) + getout(1); #endif -} + } -/* Execute any "+", "-c" and "-S" arguments. */ -if (params.n_commands > 0) - exe_commands(¶ms); + /* Execute any "+", "-c" and "-S" arguments. */ + if (params.n_commands > 0) + exe_commands(¶ms); -RedrawingDisabled = 0; -redraw_all_later(NOT_VALID); -no_wait_return = FALSE; -starting = 0; + RedrawingDisabled = 0; + redraw_all_later(NOT_VALID); + no_wait_return = FALSE; + starting = 0; -/* Requesting the termresponse is postponed until here, so that a "-c q" - * argument doesn't make it appear in the shell Vim was started from. */ -may_req_termresponse(); + /* Requesting the termresponse is postponed until here, so that a "-c q" + * argument doesn't make it appear in the shell Vim was started from. */ + may_req_termresponse(); -/* start in insert mode */ -if (p_im) - need_start_insertmode = TRUE; + /* start in insert mode */ + if (p_im) + need_start_insertmode = TRUE; -apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); -TIME_MSG("VimEnter autocommands"); + apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); + TIME_MSG("VimEnter autocommands"); -/* When a startup script or session file setup for diff'ing and - * scrollbind, sync the scrollbind now. */ -if (curwin->w_p_diff && curwin->w_p_scb) { - update_topline(); - check_scrollbind((linenr_T)0, 0L); - TIME_MSG("diff scrollbinding"); -} + /* When a startup script or session file setup for diff'ing and + * scrollbind, sync the scrollbind now. */ + if (curwin->w_p_diff && curwin->w_p_scb) { + update_topline(); + check_scrollbind((linenr_T)0, 0L); + TIME_MSG("diff scrollbinding"); + } -/* If ":startinsert" command used, stuff a dummy command to be able to - * call normal_cmd(), which will then start Insert mode. */ -if (restart_edit != 0) - stuffcharReadbuff(K_NOP); + /* If ":startinsert" command used, stuff a dummy command to be able to + * call normal_cmd(), which will then start Insert mode. */ + if (restart_edit != 0) + stuffcharReadbuff(K_NOP); -TIME_MSG("before starting main loop"); + TIME_MSG("before starting main loop"); -/* - * Call the main command loop. This never returns. - */ -main_loop(FALSE, FALSE); + /* + * Call the main command loop. This never returns. + */ + main_loop(FALSE, FALSE); -return 0; + return 0; } #endif /* NO_VIM_MAIN */ @@ -645,8 +608,8 @@ return 0; * commands, return when entering Ex mode. "noexmode" is TRUE then. */ void main_loop(cmdwin, noexmode) -int cmdwin; /* TRUE when working in the command-line window */ -int noexmode; /* TRUE when return on entering Ex mode */ + int cmdwin; /* TRUE when working in the command-line window */ + int noexmode; /* TRUE when return on entering Ex mode */ { oparg_T oa; /* operator arguments */ int previous_got_int = FALSE; /* "got_int" was TRUE */ @@ -657,8 +620,8 @@ int noexmode; /* TRUE when return on entering Ex mode */ clear_oparg(&oa); while (!cmdwin - || cmdwin_result == 0 - ) { + || cmdwin_result == 0 + ) { if (stuff_empty()) { did_check_timestamps = FALSE; if (need_check_timestamps) @@ -667,7 +630,7 @@ int noexmode; /* TRUE when return on entering Ex mode */ wait_return(FALSE); /* ... call it now */ if (need_start_insertmode && goto_im() && !VIsual_active - ) { + ) { need_start_insertmode = FALSE; stuffReadbuff((char_u *)"i"); /* start insert mode next */ /* skip the fileinfo message now, because it would be shown @@ -796,8 +759,8 @@ int noexmode; /* TRUE when return on entering Ex mode */ if (conceal_update_lines && (conceal_old_cursor_line != conceal_new_cursor_line - || conceal_cursor_line(curwin) - || need_cursor_line_redraw)) { + || conceal_cursor_line(curwin) + || need_cursor_line_redraw)) { if (conceal_old_cursor_line != conceal_new_cursor_line && conceal_old_cursor_line <= curbuf->b_ml.ml_line_count) @@ -854,7 +817,7 @@ int noexmode; /* TRUE when return on entering Ex mode */ /* Exit properly */ void getout(exitval) -int exitval; + int exitval; { buf_T *buf; win_T *wp; @@ -880,7 +843,7 @@ int exitval; for (tp = first_tabpage; tp != NULL; tp = next_tp) { next_tp = tp->tp_next; for (wp = (tp == curtab) - ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next) { + ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next) { if (wp->w_buffer == NULL) /* Autocmd must have close the buffer already, skip. */ continue; @@ -917,7 +880,7 @@ int exitval; profile_dump(); if (did_emsg - ) { + ) { /* give the user a chance to read the (error) message */ no_wait_return = FALSE; wait_return(FALSE); @@ -941,9 +904,9 @@ int exitval; * Get a (optional) count for a Vim argument. */ static int get_number_arg(p, idx, def) -char_u *p; /* pointer to argument */ -int *idx; /* index in argument, is incremented */ -int def; /* default value */ + char_u *p; /* pointer to argument */ + int *idx; /* index in argument, is incremented */ + int def; /* default value */ { if (vim_isdigit(p[*idx])) { def = atoi((char *)&(p[*idx])); @@ -996,7 +959,7 @@ static void init_locale() { * by "im" use improved Ex mode. */ static void parse_command_name(parmp) -mparm_T *parmp; + mparm_T *parmp; { char_u *initstr; @@ -1013,7 +976,7 @@ mparm_T *parmp; /* Use evim mode for "evim" and "egvim", not for "editor". */ if (TOLOWER_ASC(initstr[0]) == 'e' && (TOLOWER_ASC(initstr[1]) == 'v' - || TOLOWER_ASC(initstr[1]) == 'g')) { + || TOLOWER_ASC(initstr[1]) == 'g')) { parmp->evim_mode = TRUE; ++initstr; } @@ -1046,38 +1009,10 @@ mparm_T *parmp; } /* - * Get the name of the display, before gui_prepare() removes it from - * argv[]. Used for the xterm-clipboard display. - * - * Also find the --server... arguments and --socketid and --windowid - */ -static void early_arg_scan(parmp) -mparm_T *parmp UNUSED; -{ -#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \ - || !defined(FEAT_NETBEANS_INTG) - int argc = parmp->argc; - char **argv = parmp->argv; - int i; - - for (i = 1; i < argc; i++) { - if (STRCMP(argv[i], "--") == 0) - break; - - else if (strncmp(argv[i], "-nb", (size_t)3) == 0) { - mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n")); - mch_exit(2); - } - - } -#endif -} - -/* * Scan the command line arguments. */ static void command_line_scan(parmp) -mparm_T *parmp; + mparm_T *parmp; { int argc = parmp->argc; char **argv = parmp->argv; @@ -1111,262 +1046,262 @@ mparm_T *parmp; want_argument = FALSE; c = argv[0][argv_idx++]; switch (c) { - case NUL: /* "vim -" read from stdin */ - /* "ex -" silent mode */ - if (exmode_active) - silent_mode = TRUE; - else { - if (parmp->edit_type != EDIT_NONE) - mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]); - parmp->edit_type = EDIT_STDIN; - read_cmd_fd = 2; /* read from stderr instead of stdin */ - } - argv_idx = -1; /* skip to next argument */ - break; + case NUL: /* "vim -" read from stdin */ + /* "ex -" silent mode */ + if (exmode_active) + silent_mode = TRUE; + else { + if (parmp->edit_type != EDIT_NONE) + mainerr(ME_TOO_MANY_ARGS, (char_u *)argv[0]); + parmp->edit_type = EDIT_STDIN; + read_cmd_fd = 2; /* read from stderr instead of stdin */ + } + argv_idx = -1; /* skip to next argument */ + break; - case '-': /* "--" don't take any more option arguments */ - /* "--help" give help message */ - /* "--version" give version message */ - /* "--literal" take files literally */ - /* "--nofork" don't fork */ - /* "--noplugin[s]" skip plugins */ - /* "--cmd <cmd>" execute cmd before vimrc */ - if (STRICMP(argv[0] + argv_idx, "help") == 0) - usage(); - else if (STRICMP(argv[0] + argv_idx, "version") == 0) { - Columns = 80; /* need to init Columns */ - info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ - list_version(); - msg_putchar('\n'); - msg_didout = FALSE; - mch_exit(0); - } else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) { + case '-': /* "--" don't take any more option arguments */ + /* "--help" give help message */ + /* "--version" give version message */ + /* "--literal" take files literally */ + /* "--nofork" don't fork */ + /* "--noplugin[s]" skip plugins */ + /* "--cmd <cmd>" execute cmd before vimrc */ + if (STRICMP(argv[0] + argv_idx, "help") == 0) + usage(); + else if (STRICMP(argv[0] + argv_idx, "version") == 0) { + Columns = 80; /* need to init Columns */ + info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ + list_version(); + msg_putchar('\n'); + msg_didout = FALSE; + mch_exit(0); + } else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) { #if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) - parmp->literal = TRUE; + parmp->literal = TRUE; #endif - } else if (STRNICMP(argv[0] + argv_idx, "nofork", 6) == 0) { - } else if (STRNICMP(argv[0] + argv_idx, "noplugin", 8) == 0) - p_lpl = FALSE; - else if (STRNICMP(argv[0] + argv_idx, "cmd", 3) == 0) { - want_argument = TRUE; - argv_idx += 3; - } else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0) { - want_argument = TRUE; - argv_idx += 11; - } else { - if (argv[0][argv_idx]) - mainerr(ME_UNKNOWN_OPTION, (char_u *)argv[0]); - had_minmin = TRUE; - } - if (!want_argument) - argv_idx = -1; /* skip to next argument */ - break; + } else if (STRNICMP(argv[0] + argv_idx, "nofork", 6) == 0) { + } else if (STRNICMP(argv[0] + argv_idx, "noplugin", 8) == 0) + p_lpl = FALSE; + else if (STRNICMP(argv[0] + argv_idx, "cmd", 3) == 0) { + want_argument = TRUE; + argv_idx += 3; + } else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0) { + want_argument = TRUE; + argv_idx += 11; + } else { + if (argv[0][argv_idx]) + mainerr(ME_UNKNOWN_OPTION, (char_u *)argv[0]); + had_minmin = TRUE; + } + if (!want_argument) + argv_idx = -1; /* skip to next argument */ + break; - case 'A': /* "-A" start in Arabic mode */ - set_option_value((char_u *)"arabic", 1L, NULL, 0); - break; + case 'A': /* "-A" start in Arabic mode */ + set_option_value((char_u *)"arabic", 1L, NULL, 0); + break; - case 'b': /* "-b" binary mode */ - /* Needs to be effective before expanding file names, because - * for Win32 this makes us edit a shortcut file itself, - * instead of the file it links to. */ - set_options_bin(curbuf->b_p_bin, 1, 0); - curbuf->b_p_bin = 1; /* binary file I/O */ - break; + case 'b': /* "-b" binary mode */ + /* Needs to be effective before expanding file names, because + * for Win32 this makes us edit a shortcut file itself, + * instead of the file it links to. */ + set_options_bin(curbuf->b_p_bin, 1, 0); + curbuf->b_p_bin = 1; /* binary file I/O */ + break; - case 'C': /* "-C" Compatible */ - change_compatible(TRUE); - break; + case 'C': /* "-C" Compatible */ + change_compatible(TRUE); + break; - case 'e': /* "-e" Ex mode */ - exmode_active = EXMODE_NORMAL; - break; + case 'e': /* "-e" Ex mode */ + exmode_active = EXMODE_NORMAL; + break; - case 'E': /* "-E" Improved Ex mode */ - exmode_active = EXMODE_VIM; - break; + case 'E': /* "-E" Improved Ex mode */ + exmode_active = EXMODE_VIM; + break; - case 'f': /* "-f" GUI: run in foreground. Amiga: open - window directly, not with newcli */ - break; + case 'f': /* "-f" GUI: run in foreground. Amiga: open + window directly, not with newcli */ + break; - case 'g': /* "-g" start GUI */ - main_start_gui(); - break; + case 'g': /* "-g" start GUI */ + main_start_gui(); + break; - case 'F': /* "-F" start in Farsi mode: rl + fkmap set */ - p_fkmap = TRUE; - set_option_value((char_u *)"rl", 1L, NULL, 0); - break; + case 'F': /* "-F" start in Farsi mode: rl + fkmap set */ + p_fkmap = TRUE; + set_option_value((char_u *)"rl", 1L, NULL, 0); + break; - case 'h': /* "-h" give help message */ - usage(); - break; + case 'h': /* "-h" give help message */ + usage(); + break; - case 'H': /* "-H" start in Hebrew mode: rl + hkmap set */ - p_hkmap = TRUE; - set_option_value((char_u *)"rl", 1L, NULL, 0); - break; + case 'H': /* "-H" start in Hebrew mode: rl + hkmap set */ + p_hkmap = TRUE; + set_option_value((char_u *)"rl", 1L, NULL, 0); + break; - case 'l': /* "-l" lisp mode, 'lisp' and 'showmatch' on */ - set_option_value((char_u *)"lisp", 1L, NULL, 0); - p_sm = TRUE; - break; + case 'l': /* "-l" lisp mode, 'lisp' and 'showmatch' on */ + set_option_value((char_u *)"lisp", 1L, NULL, 0); + p_sm = TRUE; + break; - case 'M': /* "-M" no changes or writing of files */ - reset_modifiable(); - /* FALLTHROUGH */ + case 'M': /* "-M" no changes or writing of files */ + reset_modifiable(); + /* FALLTHROUGH */ - case 'm': /* "- |