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

@ -66,7 +66,7 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
etherpro = GRUB_NET_ETHERTYPE_IP;
}
else
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "unsupported address family");
return grub_error (GRUB_ERR_BUG, "unsupported address family");
/* Build a request packet. */
nb.head = arp_data;

View file

@ -310,7 +310,7 @@ grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
if (!inter)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("unrecognised interface %s"), args[1]);
N_("unrecognised network interface `%s'"), args[1]);
if (!inter->dhcp_ack)
return grub_error (GRUB_ERR_IO, N_("no DHCP info found"));

View file

@ -602,7 +602,7 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)),
grub_size_t naddresses, i;
struct grub_net_network_level_address *addresses;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "2 arguments expected");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected"));
err = grub_net_resolve_address (args[1], &server);
if (err)
return err;
@ -643,7 +643,7 @@ grub_cmd_add_dns (struct grub_command *cmd __attribute__ ((unused)),
struct grub_net_network_level_address server;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "1 argument expected");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
err = grub_net_resolve_address (args[0], &server);
if (err)
return err;
@ -659,7 +659,7 @@ grub_cmd_del_dns (struct grub_command *cmd __attribute__ ((unused)),
struct grub_net_network_level_address server;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "1 argument expected");
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
err = grub_net_resolve_address (args[1], &server);
if (err)
return err;

View file

@ -22,6 +22,7 @@
#include <grub/time.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -39,17 +40,17 @@ send_card_buffer (const struct grub_net_card *dev,
st = efi_call_7 (net->transmit, net, 0, (pack->tail - pack->data),
pack->data, NULL, NULL, NULL);
if (st != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_IO, "couldn't send network packet");
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
while (1)
{
void *txbuf = NULL;
st = efi_call_3 (net->get_status, net, 0, &txbuf);
if (st != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_IO, "couldn't send network packet");
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
if (txbuf)
return GRUB_ERR_NONE;
if (limit_time < grub_get_time_ms ())
return grub_error (GRUB_ERR_TIMEOUT, "couldn't send network packet");
return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet"));
}
}

View file

@ -27,6 +27,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <grub/term.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -40,7 +41,7 @@ send_card_buffer (const struct grub_net_card *dev __attribute__ ((unused)),
actual = write (fd, pack->data, pack->tail - pack->data);
if (actual < 0)
return grub_error (GRUB_ERR_IO, "couldn't send packets");
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
return GRUB_ERR_NONE;
}

View file

@ -23,6 +23,7 @@
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/i18n.h>
#include <grub/machine/pxe.h>
#include <grub/machine/int.h>
@ -269,8 +270,7 @@ grub_pxe_send (const struct grub_net_card *dev __attribute__ ((unused)),
grub_pxe_call (GRUB_PXENV_UNDI_TRANSMIT, trans, pxe_rm_entry);
if (trans->status)
return grub_error (GRUB_ERR_IO, "PXE send failed (status 0x%x)",
trans->status);
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
return 0;
}

View file

@ -21,6 +21,7 @@
#include <grub/dl.h>
#include <grub/net.h>
#include <grub/time.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -69,7 +70,7 @@ send_card_buffer (const struct grub_net_card *dev, struct grub_net_buff *pack)
pack->tail - pack->data, &actual);
if (status)
return grub_error (GRUB_ERR_IO, "Couldn't send network packet.");
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
return GRUB_ERR_NONE;
}

View file

@ -25,6 +25,7 @@
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/file.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -400,7 +401,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
grub_free (str);
return data->err;
}
return grub_error (GRUB_ERR_TIMEOUT, "timeout opening http");
return grub_error (GRUB_ERR_TIMEOUT, N_("time out opening `%s'"), data->filename);
}
return GRUB_ERR_NONE;
}

View file

@ -620,7 +620,7 @@ grub_net_send_ip_packet (struct grub_net_network_level_interface *inf,
case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6:
return grub_net_send_ip6_packet (inf, target, ll_target_addr, nb, proto);
default:
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not an IP");
return grub_error (GRUB_ERR_BUG, "not an IP");
}
}

View file

