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

@ -30,11 +30,11 @@ parse_args (int argc, char *argv[], int *byte, int *bit)
char *rest;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
*byte = grub_strtoul (argv[0], &rest, 0);
if (*rest != ':')
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required");
*bit = grub_strtoul (rest + 1, 0, 0);

View file

@ -107,8 +107,7 @@ drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
{
mapping = grub_malloc (sizeof (drivemap_node_t));
if (! mapping)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"cannot allocate map entry, not enough memory");
return grub_errno;
mapping->newdrive = newdrive;
mapping->redirto = redirto;
mapping->next = map_head;
@ -230,7 +229,7 @@ grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
grub_err_t err;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
err = tryparse_diskstring (args[0], &mapfrom);
if (err != GRUB_ERR_NONE)

View file

@ -74,7 +74,7 @@ grub_cmd_lsapm (grub_command_t cmd __attribute__ ((unused)),
if (!grub_apm_get_info (&info))
return grub_error (GRUB_ERR_IO, "no APM found");
grub_printf_ (N_("Vesion %u.%u\n"
grub_printf_ (N_("Version %u.%u\n"
"32-bit CS = 0x%x, len = 0x%x, offset = 0x%x\n"
"16-bit CS = 0x%x, len = 0x%x\n"
"DS = 0x%x, len = 0x%x\n"),

View file

@ -192,13 +192,15 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
file = grub_file_open (args[0]);
if (! file)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
return grub_errno;
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{
grub_file_close (file);
return grub_error (GRUB_ERR_FILE_READ_ERROR,
"file doesn't even contains a full tempo record");
if (!grub_errno)
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
args[0]);
return grub_errno;
}
tempo = grub_le_to_cpu32 (tempo);
@ -227,7 +229,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
if (*end)
/* Was not a number either, assume it was supposed to be a file name. */
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);
grub_dprintf ("play","tempo = %d\n", tempo);