mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
main: Translate full -s error message, not part of it
This commit is contained in:
@@ -1049,11 +1049,10 @@ static void command_line_scan(mparm_T *parmp)
|
|||||||
case 's': /* "-s {scriptin}" read from script file */
|
case 's': /* "-s {scriptin}" read from script file */
|
||||||
if (scriptin[0] != NULL) {
|
if (scriptin[0] != NULL) {
|
||||||
scripterror:
|
scripterror:
|
||||||
mch_errmsg(_("Attempt to open script file again: \""));
|
vim_snprintf((char *)IObuff, IOSIZE,
|
||||||
mch_errmsg(argv[-1]);
|
_("Attempt to open script file again: \"%s %s\"\n"),
|
||||||
mch_errmsg(" ");
|
argv[-1], argv[0]);
|
||||||
mch_errmsg(argv[0]);
|
mch_errmsg((const char *)IObuff);
|
||||||
mch_errmsg("\"\n");
|
|
||||||
mch_exit(2);
|
mch_exit(2);
|
||||||
}
|
}
|
||||||
int error;
|
int error;
|
||||||
@@ -1065,11 +1064,10 @@ scripterror:
|
|||||||
scriptin[0] = stdin_dup;
|
scriptin[0] = stdin_dup;
|
||||||
} else if ((scriptin[0] = file_open_new(
|
} else if ((scriptin[0] = file_open_new(
|
||||||
&error, argv[0], kFileReadOnly|kFileNonBlocking, 0)) == NULL) {
|
&error, argv[0], kFileReadOnly|kFileNonBlocking, 0)) == NULL) {
|
||||||
mch_errmsg(_("Cannot open for reading: \""));
|
vim_snprintf((char *)IObuff, IOSIZE,
|
||||||
mch_errmsg(argv[0]);
|
_("Cannot open for reading: \"%s\": %s\n"),
|
||||||
mch_errmsg("\": ");
|
argv[0], os_strerror(error));
|
||||||
mch_errmsg(os_strerror(error));
|
mch_errmsg((const char *)IObuff);
|
||||||
mch_errmsg("\n");
|
|
||||||
mch_exit(2);
|
mch_exit(2);
|
||||||
}
|
}
|
||||||
save_typebuf();
|
save_typebuf();
|
||||||
|
@@ -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
|
* yet. When stderr can't be used, collect error messages until the GUI has
|
||||||
* started and they can be displayed in a message box.
|
* 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
|
#ifdef UNIX
|
||||||
/* On Unix use stderr if it's a tty.
|
/* On Unix use stderr if it's a tty.
|
||||||
* When not going to start the GUI also use stderr.
|
* 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 */
|
/* avoid a delay for a message that isn't there */
|
||||||
emsg_on_display = FALSE;
|
emsg_on_display = FALSE;
|
||||||
|
|
||||||
len = (int)STRLEN(str) + 1;
|
const size_t len = strlen(str) + 1;
|
||||||
if (error_ga.ga_data == NULL) {
|
if (error_ga.ga_data == NULL) {
|
||||||
ga_set_growsize(&error_ga, 80);
|
ga_set_growsize(&error_ga, 80);
|
||||||
error_ga.ga_itemsize = 1;
|
error_ga.ga_itemsize = 1;
|
||||||
}
|
}
|
||||||
ga_grow(&error_ga, len);
|
ga_grow(&error_ga, len);
|
||||||
memmove((char_u *)error_ga.ga_data + error_ga.ga_len,
|
memmove(error_ga.ga_data + error_ga.ga_len, str, len);
|
||||||
(char_u *)str, len);
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
/* remove CR characters, they are displayed */
|
/* remove CR characters, they are displayed */
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user