main: Translate full -s error message, not part of it

This commit is contained in:
ZyX
2017-03-19 19:28:16 +03:00
parent ae4fae9d3e
commit ca116df260
2 changed files with 12 additions and 16 deletions

View File

@@ -1049,11 +1049,10 @@ static void command_line_scan(mparm_T *parmp)
case 's': /* "-s {scriptin}" read from script file */
if (scriptin[0] != NULL) {
scripterror:
mch_errmsg(_("Attempt to open script file again: \""));
mch_errmsg(argv[-1]);
mch_errmsg(" ");
mch_errmsg(argv[0]);
mch_errmsg("\"\n");
vim_snprintf((char *)IObuff, IOSIZE,
_("Attempt to open script file again: \"%s %s\"\n"),
argv[-1], argv[0]);
mch_errmsg((const char *)IObuff);
mch_exit(2);
}
int error;
@@ -1065,11 +1064,10 @@ scripterror:
scriptin[0] = stdin_dup;
} else if ((scriptin[0] = file_open_new(
&error, argv[0], kFileReadOnly|kFileNonBlocking, 0)) == NULL) {
mch_errmsg(_("Cannot open for reading: \""));
mch_errmsg(argv[0]);
mch_errmsg("\": ");
mch_errmsg(os_strerror(error));
mch_errmsg("\n");
vim_snprintf((char *)IObuff, IOSIZE,
_("Cannot open for reading: \"%s\": %s\n"),
argv[0], os_strerror(error));
mch_errmsg((const char *)IObuff);
mch_exit(2);
}
save_typebuf();

View File

@@ -2245,10 +2245,9 @@ static int do_more_prompt(int typed_char)
* yet. When stderr can't be used, collect error messages until the GUI has
* started and they can be displayed in a message box.
*/
void mch_errmsg(char *str)
void mch_errmsg(const char *const str)
FUNC_ATTR_NONNULL_ALL
{
int len;
#ifdef UNIX
/* On Unix use stderr if it's a tty.
* When not going to start the GUI also use stderr.
@@ -2262,14 +2261,13 @@ void mch_errmsg(char *str)
/* avoid a delay for a message that isn't there */
emsg_on_display = FALSE;
len = (int)STRLEN(str) + 1;
const size_t len = strlen(str) + 1;
if (error_ga.ga_data == NULL) {
ga_set_growsize(&error_ga, 80);
error_ga.ga_itemsize = 1;
}
ga_grow(&error_ga, len);
memmove((char_u *)error_ga.ga_data + error_ga.ga_len,
(char_u *)str, len);
memmove(error_ga.ga_data + error_ga.ga_len, str, len);
#ifdef UNIX
/* remove CR characters, they are displayed */
{