@ -179,7 +179,7 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV:
return grub_error (GRUB_ERR_BUG, "shouldn't reach here");
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
return grub_error (GRUB_ERR_BUG,
"unsupported address type %d", proto_addr->type);
}
if (err)
@ -563,7 +563,8 @@ grub_net_resolve_net_address (const char *name,
return GRUB_ERR_NONE;
}
}
return grub_error (GRUB_ERR_NET_BAD_ADDRESS, N_("unrecognised address %s"),
return grub_error (GRUB_ERR_NET_BAD_ADDRESS,
N_("unrecognised network address `%s'"),
name);
}
@ -1002,7 +1003,7 @@ grub_cmd_addroute (struct grub_command *cmd __attribute__ ((unused)),
grub_net_network_level_netaddress_t target;
if (argc < 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("At least 3 arguments are expected"));
N_("three arguments expected"));
grub_net_resolve_net_address (args[1], &target);
@ -1026,7 +1027,7 @@ grub_cmd_addroute (struct grub_command *cmd __attribute__ ((unused)),
if (!inter)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
N_("unrecognised interface %s"), args[2]);
N_("unrecognised network interface `%s'"), args[2]);
return grub_net_add_route (args[0], target, inter);
}
}
@ -1208,7 +1209,7 @@ grub_net_fs_dir (grub_device_t device, const char *path __attribute__ ((unused))
const struct grub_dirhook_info *info) __attribute__ ((unused)))
{
if (!device->net)
return grub_error (GRUB_ERR_BAD_FS, "invalid extent");
return grub_error (GRUB_ERR_BUG, "invalid net device");
return GRUB_ERR_NONE;
}

View file

@ -26,7 +26,7 @@ grub_netbuff_put (struct grub_net_buff *nb, grub_size_t len)
{
nb->tail += len;
if (nb->tail > nb->end)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "put out of the packet range.");
return grub_error (GRUB_ERR_BUG, "put out of the packet range.");
return GRUB_ERR_NONE;
}
@ -35,7 +35,7 @@ grub_netbuff_unput (struct grub_net_buff *nb, grub_size_t len)
{
nb->tail -= len;
if (nb->tail < nb->head)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
return grub_error (GRUB_ERR_BUG,
"unput out of the packet range.");
return GRUB_ERR_NONE;
}
@ -45,7 +45,7 @@ grub_netbuff_push (struct grub_net_buff *nb, grub_size_t len)
{
nb->data -= len;
if (nb->data < nb->head)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
return grub_error (GRUB_ERR_BUG,
"push out of the packet range.");
return GRUB_ERR_NONE;
}
@ -55,7 +55,7 @@ grub_netbuff_pull (struct grub_net_buff *nb, grub_size_t len)
{
nb->data += len;
if (nb->data > nb->end)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
return grub_error (GRUB_ERR_BUG,
"pull out of the packet range.");
return GRUB_ERR_NONE;
}
@ -66,7 +66,7 @@ grub_netbuff_reserve (struct grub_net_buff *nb, grub_size_t len)
nb->data += len;
nb->tail += len;
if ((nb->tail > nb->end) || (nb->data > nb->end))
return grub_error (GRUB_ERR_OUT_OF_RANGE,
return grub_error (GRUB_ERR_BUG,
"reserve out of the packet range.");
return GRUB_ERR_NONE;
}

View file

@ -565,7 +565,7 @@ grub_net_tcp_open (char *server,
if (addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
&& addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "not an IP address");
grub_error (GRUB_ERR_BUG, "not an IP address");
return NULL;
}

View file

@ -26,6 +26,7 @@
#include <grub/dl.h>
#include <grub/file.h>
#include <grub/priority_queue.h>
#include <grub/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -373,7 +374,7 @@ tftp_open (struct grub_file *file, const char *filename)
}
if (!data->have_oack)
grub_error (GRUB_ERR_TIMEOUT, "Time out opening tftp.");
grub_error (GRUB_ERR_TIMEOUT, N_("time out opening `%s'"), filename);
else
grub_error_load (&data->save_err);
if (grub_errno)

View file

@ -76,7 +76,7 @@ grub_net_udp_open (grub_net_network_level_address_t addr,
if (addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4
&& addr.type != GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "not an IP address");
grub_error (GRUB_ERR_BUG, "not an IP address");
return NULL;
}