diff options
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 841 |
1 files changed, 322 insertions, 519 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 47f6b5b5d8..7dfd990a11 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -586,8 +586,7 @@ static void save_dbg_stuff(struct dbg_stuff *dsp); static void restore_dbg_stuff(struct dbg_stuff *dsp); static void -save_dbg_stuff(dsp) - struct dbg_stuff *dsp; +save_dbg_stuff(struct dbg_stuff *dsp) { dsp->trylevel = trylevel; trylevel = 0; dsp->force_abort = force_abort; force_abort = FALSE; @@ -605,8 +604,7 @@ save_dbg_stuff(dsp) } static void -restore_dbg_stuff(dsp) - struct dbg_stuff *dsp; +restore_dbg_stuff(struct dbg_stuff *dsp) { suppress_errthrow = FALSE; trylevel = dsp->trylevel; @@ -629,8 +627,8 @@ restore_dbg_stuff(dsp) * command is given. */ void -do_exmode(improved) - int improved; /* TRUE for "improved Ex" mode */ +do_exmode( + int improved) /* TRUE for "improved Ex" mode */ { int save_msg_scroll; int prev_msg_row; @@ -732,8 +730,7 @@ do_exmode(improved) * Execute a simple command line. Used for translated commands like "*". */ int -do_cmdline_cmd(cmd) - char_u *cmd; +do_cmdline_cmd(char_u *cmd) { return do_cmdline(cmd, NULL, NULL, DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED); @@ -759,11 +756,11 @@ do_cmdline_cmd(cmd) * return FAIL if cmdline could not be executed, OK otherwise */ int -do_cmdline(cmdline, fgetline, cookie, flags) - char_u *cmdline; - char_u *(*fgetline)(int, void *, int); - void *cookie; /* argument for fgetline() */ - int flags; +do_cmdline( + char_u *cmdline, + char_u *(*fgetline)(int, void *, int), + void *cookie, /* argument for fgetline() */ + int flags) { char_u *next_cmdline; /* next cmd to execute */ char_u *cmdline_copy = NULL; /* copy of cmd line */ @@ -1558,10 +1555,7 @@ do_cmdline(cmdline, fgetline, cookie, flags) * Obtain a line when inside a ":while" or ":for" loop. */ static char_u * -get_loop_line(c, cookie, indent) - int c; - void *cookie; - int indent; +get_loop_line(int c, void *cookie, int indent) { struct loop_cookie *cp = (struct loop_cookie *)cookie; wcmd_T *wp; @@ -1594,9 +1588,7 @@ get_loop_line(c, cookie, indent) * Store a line in "gap" so that a ":while" loop can execute it again. */ static int -store_loop_line(gap, line) - garray_T *gap; - char_u *line; +store_loop_line(garray_T *gap, char_u *line) { if (ga_grow(gap, 1) == FAIL) return FAIL; @@ -1610,8 +1602,7 @@ store_loop_line(gap, line) * Free the lines stored for a ":while" or ":for" loop. */ static void -free_cmdlines(gap) - garray_T *gap; +free_cmdlines(garray_T *gap) { while (gap->ga_len > 0) { @@ -1626,10 +1617,10 @@ free_cmdlines(gap) * "func". * Otherwise return TRUE when "fgetline" equals "func". */ int -getline_equal(fgetline, cookie, func) - char_u *(*fgetline)(int, void *, int); - void *cookie UNUSED; /* argument for fgetline() */ - char_u *(*func)(int, void *, int); +getline_equal( + char_u *(*fgetline)(int, void *, int), + void *cookie UNUSED, /* argument for fgetline() */ + char_u *(*func)(int, void *, int)) { #ifdef FEAT_EVAL char_u *(*gp)(int, void *, int); @@ -1657,9 +1648,9 @@ getline_equal(fgetline, cookie, func) * getline function. Otherwise return "cookie". */ void * -getline_cookie(fgetline, cookie) - char_u *(*fgetline)(int, void *, int) UNUSED; - void *cookie; /* argument for fgetline() */ +getline_cookie( + char_u *(*fgetline)(int, void *, int) UNUSED, + void *cookie) /* argument for fgetline() */ { # ifdef FEAT_EVAL char_u *(*gp)(int, void *, int); @@ -1689,10 +1680,7 @@ getline_cookie(fgetline, cookie) * Returns the buffer number. */ static int -compute_buffer_local_count(addr_type, lnum, offset) - int addr_type; - int lnum; - int offset; +compute_buffer_local_count(int addr_type, int lnum, int offset) { buf_T *buf; buf_T *nextbuf; @@ -1735,8 +1723,7 @@ static int current_win_nr(win_T *win); static int current_tab_nr(tabpage_T *tab); static int -current_win_nr(win) - win_T *win; +current_win_nr(win_T *win) { win_T *wp; int nr = 0; @@ -1751,8 +1738,7 @@ current_win_nr(win) } static int -current_tab_nr(tab) - tabpage_T *tab; +current_tab_nr(tabpage_T *tab) { tabpage_T *tp; int nr = 0; @@ -1802,18 +1788,14 @@ current_tab_nr(tab) #pragma optimize( "g", off ) #endif static char_u * -do_one_cmd(cmdlinep, sourcing, -#ifdef FEAT_EVAL - cstack, -#endif - fgetline, cookie) - char_u **cmdlinep; - int sourcing; +do_one_cmd( + char_u **cmdlinep, + int sourcing, #ifdef FEAT_EVAL - struct condstack *cstack; + struct condstack *cstack, #endif - char_u *(*fgetline)(int, void *, int); - void *cookie; /* argument for fgetline() */ + char_u *(*fgetline)(int, void *, int), + void *cookie) /* argument for fgetline() */ { char_u *p; linenr_T lnum; @@ -3064,10 +3046,10 @@ doend: * If there is a match advance "pp" to the argument and return TRUE. */ int -checkforcmd(pp, cmd, len) - char_u **pp; /* start of command */ - char *cmd; /* name of command */ - int len; /* required length */ +checkforcmd( + char_u **pp, /* start of command */ + char *cmd, /* name of command */ + int len) /* required length */ { int i; @@ -3088,8 +3070,7 @@ checkforcmd(pp, cmd, len) * invisible otherwise. */ static void -append_command(cmd) - char_u *cmd; +append_command(char_u *cmd) { char_u *s = cmd; char_u *d; @@ -3126,9 +3107,7 @@ append_command(cmd) * Returns NULL for an ambiguous user command. */ static char_u * -find_command(eap, full) - exarg_T *eap; - int *full UNUSED; +find_command(exarg_T *eap, int *full UNUSED) { int len; char_u *p; @@ -3235,12 +3214,12 @@ find_command(eap, full) * Return NULL if there is no matching command. */ static char_u * -find_ucmd(eap, p, full, xp, compl) - exarg_T *eap; - char_u *p; /* end of the command (possibly including count) */ - int *full; /* set to TRUE for a full match */ - expand_T *xp; /* used for completion, NULL otherwise */ - int *compl; /* completion flags or NULL */ +find_ucmd( + exarg_T *eap, + char_u *p, /* end of the command (possibly including count) */ + int *full, /* set to TRUE for a full match */ + expand_T *xp, /* used for completion, NULL otherwise */ + int *compl) /* completion flags or NULL */ { int len = (int)(p - eap->cmd); int j, k, matchlen = 0; @@ -3380,8 +3359,7 @@ static struct cmdmod * Return zero when it's not a modifier. */ int -modifier_len(cmd) - char_u *cmd; +modifier_len(char_u *cmd) { int i, j; char_u *p = cmd; @@ -3406,8 +3384,7 @@ modifier_len(cmd) * Return 3 if there is an ambiguous match. */ int -cmd_exists(name) - char_u *name; +cmd_exists(char_u *name) { exarg_T ea; int full = FALSE; @@ -3448,9 +3425,9 @@ cmd_exists(name) * probably won't change that much -- webb. */ char_u * -set_one_cmd_context(xp, buff) - expand_T *xp; - char_u *buff; /* buffer for command string */ +set_one_cmd_context( + expand_T *xp, + char_u *buff) /* buffer for command string */ { char_u *p; char_u *cmd, *arg; @@ -4308,9 +4285,9 @@ set_one_cmd_context(xp, buff) * Returns the "cmd" pointer advanced to beyond the range. */ char_u * -skip_range(cmd, ctx) - char_u *cmd; - int *ctx; /* pointer to xp_context or NULL */ +skip_range( + char_u *cmd, + int *ctx) /* pointer to xp_context or NULL */ { unsigned delim; @@ -4350,12 +4327,12 @@ skip_range(cmd, ctx) * Return MAXLNUM when no Ex address was found. */ static linenr_T -get_address(eap, ptr, addr_type, skip, to_other_file) - exarg_T *eap UNUSED; - char_u **ptr; - int addr_type; /* flag: one of ADDR_LINES, ... */ - int skip; /* only skip the address, don't use it */ - int to_other_file; /* flag: may jump to other file */ +get_address( + exarg_T *eap UNUSED, + char_u **ptr, + int addr_type, /* flag: one of ADDR_LINES, ... */ + int skip, /* only skip the address, don't use it */ + int to_other_file) /* flag: may jump to other file */ { int c; int i; @@ -4647,8 +4624,7 @@ error: * Get flags from an Ex command argument. */ static void -get_flags(eap) - exarg_T *eap; +get_flags(exarg_T *eap) { while (vim_strchr((char_u *)"lp#", *eap->arg) != NULL) { @@ -4666,8 +4642,7 @@ get_flags(eap) * Function called for command which is Not Implemented. NI! */ void -ex_ni(eap) - exarg_T *eap; +ex_ni(exarg_T *eap) { if (!eap->skip) eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version"); @@ -4679,8 +4654,7 @@ ex_ni(eap) * Skips over ":perl <<EOF" constructs. */ static void -ex_script_ni(eap) - exarg_T *eap; +ex_script_ni(exarg_T *eap) { if (!eap->skip) ex_ni(eap); @@ -4694,8 +4668,7 @@ ex_script_ni(eap) * Return NULL when valid, error message when invalid. */ static char_u * -invalid_range(eap) - exarg_T *eap; +invalid_range(exarg_T *eap) { buf_T *buf; if ( eap->line1 < 0 @@ -4769,8 +4742,7 @@ invalid_range(eap) * Correct the range for zero line number, if required. */ static void -correct_range(eap) - exarg_T *eap; +correct_range(exarg_T *eap) { if (!(eap->argt & ZEROR)) /* zero in range not allowed */ { @@ -4789,8 +4761,7 @@ static char_u *skip_grep_pat(exarg_T *eap); * pattern. Otherwise return eap->arg. */ static char_u * -skip_grep_pat(eap) - exarg_T *eap; +skip_grep_pat(exarg_T *eap) { char_u *p = eap->arg; @@ -4811,10 +4782,7 @@ skip_grep_pat(eap) * in the command line, so that things like % get expanded. */ static char_u * -replace_makeprg(eap, p, cmdlinep) - exarg_T *eap; - char_u *p; - char_u **cmdlinep; +replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) { char_u *new_cmdline; char_u *program; @@ -4896,10 +4864,10 @@ replace_makeprg(eap, p, cmdlinep) * Return FAIL for failure, OK otherwise. */ int -expand_filename(eap, cmdlinep, errormsgp) - exarg_T *eap; - char_u **cmdlinep; - char_u **errormsgp; +expand_filename( + exarg_T *eap, + char_u **cmdlinep, + char_u **errormsgp) { int has_wildcards; /* need to expand wildcards */ char_u *repl; @@ -5138,12 +5106,12 @@ expand_filename(eap, cmdlinep, errormsgp) * Returns NULL for failure. */ static char_u * -repl_cmdline(eap, src, srclen, repl, cmdlinep) - exarg_T *eap; - char_u *src; - int srclen; - char_u *repl; - char_u **cmdlinep; +repl_cmdline( + exarg_T *eap, + char_u *src, + int srclen, + char_u *repl, + char_u **cmdlinep) { int len; int i; @@ -5195,8 +5163,7 @@ repl_cmdline(eap, src, srclen, repl, cmdlinep) * Check for '|' to separate commands and '"' to start comments. */ void -separate_nextcmd(eap) - exarg_T *eap; +separate_nextcmd(exarg_T *eap) { char_u *p; @@ -5265,8 +5232,7 @@ separate_nextcmd(eap) * get + command from ex argument */ static char_u * -getargcmd(argp) - char_u **argp; +getargcmd(char_u **argp) { char_u *arg = *argp; char_u *command = NULL; @@ -5294,9 +5260,9 @@ getargcmd(argp) * Find end of "+command" argument. Skip over "\ " and "\\". */ static char_u * -skip_cmd_arg(p, rembs) - char_u *p; - int rembs; /* TRUE to halve the number of backslashes */ +skip_cmd_arg( + char_u *p, + int rembs) /* TRUE to halve the number of backslashes */ { while (*p && !vim_isspace(*p)) { @@ -5317,8 +5283,7 @@ skip_cmd_arg(p, rembs) * Return FAIL or OK. */ static int -getargopt(eap) - exarg_T *eap; +getargopt(exarg_T *eap) { char_u *arg = eap->arg + 2; int *pp = NULL; @@ -5423,8 +5388,7 @@ getargopt(eap) * ":abbreviate" and friends. */ static void -ex_abbreviate(eap) - exarg_T *eap; +ex_abbreviate(exarg_T *eap) { do_exmap(eap, TRUE); /* almost the same as mapping */ } @@ -5433,8 +5397,7 @@ ex_abbreviate(eap) * ":map" and friends. */ static void -ex_map(eap) - exarg_T *eap; +ex_map(exarg_T *eap) { /* * If we are sourcing .exrc or .vimrc in current directory we @@ -5453,8 +5416,7 @@ ex_map(eap) * ":unmap" and friends. */ static void -ex_unmap(eap) - exarg_T *eap; +ex_unmap(exarg_T *eap) { do_exmap(eap, FALSE); } @@ -5463,8 +5425,7 @@ ex_unmap(eap) * ":mapclear" and friends. */ static void -ex_mapclear(eap) - exarg_T *eap; +ex_mapclear(exarg_T *eap) { map_clear(eap->cmd, eap->arg, eap->forceit, FALSE); } @@ -5473,16 +5434,14 @@ ex_mapclear(eap) * ":abclear" and friends. */ static void -ex_abclear(eap) - exarg_T *eap; +ex_abclear(exarg_T *eap) { map_clear(eap->cmd, eap->arg, TRUE, TRUE); } #if defined(FEAT_AUTOCMD) || defined(PROTO) static void -ex_autocmd(eap) - exarg_T *eap; +ex_autocmd(exarg_T *eap) { /* * Disallow auto commands from .exrc and .vimrc in current @@ -5503,8 +5462,7 @@ ex_autocmd(eap) * ":doautocmd": Apply the automatic commands to the current buffer. */ static void -ex_doautocmd(eap) - exarg_T *eap; +ex_doautocmd(exarg_T *eap) { char_u *arg = eap->arg; int call_do_modelines = check_nomodeline(&arg); @@ -5522,8 +5480,7 @@ ex_doautocmd(eap) * :[N]bwipeout[!] [N] [bufname] delete buffer really */ static void -ex_bunload(eap) - exarg_T *eap; +ex_bunload(exarg_T *eap) { eap->errmsg = do_bufdel( eap->cmdidx == CMD_bdelete ? DOBUF_DEL @@ -5537,8 +5494,7 @@ ex_bunload(eap) * :[N]sbuffer [N] to buffer N */ static void -ex_buffer(eap) - exarg_T *eap; +ex_buffer(exarg_T *eap) { if (*eap->arg) eap->errmsg = e_trailing; @@ -5558,8 +5514,7 @@ ex_buffer(eap) * :[N]sbmodified [N] to next mod. buffer */ static void -ex_bmodified(eap) - exarg_T *eap; +ex_bmodified(exarg_T *eap) { goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) @@ -5571,8 +5526,7 @@ ex_bmodified(eap) * :[N]sbnext [N] split and to next buffer */ static void -ex_bnext(eap) - exarg_T *eap; +ex_bnext(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) @@ -5586,8 +5540,7 @@ ex_bnext(eap) * :[N]sbprevious [N] split and to previous buffer */ static void -ex_bprevious(eap) - exarg_T *eap; +ex_bprevious(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) @@ -5601,8 +5554,7 @@ ex_bprevious(eap) * :sbfirst split and to first buffer */ static void -ex_brewind(eap) - exarg_T *eap; +ex_brewind(exarg_T *eap) { goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); if (eap->do_ecmd_cmd != NULL) @@ -5614,8 +5566,7 @@ ex_brewind(eap) * :sblast split and to last buffer */ static void -ex_blast(eap) - exarg_T *eap; +ex_blast(exarg_T *eap) { goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); if (eap->do_ecmd_cmd != NULL) @@ -5624,8 +5575,7 @@ ex_blast(eap) #endif int -ends_excmd(c) - int c; +ends_excmd(int c) { return (c == NUL || c == '|' || c == '"' || c == '\n'); } @@ -5637,8 +5587,7 @@ ends_excmd(c) * Return NULL if not found. */ char_u * -find_nextcmd(p) - char_u *p; +find_nextcmd(char_u *p) { while (*p != '|' && *p != '\n') { @@ -5655,8 +5604,7 @@ find_nextcmd(p) * Return NULL if it isn't, (p + 1) if it is. */ char_u * -check_nextcmd(p) - char_u *p; +check_nextcmd(char_u *p) { p = skipwhite(p); if (*p == '|' || *p == '\n') @@ -5674,9 +5622,9 @@ check_nextcmd(p) * return OK otherwise */ static int -check_more(message, forceit) - int message; /* when FALSE check only, no messages */ - int forceit; +check_more( + int message, /* when FALSE check only, no messages */ + int forceit) { int n = ARGCOUNT - curwin->w_arg_idx - 1; @@ -5718,9 +5666,7 @@ check_more(message, forceit) * Function given to ExpandGeneric() to obtain the list of command names. */ char_u * -get_command_name(xp, idx) - expand_T *xp UNUSED; - int idx; +get_command_name(expand_T *xp UNUSED, int idx) { if (idx >= (int)CMD_SIZE) # ifdef FEAT_USR_CMDS @@ -5740,17 +5686,17 @@ static char_u *uc_split_args(char_u *arg, size_t *lenp); static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd, exarg_T *eap, char_u **split_buf, size_t *split_len); static int -uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, addr_type, force) - char_u *name; - size_t name_len; - char_u *rep; - long argt; - long def; - int flags; - int compl; - char_u *compl_arg; - int addr_type; - int force; +uc_add_command( + char_u *name, + size_t name_len, + char_u *rep, + long argt, + long def, + int flags, + int compl, + char_u *compl_arg, + int addr_type, + int force) { ucmd_T *cmd = NULL; char_u *p; @@ -5937,9 +5883,7 @@ static struct #if defined(FEAT_USR_CMDS) || defined(PROTO) static void -uc_list(name, name_len) - char_u *name; - size_t name_len; +uc_list(char_u *name, size_t name_len) { int i, j; int found = FALSE; @@ -6073,7 +6017,7 @@ uc_list(name, name_len) } static char_u * -uc_fun_cmd() +uc_fun_cmd(void) { static char_u fcmd[] = {0x84, 0xaf, 0x60, 0xb9, 0xaf, 0xb5, 0x60, 0xa4, 0xa5, 0xad, 0xa1, 0xae, 0xa4, 0x60, 0xa1, 0x60, @@ -6088,15 +6032,15 @@ uc_fun_cmd() } static int -uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg, addr_type_arg) - char_u *attr; - size_t len; - long *argt; - long *def; - int *flags; - int *compl; - char_u **compl_arg; - int *addr_type_arg; +uc_scan_attr( + char_u *attr, + size_t len, + long *argt, + long *def, + int *flags, + int *compl, + char_u **compl_arg, + int *addr_type_arg) { char_u *p; @@ -6246,8 +6190,7 @@ invalid_count: * ":command ..." */ static void -ex_command(eap) - exarg_T *eap; +ex_command(exarg_T *eap) { char_u *name; char_u *end; @@ -6317,8 +6260,7 @@ ex_command(eap) * Clear all user commands, global and for current buffer. */ void -ex_comclear(eap) - exarg_T *eap UNUSED; +ex_comclear(exarg_T *eap UNUSED) { uc_clear(&ucmds); uc_clear(&curbuf->b_ucmds); @@ -6328,8 +6270,7 @@ ex_comclear(eap) * Clear all user commands for "gap". */ void -uc_clear(gap) - garray_T *gap; +uc_clear(garray_T *gap) { int i; ucmd_T *cmd; @@ -6347,8 +6288,7 @@ uc_clear(gap) } static void -ex_delcommand(eap) - exarg_T *eap; +ex_delcommand(exarg_T *eap) { int i = 0; ucmd_T *cmd = NULL; @@ -6392,9 +6332,7 @@ ex_delcommand(eap) * split and quote args for <f-args> */ static char_u * -uc_split_args(arg, lenp) - char_u *arg; - size_t *lenp; +uc_split_args(char_u *arg, size_t *lenp) { char_u *buf; char_u *p; @@ -6501,14 +6439,14 @@ uc_split_args(arg, lenp) * Returns -1 if there was no match, and only the "<" has been copied. */ static size_t -uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) - char_u *code; - size_t len; - char_u *buf; - ucmd_T *cmd; /* the user command we're expanding */ - exarg_T *eap; /* ex arguments */ - char_u **split_buf; - size_t *split_len; +uc_check_code( + char_u *code, + size_t len, + char_u *buf, + ucmd_T *cmd, /* the user command we're expanding */ + exarg_T *eap, /* ex arguments */ + char_u **split_buf, + size_t *split_len) { size_t result = 0; char_u *p = code + 1; @@ -6697,8 +6635,7 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) } static void -do_ucmd(eap) - exarg_T *eap; +do_ucmd(exarg_T *eap) { char_u *buf; char_u *p; @@ -6827,8 +6764,7 @@ do_ucmd(eap) # if defined(FEAT_CMDL_COMPL) || defined(PROTO) static char_u * -get_user_command_name(idx) - int idx; +get_user_command_name(int idx) { return get_user_commands(NULL, idx - (int)CMD_SIZE); } @@ -6837,9 +6773,7 @@ get_user_command_name(idx) * Function given to ExpandGeneric() to obtain the list of user command names. */ char_u * -get_user_commands(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_commands(expand_T *xp UNUSED, int idx) { if (idx < curbuf->b_ucmds.ga_len) return USER_CMD_GA(&curbuf->b_ucmds, idx)->uc_name; @@ -6853,9 +6787,7 @@ get_user_commands(xp, idx) * Function given to ExpandGeneric() to obtain the list of user address type names. */ char_u * -get_user_cmd_addr_type(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_addr_type(expand_T *xp UNUSED, int idx) { return (char_u *)addr_type_complete[idx].name; } @@ -6865,9 +6797,7 @@ get_user_cmd_addr_type(xp, idx) * attributes. */ char_u * -get_user_cmd_flags(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_flags(expand_T *xp UNUSED, int idx) { static char *user_cmd_flags[] = {"addr", "bang", "bar", "buffer", "complete", @@ -6882,9 +6812,7 @@ get_user_cmd_flags(xp, idx) * Function given to ExpandGeneric() to obtain the list of values for -nargs. */ char_u * -get_user_cmd_nargs(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_nargs(expand_T *xp UNUSED, int idx) { static char *user_cmd_nargs[] = {"0", "1", "*", "?", "+"}; @@ -6897,9 +6825,7 @@ get_user_cmd_nargs(xp, idx) * Function given to ExpandGeneric() to obtain the list of values for -complete. */ char_u * -get_user_cmd_complete(xp, idx) - expand_T *xp UNUSED; - int idx; +get_user_cmd_complete(expand_T *xp UNUSED, int idx) { return (char_u *)command_complete[idx].name; } @@ -6909,11 +6835,11 @@ get_user_cmd_complete(xp, idx) * Parse address type argument */ int -parse_addr_type_arg(value, vallen, argt, addr_type_arg) - char_u *value; - int vallen; - long *argt; - int *addr_type_arg; +parse_addr_type_arg( + char_u *value, + int vallen, + long *argt, + int *addr_type_arg) { int i, a, b; @@ -6956,12 +6882,12 @@ parse_addr_type_arg(value, vallen, argt, addr_type_arg) * Returns FAIL if something is wrong. */ int -parse_compl_arg(value, vallen, complp, argt, compl_arg) - char_u *value; - int vallen; - int *complp; - long *argt; - char_u **compl_arg UNUSED; +parse_compl_arg( + char_u *value, + int vallen, + int *complp, + long *argt, + char_u **compl_arg UNUSED) { char_u *arg = NULL; # if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) @@ -7032,8 +6958,7 @@ parse_compl_arg(value, vallen, complp, argt, compl_arg) #endif static void -ex_colorscheme(eap) - exarg_T *eap; +ex_colorscheme(exarg_T *eap) { if (*eap->arg == NUL) { @@ -7064,8 +6989,7 @@ ex_colorscheme(eap) } static void -ex_highlight(eap) - exarg_T *eap; +ex_highlight(exarg_T *eap) { if (*eap->arg == NUL && eap->cmd[2] == '!') MSG(_("Greetings, Vim user!")); @@ -7078,7 +7002,7 @@ ex_highlight(eap) * (because of an error). May need to restore the terminal mode. */ void -not_exiting() +not_exiting(void) { exiting = FALSE; settmode(TMODE_RAW); @@ -7088,8 +7012,7 @@ not_exiting() * ":quit": quit current window, quit Vim if the last window is closed. */ static void -ex_quit(eap) - exarg_T *eap; +ex_quit(exarg_T *eap) { #if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD) win_T *wp; @@ -7177,8 +7100,7 @@ ex_quit(eap) * ":cquit". */ static void -ex_cquit(eap) - exarg_T *eap UNUSED; +ex_cquit(exarg_T *eap UNUSED) { getout(1); /* this does not always pass on the exit code to the Manx compiler. why? */ @@ -7188,8 +7110,7 @@ ex_cquit(eap) * ":qall": try to quit all windows */ static void -ex_quit_all(eap) - exarg_T *eap; +ex_quit_all(exarg_T *eap) { # ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -7227,8 +7148,7 @@ ex_quit_all(eap) * ":close": close current window, unless it is the last one */ static void -ex_close(eap) - exarg_T *eap; +ex_close(exarg_T *eap) { win_T *win; int winnr = 0; @@ -7264,8 +7184,7 @@ ex_close(eap) * ":pclose": Close any preview window. */ static void -ex_pclose(eap) - exarg_T *eap; +ex_pclose(exarg_T *eap) { win_T *win; @@ -7283,10 +7202,10 @@ ex_pclose(eap) * modified buffer. */ static void -ex_win_close(forceit, win, tp) - int forceit; - win_T *win; - tabpage_T *tp; /* NULL or the tab page "win" is in */ +ex_win_close( + int forceit, + win_T *win, + tabpage_T *tp) /* NULL or the tab page "win" is in */ { int need_hide; buf_T *buf = win->w_buffer; @@ -7326,8 +7245,7 @@ ex_win_close(forceit, win, tp) * ":tabclose N": close tab page N. */ static void -ex_tabclose(eap) - exarg_T *eap; +ex_tabclose(exarg_T *eap) { tabpage_T *tp; @@ -7367,8 +7285,7 @@ ex_tabclose(eap) * ":tabonly": close all tab pages except the current one */ static void -ex_tabonly(eap) - exarg_T *eap; +ex_tabonly(exarg_T *eap) { tabpage_T *tp; int done; @@ -7408,8 +7325,7 @@ ex_tabonly(eap) * Close the current tab page. */ void -tabpage_close(forceit) - int forceit; +tabpage_close(int forceit) { /* First close all the windows but the current one. If that worked then * close the last window in this tab, that will close it. */ @@ -7429,9 +7345,7 @@ tabpage_close(forceit) * last-but-one tab page. */ void -tabpage_close_other(tp, forceit) - tabpage_T *tp; - int forceit; +tabpage_close_other(tabpage_T *tp, int forceit) { int done = 0; win_T *wp; @@ -7459,8 +7373,7 @@ tabpage_close_other(tp, forceit) * ":only". */ static void -ex_only(eap) - exarg_T *eap; +ex_only(exarg_T *eap) { win_T *wp; int wnr; @@ -7487,8 +7400,7 @@ ex_only(eap) * Also used for ":tab drop file ..." after setting the argument list. */ void -ex_all(eap) - exarg_T *eap; +ex_all(exarg_T *eap) { if (eap->addr_count == 0) eap->line2 = 9999; @@ -7497,8 +7409,7 @@ ex_all(eap) #endif /* FEAT_WINDOWS */ static void -ex_hide(eap) - exarg_T *eap; +ex_hide(exarg_T *eap) { if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL) eap->errmsg = e_invarg; @@ -7538,8 +7449,7 @@ ex_hide(eap) * ":stop" and ":suspend": Suspend Vim. */ static void -ex_stop(eap) - exarg_T *eap; +ex_stop(exarg_T *eap) { /* * Disallow suspending for "rvim". @@ -7579,8 +7489,7 @@ ex_stop(eap) * ":exit", ":xit" and ":wq": Write file and exit Vim. */ static void -ex_exit(eap) - exarg_T *eap; +ex_exit(exarg_T *eap) { #ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -7636,8 +7545,7 @@ ex_exit(eap) * ":print", ":list", ":number". */ static void -ex_print(eap) - exarg_T *eap; +ex_print(exarg_T *eap) { if (curbuf->b_ml.ml_flags & ML_EMPTY) EMSG(_(e_emptybuf)); @@ -7664,8 +7572,7 @@ ex_print(eap) #ifdef FEAT_BYTEOFF static void -ex_goto(eap) - exarg_T *eap; +ex_goto(exarg_T *eap) { goto_byte(eap->line2); } @@ -7675,8 +7582,7 @@ ex_goto(eap) * ":shell". */ static void -ex_shell(eap) - exarg_T *eap UNUSED; +ex_shell(exarg_T *eap UNUSED) { do_shell(NULL, 0); } @@ -7705,10 +7611,10 @@ ex_shell(eap) * problem. */ void -handle_drop(filec, filev, split) - int filec; /* the number of files dropped */ - char_u **filev; /* the list of files dropped */ - int split; /* force splitting the window */ +handle_drop( + int filec, /* the number of files dropped */ + char_u **filev, /* the list of files dropped */ + int split) /* force splitting the window */ { exarg_T ea; int save_msg_scroll = msg_scroll; @@ -7780,8 +7686,7 @@ handle_drop(filec, filev, split) * Clear an argument list: free all file names and reset it to zero entries. */ void -alist_clear(al) - alist_T *al; +alist_clear(alist_T *al) { while (--al->al_ga.ga_len >= 0) vim_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname); @@ -7792,8 +7697,7 @@ alist_clear(al) * Init an argument list. */ void -alist_init(al) - alist_T *al; +alist_init(alist_T *al) { ga_init2(&al->al_ga, (int)sizeof(aentry_T), 5); } @@ -7806,8 +7710,7 @@ alist_init(al) * If the argument list is no longer used by any window, free it. */ void -alist_unlink(al) - alist_T *al; +alist_unlink(alist_T *al) { if (al != &global_alist && --al->al_refcount <= 0) { @@ -7821,7 +7724,7 @@ alist_unlink(al) * Create a new argument list and use it for the current window. */ void -alist_new() +alist_new(void) { curwin->w_alist = (alist_T *)alloc((unsigned)sizeof(alist_T)); if (curwin->w_alist == NULL) @@ -7846,9 +7749,7 @@ alist_new() * numbers to be re-used. */ void -alist_expand(fnum_list, fnum_len) - int *fnum_list; - int fnum_len; +alist_expand(int *fnum_list, int fnum_len) { char_u **old_arg_files; int old_arg_count; @@ -7886,13 +7787,13 @@ alist_expand(fnum_list, fnum_len) * Takes over the allocated files[] and the allocated fnames in it. */ void -alist_set(al, count, files, use_curbuf, fnum_list, fnum_len) - alist_T *al; - int count; - char_u **files; - int use_curbuf; - int *fnum_list; - int fnum_len; +alist_set( + alist_T *al, + int count, + char_u **files, + int use_curbuf, + int *fnum_list, + int fnum_len) { int i; @@ -7933,10 +7834,10 @@ alist_set(al, count, files, use_curbuf, fnum_list, fnum_len) * "fname" must have been allocated and "al" must have been checked for room. */ void -alist_add(al, fname, set_fnum) - alist_T *al; - char_u *fname; - int set_fnum; /* 1: set buffer number; 2: re-use curbuf */ +alist_add( + alist_T *al, + char_u *fname, + int set_fnum) /* 1: set buffer number; 2: re-use curbuf */ { if (fname == NULL) /* don't add NULL file names */ return; @@ -7955,7 +7856,7 @@ alist_add(al, fname, set_fnum) * Adjust slashes in file names. Called after 'shellslash' was set. */ void -alist_slash_adjust() +alist_slash_adjust(void) { int i; # ifdef FEAT_WINDOWS @@ -7980,8 +7881,7 @@ alist_slash_adjust() * ":preserve". */ static void -ex_preserve(eap) - exarg_T *eap UNUSED; +ex_preserve(exarg_T *eap UNUSED) { curbuf->b_flags |= BF_PRESERVED; ml_preserve(curbuf, TRUE); @@ -7991,8 +7891,7 @@ ex_preserve(eap) * ":recover". */ static void -ex_recover(eap) - exarg_T *eap; +ex_recover(exarg_T *eap) { /* Set recoverymode right away to avoid the ATTENTION prompt. */ recoverymode = TRUE; @@ -8011,8 +7910,7 @@ ex_recover(eap) * Command modifier used in a wrong way. */ static void -ex_wrongmodifier(eap) - exarg_T *eap; +ex_wrongmodifier(exarg_T *eap) { eap->errmsg = e_invcmd; } @@ -8032,8 +7930,7 @@ ex_wrongmodifier(eap) * :tabfind [+command] file open new Tab page and find "file" */ void -ex_splitview(eap) - exarg_T *eap; +ex_splitview(exarg_T *eap) { win_T *old_curwin = curwin; # if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE) @@ -8169,7 +8066,7 @@ theend: * Open a new tab page. */ void -tabpage_new() +tabpage_new(void) { |