Improve gettext support. Stylistic fixes and error handling fixes while

on it.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-08 19:26:01 +01:00
parent 215c90cb82
commit 9c4b5c13e6
184 changed files with 1175 additions and 959 deletions

View file

@ -182,8 +182,9 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
if (grub_file_read (file, bs, GRUB_DISK_SECTOR_SIZE)
!= GRUB_DISK_SECTOR_SIZE)
{
if (grub_errno == GRUB_ERR_NONE)
grub_error (GRUB_ERR_BAD_OS, "too small");
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
filename);
goto fail;
}
@ -270,9 +271,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
else
grub_chainloader_cmd (argv[0], flags);
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_chainloader_cmd (argv[0], flags);
return grub_errno;
}

View file

@ -83,7 +83,7 @@ grub_cmd_freedos (grub_command_t cmd __attribute__ ((unused)),
grub_size_t kernelsyssize;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);

View file

@ -98,7 +98,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (argc == 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
@ -109,7 +109,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
{
if (!grub_errno)
grub_error (GRUB_ERR_READ_ERROR, N_("premature end of file %s"),
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
@ -286,7 +286,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (grub_file_read (file, grub_linux_real_chunk + sizeof (lh), len) != len)
{
if (!grub_errno)
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
@ -326,7 +326,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
len = grub_linux16_prot_size;
if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size)
!= (grub_ssize_t) grub_linux16_prot_size && !grub_errno)
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
if (grub_errno == GRUB_ERR_NONE)
@ -366,13 +366,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
if (argc == 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
goto fail;
}
if (!loaded)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first"));
goto fail;
}

View file

@ -82,7 +82,7 @@ grub_cmd_ntldr (grub_command_t cmd __attribute__ ((unused)),
grub_device_t dev;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);

View file

@ -340,7 +340,7 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
}
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);
@ -384,7 +384,12 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
goto fail;
if (grub_file_read (file, &hdr, sizeof (hdr)) != (grub_ssize_t) sizeof (hdr))
goto fail;
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
if (grub_be_to_cpu32 (hdr.magic) != GRUB_PLAN9_MAGIC
|| hdr.zero)
@ -462,7 +467,12 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (grub_file_read (file, ptr, grub_be_to_cpu32 (hdr.text_size))
!= (grub_ssize_t) grub_be_to_cpu32 (hdr.text_size))
goto fail;
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
ptr += grub_be_to_cpu32 (hdr.text_size);
padsize = ALIGN_UP (grub_be_to_cpu32 (hdr.text_size) + sizeof (hdr),
GRUB_PLAN9_ALIGN) - grub_be_to_cpu32 (hdr.text_size)
@ -473,7 +483,12 @@ grub_cmd_plan9 (grub_extcmd_context_t ctxt, int argc, char *argv[])
if (grub_file_read (file, ptr, grub_be_to_cpu32 (hdr.data_size))
!= (grub_ssize_t) grub_be_to_cpu32 (hdr.data_size))
goto fail;
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);
goto fail;
}
ptr += grub_be_to_cpu32 (hdr.data_size);
padsize = ALIGN_UP (grub_be_to_cpu32 (hdr.data_size), GRUB_PLAN9_ALIGN)
- grub_be_to_cpu32 (hdr.data_size);

View file

@ -91,7 +91,7 @@ grub_cmd_pxechain (grub_command_t cmd __attribute__ ((unused)),
char *fname;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_dl_ref (my_mod);