diff options
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 252 |
1 files changed, 126 insertions, 126 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 9412bff2e6..b0d44651fc 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -228,7 +228,7 @@ void do_exmode(void) if ((prev_line != curwin->w_cursor.lnum || changedtick != buf_get_changedtick(curbuf)) && !ex_no_reprint) { if (curbuf->b_ml.ml_flags & ML_EMPTY) { - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); } else { if (ex_pressedreturn) { // go up one line, to overwrite the ":<CR>" line, so the @@ -244,9 +244,9 @@ void do_exmode(void) } } else if (ex_pressedreturn && !ex_no_reprint) { // must be at EOF if (curbuf->b_ml.ml_flags & ML_EMPTY) { - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); } else { - EMSG(_("E501: At end-of-file")); + emsg(_("E501: At end-of-file")); } } } @@ -354,7 +354,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags) // here. The value of 200 allows nested function calls, ":source", etc. // Allow 200 or 'maxfuncdepth', whatever is larger. if (call_depth >= 200 && call_depth >= p_mfd) { - EMSG(_("E169: Command too recursive")); + emsg(_("E169: Command too recursive")); // When converting to an exception, we do not include the command name // since this is not an error of the specific command. do_errthrow((cstack_T *)NULL, (char_u *)NULL); @@ -777,13 +777,13 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags) || (getline_equal(fgetline, cookie, get_func_line) && !func_has_ended(real_cookie)))) { if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY) { - EMSG(_(e_endtry)); + emsg(_(e_endtry)); } else if (cstack.cs_flags[cstack.cs_idx] & CSF_WHILE) { - EMSG(_(e_endwhile)); + emsg(_(e_endwhile)); } else if (cstack.cs_flags[cstack.cs_idx] & CSF_FOR) { - EMSG(_(e_endfor)); + emsg(_(e_endfor)); } else { - EMSG(_(e_endif)); + emsg(_(e_endif)); } } @@ -1256,7 +1256,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe char_u *p; linenr_T lnum; long n; - char_u *errormsg = NULL; // error message + char *errormsg = NULL; // error message char_u *after_modifier = NULL; exarg_T ea; const int save_msg_scroll = msg_scroll; @@ -1435,7 +1435,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe } if (ea.line2 < 0) { - errormsg = (char_u *)_(e_invrange); + errormsg = _(e_invrange); } else { if (ea.line2 == 0) { curwin->w_cursor.lnum = 1; @@ -1467,7 +1467,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (p == NULL) { if (!ea.skip) { - errormsg = (char_u *)_("E464: Ambiguous use of user-defined command"); + errormsg = _("E464: Ambiguous use of user-defined command"); } goto doend; } @@ -1481,7 +1481,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (!(flags & DOCMD_VERBOSE)) { append_command(cmdname); } - errormsg = IObuff; + errormsg = (char *)IObuff; did_emsg_syntax = true; verify_command(cmdname); } @@ -1511,21 +1511,21 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (!ea.skip) { if (sandbox != 0 && !(ea.argt & EX_SBOXOK)) { // Command not allowed in sandbox. - errormsg = (char_u *)_(e_sandbox); + errormsg = _(e_sandbox); goto doend; } if (!MODIFIABLE(curbuf) && (ea.argt & EX_MODIFY) // allow :put in terminals && (!curbuf->terminal || ea.cmdidx != CMD_put)) { // Command not allowed in non-'modifiable' buffer - errormsg = (char_u *)_(e_modifiable); + errormsg = _(e_modifiable); goto doend; } if (text_locked() && !(ea.argt & EX_CMDWIN) && !IS_USER_CMDIDX(ea.cmdidx)) { // Command not allowed when editing the command line. - errormsg = (char_u *)_(get_text_locked_msg()); + errormsg = _(get_text_locked_msg()); goto doend; } @@ -1544,13 +1544,13 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (!ni && !(ea.argt & EX_RANGE) && ea.addr_count > 0) { // no range allowed - errormsg = (char_u *)_(e_norange); + errormsg = _(e_norange); goto doend; } } if (!ni && !(ea.argt & EX_BANG) && ea.forceit) { // no <!> allowed - errormsg = (char_u *)_(e_nobang); + errormsg = _(e_nobang); goto doend; } @@ -1565,7 +1565,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (!global_busy && ea.line1 > ea.line2) { if (msg_silent == 0) { if ((flags & DOCMD_VERBOSE) || exmode_active) { - errormsg = (char_u *)_("E493: Backwards range given"); + errormsg = _("E493: Backwards range given"); goto doend; } if (ask_yesno(_("Backwards range given, OK to swap"), false) != 'y') { @@ -1627,7 +1627,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (ea.argt & EX_ARGOPT) { while (ea.arg[0] == '+' && ea.arg[1] == '+') { if (getargopt(&ea) == FAIL && !ni) { - errormsg = (char_u *)_(e_invarg); + errormsg = _(e_invarg); goto doend; } } @@ -1636,7 +1636,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) { if (*ea.arg == '>') { // append if (*++ea.arg != '>') { // typed wrong - errormsg = (char_u *)_("E494: Use w or w>>"); + errormsg = _("E494: Use w or w>>"); goto doend; } ea.arg = skipwhite(ea.arg + 1); @@ -1755,7 +1755,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe case ADDR_NONE: case ADDR_UNSIGNED: case ADDR_QUICKFIX: - IEMSG(_("INTERNAL: Cannot use EX_DFLALL " + iemsg(_("INTERNAL: Cannot use EX_DFLALL " "with ADDR_NONE, ADDR_UNSIGNED or ADDR_QUICKFIX")); break; } @@ -1789,7 +1789,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe n = getdigits_long(&ea.arg, false, -1); ea.arg = skipwhite(ea.arg); if (n <= 0 && !ni && (ea.argt & EX_ZEROR) == 0) { - errormsg = (char_u *)_(e_zerocount); + errormsg = _(e_zerocount); goto doend; } if (ea.addr_type != ADDR_LINES) { // e.g. :buffer 2, :sleep 3 @@ -1817,12 +1817,12 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe if (!ni && !(ea.argt & EX_EXTRA) && *ea.arg != NUL && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) { // no arguments allowed but there is something - errormsg = (char_u *)_(e_trailing); + errormsg = _(e_trailing); goto doend; } if (!ni && (ea.argt & EX_NEEDARG) && *ea.arg == NUL) { - errormsg = (char_u *)_(e_argreq); + errormsg = _(e_argreq); goto doend; } @@ -1982,7 +1982,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe ea.errmsg = NULL; (cmdnames[ea.cmdidx].cmd_func)(&ea); if (ea.errmsg != NULL) { - errormsg = (char_u *)_(ea.errmsg); + errormsg = _(ea.errmsg); } } @@ -2014,9 +2014,9 @@ doend: if (errormsg != NULL && *errormsg != NUL && !did_emsg) { if (flags & DOCMD_VERBOSE) { - if (errormsg != IObuff) { + if (errormsg != (char *)IObuff) { STRCPY(IObuff, errormsg); - errormsg = IObuff; + errormsg = (char *)IObuff; } append_command(*cmdlinep); } @@ -2056,7 +2056,7 @@ doend: // "cmdmod". // Return FAIL when the command is not to be executed. // May set "errormsg" to an error message. -int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only) +int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only) { char_u *p; @@ -2260,7 +2260,7 @@ int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only) cmdmod.tab = tabpage_index(curtab) + 1; } else { if (tabnr < 0 || tabnr > LAST_TAB_NR) { - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return false; } cmdmod.tab = tabnr + 1; @@ -2356,7 +2356,7 @@ static void undo_cmdmod(const exarg_T *eap, int save_msg_scroll) // Parse the address range, if any, in "eap". // May set the last search pattern, unless "silent" is true. // Return FAIL and set "errormsg" or return OK. -int parse_cmd_address(exarg_T *eap, char_u **errormsg, bool silent) +int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent) FUNC_ATTR_NONNULL_ALL { int address_count = 1; @@ -2443,14 +2443,14 @@ int parse_cmd_address(exarg_T *eap, char_u **errormsg, bool silent) } else { // there is no Vim command which uses '%' and // ADDR_WINDOWS or ADDR_TABS - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; } break; case ADDR_TABS_RELATIVE: case ADDR_UNSIGNED: case ADDR_QUICKFIX: - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; case ADDR_ARGUMENTS: if (ARGCOUNT == 0) { @@ -2475,7 +2475,7 @@ int parse_cmd_address(exarg_T *eap, char_u **errormsg, bool silent) } else if (*eap->cmd == '*') { // '*' - visual area if (eap->addr_type != ADDR_LINES) { - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; } @@ -3829,9 +3829,9 @@ char_u *skip_range(const char_u *cmd, int *ctx) static void addr_error(cmd_addr_T addr_type) { if (addr_type == ADDR_NONE) { - EMSG(_(e_norange)); + emsg(_(e_norange)); } else { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); } } @@ -4042,7 +4042,7 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in } else if (*cmd == '?' || *cmd == '/') { i = RE_SEARCH; } else { - EMSG(_(e_backslash)); + emsg(_(e_backslash)); cmd = NULL; goto error; } @@ -4125,7 +4125,7 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in } if (addr_type == ADDR_TABS_RELATIVE) { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); cmd = NULL; goto error; } else if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_BUFFERS) { @@ -4172,7 +4172,7 @@ static void get_flags(exarg_T *eap) void ex_ni(exarg_T *eap) { if (!eap->skip) { - eap->errmsg = (char_u *)N_("E319: The command is not available in this version"); + eap->errmsg = N_("E319: The command is not available in this version"); } } @@ -4192,11 +4192,11 @@ static void ex_script_ni(exarg_T *eap) * Check range in Ex command for validity. * Return NULL when valid, error message when invalid. */ -static char_u *invalid_range(exarg_T *eap) +static char *invalid_range(exarg_T *eap) { buf_T *buf; if (eap->line1 < 0 || eap->line2 < 0 || eap->line1 > eap->line2) { - return (char_u *)_(e_invrange); + return _(e_invrange); } if (eap->argt & EX_RANGE) { @@ -4204,51 +4204,51 @@ static char_u *invalid_range(exarg_T *eap) case ADDR_LINES: if (eap->line2 > (curbuf->b_ml.ml_line_count + (eap->cmdidx == CMD_diffget))) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_ARGUMENTS: // add 1 if ARGCOUNT is 0 if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_BUFFERS: if (eap->line1 < firstbuf->b_fnum || eap->line2 > lastbuf->b_fnum) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_LOADED_BUFFERS: buf = firstbuf; while (buf->b_ml.ml_mfp == NULL) { if (buf->b_next == NULL) { - return (char_u *)_(e_invrange); + return _(e_invrange); } buf = buf->b_next; } if (eap->line1 < buf->b_fnum) { - return (char_u *)_(e_invrange); + return _(e_invrange); } buf = lastbuf; while (buf->b_ml.ml_mfp == NULL) { if (buf->b_prev == NULL) { - return (char_u *)_(e_invrange); + return _(e_invrange); } buf = buf->b_prev; } if (eap->line2 > buf->b_fnum) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_WINDOWS: if (eap->line2 > LAST_WIN_NR) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_TABS: if (eap->line2 > LAST_TAB_NR) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_TABS_RELATIVE: @@ -4259,13 +4259,13 @@ static char_u *invalid_range(exarg_T *eap) assert(eap->line2 >= 0); // No error for value that is too big, will use the last entry. if (eap->line2 <= 0) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_QUICKFIX_VALID: if ((eap->line2 != 1 && (size_t)eap->line2 > qf_get_valid_size(eap)) || eap->line2 < 0) { - return (char_u *)_(e_invrange); + return _(e_invrange); } break; case ADDR_UNSIGNED: @@ -4387,7 +4387,7 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) // Expand file name in Ex command argument. // When an error is detected, "errormsgp" is set to a non-NULL pointer. // Return FAIL for failure, OK otherwise. -int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) +int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp) { int has_wildcards; // need to expand wildcards char_u *repl; @@ -5124,8 +5124,8 @@ static int check_more(int message, bool forceit) } return FAIL; } - EMSGN(NGETTEXT("E173: %d more file to edit", - "E173: %d more files to edit", (unsigned long)n), n); + semsg(NGETTEXT("E173: %" PRId64 " more file to edit", + "E173: %" PRId64 " more files to edit", (unsigned long)n), (int64_t)n); quitmore = 2; // next try to quit is allowed } return FAIL; @@ -5192,7 +5192,7 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, uint32_t a if (!force && (cmd->uc_script_ctx.sc_sid != current_sctx.sc_sid || cmd->uc_script_ctx.sc_seq == current_sctx.sc_seq)) { - EMSG2(_("E174: Command already exists: add ! to replace it: %s"), + semsg(_("E174: Command already exists: add ! to replace it: %s"), name); goto fail; } @@ -5486,7 +5486,7 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int char_u *p; if (len == 0) { - EMSG(_("E175: No attribute specified")); + emsg(_("E175: No attribute specified")); return FAIL; } @@ -5532,7 +5532,7 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int } } else { wrong_nargs: - EMSG(_("E176: Invalid number of arguments")); + emsg(_("E176: Invalid number of arguments")); return FAIL; } } else if (STRNICMP(attr, "range", attrlen) == 0) { @@ -5543,7 +5543,7 @@ wrong_nargs: p = val; if (*def >= 0) { two_count: - EMSG(_("E177: Count cannot be specified twice")); + emsg(_("E177: Count cannot be specified twice")); return FAIL; } @@ -5552,7 +5552,7 @@ two_count: if (p != val + vallen || vallen == 0) { invalid_count: - EMSG(_("E178: Invalid default value for count")); + emsg(_("E178: Invalid default value for count")); return FAIL; } } @@ -5585,7 +5585,7 @@ invalid_count: } } else if (STRNICMP(attr, "complete", attrlen) == 0) { if (val == NULL) { - EMSG(_("E179: argument required for -complete")); + emsg(_("E179: argument required for -complete")); return FAIL; } @@ -5596,7 +5596,7 @@ invalid_count: } else if (STRNICMP(attr, "addr", attrlen) == 0) { *argt |= EX_RANGE; if (val == NULL) { - EMSG(_("E179: argument required for -addr")); + emsg(_("E179: argument required for -addr")); return FAIL; } if (parse_addr_type_arg(val, (int)vallen, addr_type_arg) == FAIL) { @@ -5608,7 +5608,7 @@ invalid_count: } else { char_u ch = attr[len]; attr[len] = '\0'; - EMSG2(_("E181: Invalid attribute: %s"), attr); + semsg(_("E181: Invalid attribute: %s"), attr); attr[len] = ch; return FAIL; } @@ -5657,7 +5657,7 @@ static void ex_command(exarg_T *eap) } } if (!ends_excmd(*p) && !ascii_iswhite(*p)) { - EMSG(_("E182: Invalid command name")); + emsg(_("E182: Invalid command name")); return; } end = p; @@ -5669,11 +5669,11 @@ static void ex_command(exarg_T *eap) if (!has_attr && ends_excmd(*p)) { uc_list(name, end - name); } else if (!ASCII_ISUPPER(*name)) { - EMSG(_("E183: User defined commands must start with an uppercase letter")); + emsg(_("E183: User defined commands must start with an uppercase letter")); } else if (name_len <= 4 && STRNCMP(name, "Next", name_len) == 0) { - EMSG(_("E841: Reserved name, cannot be used for user defined command")); + emsg(_("E841: Reserved name, cannot be used for user defined command")); } else if (compl > 0 && (argt & EX_EXTRA) == 0) { - EMSG(_(e_complete_used_without_nargs)); + emsg(_(e_complete_used_without_nargs)); } else { uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg, addr_type_arg, eap->forceit); @@ -5728,7 +5728,7 @@ static void ex_delcommand(exarg_T *eap) } if (cmp != 0) { - EMSG2(_("E184: No such user-defined command: %s"), eap->arg); + semsg(_("E184: No such user-defined command: %s"), eap->arg); return; } @@ -6333,7 +6333,7 @@ int parse_addr_type_arg(char_u *value, int vallen, cmd_addr_T *addr_type_arg) for (i = 0; err[i] != NUL && !ascii_iswhite(err[i]); i++) {} err[i] = NUL; - EMSG2(_("E180: Invalid address type value: %s"), err); + semsg(_("E180: Invalid address type value: %s"), err); return FAIL; } @@ -6383,19 +6383,19 @@ int parse_compl_arg(const char_u *value, int vallen, int *complp, uint32_t *argt } if (i == (int)ARRAY_SIZE(command_complete)) { - EMSG2(_("E180: Invalid complete value: %s"), value); + semsg(_("E180: Invalid complete value: %s"), value); return FAIL; } if (*complp != EXPAND_USER_DEFINED && *complp != EXPAND_USER_LIST && arg != NULL) { - EMSG(_("E468: Completion argument only allowed for custom completion")); + emsg(_("E468: Completion argument only allowed for custom completion")); return FAIL; } if ((*complp == EXPAND_USER_DEFINED || *complp == EXPAND_USER_LIST) && arg == NULL) { - EMSG(_("E467: Custom completion requires a function argument")); + emsg(_("E467: Custom completion requires a function argument")); return FAIL; } @@ -6438,7 +6438,7 @@ static void ex_colorscheme(exarg_T *eap) MSG("default"); } } else if (load_colors(eap->arg) == FAIL) { - EMSG2(_("E185: Cannot find color scheme '%s'"), eap->arg); + semsg(_("E185: Cannot find color scheme '%s'"), eap->arg); } } @@ -6642,7 +6642,7 @@ void ex_win_close(int forceit, win_T *win, tabpage_T *tp) // Never close the autocommand window. if (win == aucmd_win) { - EMSG(_(e_autocmd_close)); + emsg(_(e_autocmd_close)); return; } @@ -6682,7 +6682,7 @@ static void ex_tabclose(exarg_T *eap) if (cmdwin_type != 0) { cmdwin_result = K_IGNORE; } else if (first_tabpage->tp_next == NULL) { - EMSG(_("E784: Cannot close last tab page")); + emsg(_("E784: Cannot close last tab page")); } else { int tab_number = get_tabpage_arg(eap); if (eap->errmsg == NULL) { @@ -6912,7 +6912,7 @@ static void ex_exit(exarg_T *eap) static void ex_print(exarg_T *eap) { if (curbuf->b_ml.ml_flags & ML_EMPTY) { - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); } else { for (; !got_int; os_breakcheck()) { print_line(eap->line1, @@ -7026,7 +7026,7 @@ void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum static int recursive = 0; if (recursive) { - EMSG(_(e_au_recursive)); + emsg(_(e_au_recursive)); return; } recursive++; @@ -7346,7 +7346,7 @@ static void ex_mode(exarg_T *eap) must_redraw = CLEAR; ex_redraw(eap); } else { - EMSG(_(e_screenmode)); + emsg(_(e_screenmode)); } } @@ -7550,7 +7550,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin) /// ":gui" and ":gvim" when there is no GUI. static void ex_nogui(exarg_T *eap) { - eap->errmsg = (char_u *)N_("E25: Nvim does not have a built-in GUI"); + eap->errmsg = N_("E25: Nvim does not have a built-in GUI"); } @@ -7662,7 +7662,7 @@ static void ex_read(exarg_T *eap) } if (i != OK) { if (!aborting()) { - EMSG2(_(e_notopen), eap->arg); + semsg(_(e_notopen), eap->arg); } } else { if (empty && exmode_active) { @@ -7778,7 +7778,7 @@ bool changedir_func(char_u *new_dir, CdScope scope) if (STRCMP(new_dir, "-") == 0) { pdir = get_prevdir(scope); if (pdir == NULL) { - EMSG(_("E186: No previous directory")); + emsg(_("E186: No previous directory")); return false; } new_dir = pdir; @@ -7818,7 +7818,7 @@ bool changedir_func(char_u *new_dir, CdScope scope) post_chdir(scope, dir_differs); retval = true; } else { - EMSG(_(e_failed)); + emsg(_(e_failed)); } xfree(tofree); @@ -7880,7 +7880,7 @@ static void ex_pwd(exarg_T *eap) msg(NameBuff); } } else { - EMSG(_("E187: Unknown")); + emsg(_("E187: Unknown")); } } @@ -7912,7 +7912,7 @@ static void ex_sleep(exarg_T *eap) case NUL: len *= 1000L; break; default: - EMSG2(_(e_invarg2), eap->arg); return; + semsg(_(e_invarg2), eap->arg); return; } do_sleep(len); } @@ -7947,10 +7947,10 @@ static void do_exmap(exarg_T *eap, int isabbrev) switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'), eap->arg, mode, isabbrev)) { case 1: - EMSG(_(e_invarg)); + emsg(_(e_invarg)); break; case 2: - EMSG(isabbrev ? _(e_noabbr) : _(e_nomap)); + emsg(isabbrev ? _(e_noabbr) : _(e_nomap)); break; } } @@ -7963,7 +7963,7 @@ static void ex_winsize(exarg_T *eap) char_u *arg = eap->arg; if (!ascii_isdigit(*arg)) { - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); return; } int w = getdigits_int(&arg, false, 10); @@ -7973,7 +7973,7 @@ static void ex_winsize(exarg_T *eap) if (*p != NUL && *arg == NUL) { screen_resize(w, h); } else { - EMSG(_("E465: :winsize requires two number arguments")); + emsg(_("E465: :winsize requires two number arguments")); } } @@ -7985,7 +7985,7 @@ static void ex_wincmd(exarg_T *eap) if (*eap->arg == 'g' || *eap->arg == Ctrl_G) { // CTRL-W g and CTRL-W CTRL-G have an extra command character if (eap->arg[1] == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } xchar = eap->arg[1]; @@ -7997,7 +7997,7 @@ static void ex_wincmd(exarg_T *eap) eap->nextcmd = check_nextcmd(p); p = skipwhite(p); if (*p != NUL && *p != '"' && eap->nextcmd == NULL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); } else if (!eap->skip) { // Pass flags on for ":vertical wincmd ]". postponed_split_flags = cmdmod.split; @@ -8088,7 +8088,7 @@ static void ex_copymove(exarg_T *eap) * move or copy lines from 'eap->line1'-'eap->line2' to below line 'n' */ if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count) { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); return; } @@ -8254,7 +8254,7 @@ static void ex_later(exarg_T *eap) } if (*p != NUL) { - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } else { undo_time(eap->cmdidx == CMD_earlier ? -count : count, sec, file, false); @@ -8315,7 +8315,7 @@ static void ex_redir(exarg_T *eap) } if (*arg != NUL) { redir_reg = 0; - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } } else if (*arg == '=' && arg[1] == '>') { int append; @@ -8337,7 +8337,7 @@ static void ex_redir(exarg_T *eap) } // TODO: redirect to a buffer else { - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } } @@ -8446,7 +8446,7 @@ int vim_mkdir_emsg(const char *const name, const int prot) { int ret; if ((ret = os_mkdir(name, prot)) != 0) { - EMSG3(_(e_mkdir), name, os_strerror(ret)); + semsg(_(e_mkdir), name, os_strerror(ret)); return FAIL; } return OK; @@ -8464,17 +8464,17 @@ FILE *open_exfile(char_u *fname, int forceit, char *mode) #ifdef UNIX // with Unix it is possible to open a directory if (os_isdir(fname)) { - EMSG2(_(e_isadir2), fname); + semsg(_(e_isadir2), fname); return NULL; } #endif if (!forceit && *mode != 'a' && os_path_exists(fname)) { - EMSG2(_("E189: \"%s\" exists (add ! to override)"), fname); + semsg(_("E189: \"%s\" exists (add ! to override)"), fname); return NULL; } if ((fd = os_fopen((char *)fname, mode)) == NULL) { - EMSG2(_("E190: Cannot open \"%s\" for writing"), fname); + semsg(_("E190: Cannot open \"%s\" for writing"), fname); } return fd; @@ -8488,15 +8488,15 @@ static void ex_mark(exarg_T *eap) pos_T pos; if (*eap->arg == NUL) { // No argument? - EMSG(_(e_argreq)); + emsg(_(e_argreq)); } else if (eap->arg[1] != NUL) { // more than one character? - EMSG(_(e_trailing)); + emsg(_(e_trailing)); } else { pos = curwin->w_cursor; // save curwin->w_cursor curwin->w_cursor.lnum = eap->line2; beginline(BL_WHITE | BL_FIX); if (setmark(*eap->arg) == FAIL) { // set mark - EMSG(_("E191: Argument must be a letter or forward/backward quote")); + emsg(_("E191: Argument must be a letter or forward/backward quote")); } curwin->w_cursor = pos; // restore curwin->w_cursor } @@ -8574,7 +8574,7 @@ void restore_current_state(save_state_T *sst) static void ex_normal(exarg_T *eap) { if (curbuf->terminal && State & TERM_FOCUS) { - EMSG("Can't re-enter normal mode from terminal mode"); + emsg("Can't re-enter normal mode from terminal mode"); return; } save_state_T save_state; @@ -8583,11 +8583,11 @@ static void ex_normal(exarg_T *eap) char_u *p; if (ex_normal_lock > 0) { - EMSG(_(e_secure)); + emsg(_(e_secure)); return; } if (ex_normal_busy >= p_mmd) { - EMSG(_("E192: Recursive use of :normal too deep")); + emsg(_("E192: Recursive use of :normal too deep")); return; } @@ -8984,7 +8984,7 @@ ssize_t find_cmdline_var(const char_u *src, size_t *usedlen) /// Returns NULL if no match was found. "usedlen" then still contains the /// number of characters to skip. char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnump, - char_u **errormsg, int *escaped) + char **errormsg, int *escaped) { int i; char_u *s; @@ -9034,7 +9034,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum ? (FIND_IDENT | FIND_STRING | FIND_EVAL) : FIND_STRING)); if (resultlen == 0) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } // @@ -9087,7 +9087,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum result = (char_u *)tv_list_find_str(get_vim_var_list(VV_OLDFILES), i - 1); if (result == NULL) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } } else { @@ -9096,7 +9096,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum } buf = buflist_findnr(i); if (buf == NULL) { - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); + *errormsg = _("E194: No alternate file name to substitute for '#'"); return NULL; } if (lnump != NULL) { @@ -9115,7 +9115,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum case SPEC_CFILE: // file name under cursor result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); if (result == NULL) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } resultbuf = result; // remember allocated string @@ -9135,7 +9135,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum } result = autocmd_fname; if (result == NULL) { - *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\""); + *errormsg = _("E495: no autocommand file name to substitute for \"<afile>\""); return NULL; } result = path_try_shorten_fname(result); @@ -9143,7 +9143,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum case SPEC_ABUF: // buffer number for autocommand if (autocmd_bufnr <= 0) { - *errormsg = (char_u *)_("E496: no autocommand buffer number to substitute for \"<abuf>\""); + *errormsg = _("E496: no autocommand buffer number to substitute for \"<abuf>\""); return NULL; } snprintf(strbuf, sizeof(strbuf), "%d", autocmd_bufnr); @@ -9153,7 +9153,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum case SPEC_AMATCH: // match name for autocommand result = autocmd_match; if (result == NULL) { - *errormsg = (char_u *)_("E497: no autocommand match name to substitute for \"<amatch>\""); + *errormsg = _("E497: no autocommand match name to substitute for \"<amatch>\""); return NULL; } break; @@ -9161,14 +9161,14 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum case SPEC_SFILE: // file name for ":so" command result = sourcing_name; if (result == NULL) { - *errormsg = (char_u *)_("E498: no :source file name to substitute for \"<sfile>\""); + *errormsg = _("E498: no :source file name to substitute for \"<sfile>\""); return NULL; } break; case SPEC_SLNUM: // line in file for ":so" command if (sourcing_name == NULL || sourcing_lnum == 0) { - *errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\""); + *errormsg = _("E842: no line number to use for \"<slnum>\""); return NULL; } snprintf(strbuf, sizeof(strbuf), "%" PRIdLINENR, sourcing_lnum); @@ -9177,7 +9177,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum case SPEC_SFLNUM: // line in script file if (current_sctx.sc_lnum + sourcing_lnum == 0) { - *errormsg = (char_u *)_("E961: no line number to use for \"<sflnum>\""); + *errormsg = _("E961: no line number to use for \"<sflnum>\""); return NULL; } snprintf((char *)strbuf, sizeof(strbuf), "%" PRIdLINENR, @@ -9187,7 +9187,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum case SPEC_SID: if (current_sctx.sc_sid <= 0) { - *errormsg = (char_u *)_(e_usingsid); + *errormsg = _(e_usingsid); return NULL; } snprintf(strbuf, sizeof(strbuf), "<SNR>%" PRIdSCID "_", @@ -9197,7 +9197,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum default: // should not happen - *errormsg = (char_u *)""; + *errormsg = ""; result = (char_u *)""; // avoid gcc warning break; } @@ -9214,7 +9214,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum valid |= modify_fname(src, tilde_file, usedlen, &result, &resultbuf, &resultlen); if (result == NULL) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } } @@ -9223,9 +9223,9 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH) { if (valid != VALID_HEAD + VALID_PATH) { // xgettext:no-c-format - *errormsg = (char_u *)_("E499: Empty file name for '%' or '#', only works with \":p:h\""); + *errormsg = _("E499: Empty file name for '%' or '#', only works with \":p:h\""); } else { - *errormsg = (char_u *)_("E500: Evaluates to an empty string"); + *errormsg = _("E500: Evaluates to an empty string"); } result = NULL; } else { @@ -9305,7 +9305,7 @@ static char_u *arg_all(void) */ char_u *expand_sfile(char_u *arg) { - char_u *errormsg; + char *errormsg; size_t len; char_u *result; char_u *newres; @@ -9395,7 +9395,7 @@ static void ex_behave(exarg_T *eap) set_option_value("mousemodel", 0L, "extend", 0); set_option_value("keymodel", 0L, "", 0); } else { - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } } @@ -9506,7 +9506,7 @@ static void ex_filetype(exarg_T *eap) filetype_detect = kFalse; } } else { - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); } } @@ -9594,7 +9594,7 @@ static void ex_match(exarg_T *eap) if (eap->line2 <= 3) { id = eap->line2; } else { - EMSG(e_invcmd); + emsg(e_invcmd); return; } @@ -9617,7 +9617,7 @@ static void ex_match(exarg_T *eap) if (*p == NUL) { // There must be two arguments. xfree(g); - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); return; } end = skip_regexp(p + 1, *p, true, NULL); @@ -9629,7 +9629,7 @@ static void ex_match(exarg_T *eap) } if (*end != *p) { xfree(g); - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); return; } @@ -9707,7 +9707,7 @@ static void ex_terminal(exarg_T *eap) xfree(name); } else { // No {cmd}: run the job with tokenized 'shell'. if (*p_sh == NUL) { - EMSG(_(e_shellempty)); + emsg(_(e_shellempty)); return; } |