summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomohiro "Tomo-p" KATO <tomop@teamgedoh.net>2018-02-23 20:29:32 +0900
committerSami Kerola <kerolasa@iki.fi>2018-12-17 22:42:56 +0000
commitaeec6a0a5247a2526306479f57f987bf6c09f3d8 (patch)
tree45de99ef621fc3e01af8bb0b5f80cfc59667d889
parent2f9e92b9c971d480e00c011d9b75220c5f60b5b8 (diff)
downloadiputils-aeec6a0a5247a2526306479f57f987bf6c09f3d8.tar.gz
localization: arping, ping, ping6, tracepath and traceroute6
-rw-r--r--arping.c76
-rw-r--r--clockdiff.c37
-rw-r--r--meson.build11
-rw-r--r--meson_options.txt3
-rw-r--r--ping.c227
-rw-r--r--ping.h16
-rw-r--r--ping6_common.c156
-rw-r--r--ping_common.c65
-rw-r--r--po/LINGUAS2
-rw-r--r--po/POTFILES7
-rw-r--r--po/iputils.pot1548
-rw-r--r--po/meson.build3
-rw-r--r--tracepath.c70
-rw-r--r--traceroute6.c102
14 files changed, 1993 insertions, 330 deletions
diff --git a/arping.c b/arping.c
index 788933e..ca85fc5 100644
--- a/arping.c
+++ b/arping.c
@@ -42,8 +42,22 @@
# include <sys/types.h>
#endif
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# undef bindtextdomain
+# define bindtextdomain(Domain, Directory) /* empty */
+# undef textdomain
+# define textdomain(Domain) /* empty */
+# define _(Text) Text
+#endif
+
+#ifdef USE_IDN
# ifndef AI_IDN
# define AI_IDN 0x0040
# endif
@@ -173,7 +187,7 @@ __attribute__((const)) static inline size_t sll_len(const size_t halen)
static void usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, _(
"\nUsage:\n"
" arping [options] <destination>\n"
"\nOptions:\n"
@@ -188,14 +202,16 @@ static void usage(void)
" -w <timeout> how long to wait for a reply\n"
" -i <interval> set interval between packets (default: 1 second)\n"
" -I <device> which ethernet device to use"
+ ));
#ifdef DEFAULT_DEVICE_STR
- "(" DEFAULT_DEVICE_STR ")"
+ fprintf(stderr, "(" DEFAULT_DEVICE_STR ")");
#endif
+ fprintf(stderr, _(
"\n"
" -s <source> source ip address\n"
" <destination> dns name or ip address\n"
"\nFor more details see arping(8).\n"
- );
+ ));
exit(2);
}
@@ -366,14 +382,14 @@ static int send_pack(struct run_state *ctl)
static int finish(struct run_state *ctl)
{
if (!ctl->quiet) {
- printf("Sent %d probes (%d broadcast(s))\n", ctl->sent, ctl->brd_sent);
- printf("Received %d response(s)", ctl->received);
+ printf(_("Sent %d probes (%d broadcast(s))\n"), ctl->sent, ctl->brd_sent);
+ printf(_("Received %d response(s)"), ctl->received);
if (ctl->brd_recv || ctl->req_recv) {
printf(" (");
if (ctl->req_recv)
- printf("%d request(s)", ctl->req_recv);
+ printf(_("%d request(s)"), ctl->req_recv);
if (ctl->brd_recv)
- printf("%s%d broadcast(s)",
+ printf(_("%s%d broadcast(s)"),
ctl->req_recv ? ", " : "",
ctl->brd_recv);
printf(")");
@@ -468,18 +484,18 @@ static int recv_pack(struct run_state *ctl, unsigned char *buf, ssize_t len,
}
if (!ctl->quiet) {
int s_printed = 0;
- printf("%s ", FROM->sll_pkttype == PACKET_HOST ? "Unicast" : "Broadcast");
- printf("%s from ", ah->ar_op == htons(ARPOP_REPLY) ? "reply" : "request");
+ printf("%s ", FROM->sll_pkttype == PACKET_HOST ? _("Unicast") : _("Broadcast"));
+ printf(_("%s from "), ah->ar_op == htons(ARPOP_REPLY) ? _("reply") : _("request"));
printf("%s [", inet_ntoa(src_ip));
print_hex(p, ah->ar_hln);
printf("] ");
if (dst_ip.s_addr != ctl->gsrc.s_addr) {
- printf("for %s ", inet_ntoa(dst_ip));
+ printf(_("for %s "), inet_ntoa(dst_ip));
s_printed = 1;
}
if (memcmp(p + ah->ar_hln + 4, ((struct sockaddr_ll *)&ctl->me)->sll_addr, ah->ar_hln)) {
if (!s_printed)
- printf("for ");
+ printf(_("for "));
printf("[");
print_hex(p + ah->ar_hln + 4, ah->ar_hln);
printf("]");
@@ -489,9 +505,9 @@ static int recv_pack(struct run_state *ctl, unsigned char *buf, ssize_t len,
(ts.tv_nsec - ctl->last.tv_nsec + 500) / 1000;
long msecs = (usecs + 500) / 1000;
usecs -= msecs * 1000 - 500;
- printf(" %ld.%03ldms\n", msecs, usecs);
+ printf(_(" %ld.%03ldms\n"), msecs, usecs);
} else {
- printf(" UNSOLICITED?\n");
+ printf(_(" UNSOLICITED?\n"));
}
fflush(stdout);
}
@@ -543,7 +559,7 @@ static int check_ifflags(struct run_state const *const ctl, unsigned int ifflags
if (!(ifflags & IFF_UP)) {
if (ctl->device.name != NULL) {
if (!ctl->quiet)
- printf("Interface \"%s\" is down\n", ctl->device.name);
+ printf(_("Interface \"%s\" is down\n"), ctl->device.name);
exit(2);
}
return -1;
@@ -551,7 +567,7 @@ static int check_ifflags(struct run_state const *const ctl, unsigned int ifflags
if (ifflags & (IFF_NOARP | IFF_LOOPBACK)) {
if (ctl->device.name != NULL) {
if (!ctl->quiet)
- printf("Interface \"%s\" is not ARPable\n", ctl->device.name);
+ printf(_("Interface \"%s\" is not ARPable\n"), ctl->device.name);
exit(ctl->dad ? 0 : 2);
}
return -1;
@@ -833,7 +849,7 @@ static int find_device_by_ioctl(struct run_state *ctl)
} while (ifrsize < INT_MAX / 2);
if (!ifr0) {
- fprintf(stderr, "arping: too many interfaces!?\n");
+ fprintf(stderr, _("arping: too many interfaces!?\n"));
goto out;
}
@@ -900,7 +916,7 @@ static void set_device_broadcast(struct run_state *ctl)
}
#endif
if (!ctl->quiet)
- fprintf(stderr, "WARNING: using default broadcast address.\n");
+ fprintf(stderr, _("WARNING: using default broadcast address.\n"));
memset(he->sll_addr, -1, he->sll_halen);
}
@@ -1063,8 +1079,12 @@ int main(int argc, char **argv)
int ch;
limit_capabilities(&ctl);
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
setlocale(LC_ALL, "");
+#ifdef ENABLE_NLS
+ bindtextdomain (PACKAGE_NAME, LOCALEDIR);
+ textdomain (PACKAGE_NAME);
+#endif
#endif
enable_capability_raw(&ctl);
@@ -1141,10 +1161,10 @@ int main(int argc, char **argv)
if (!ctl.device.ifindex) {
if (ctl.device.name) {
- fprintf(stderr, "arping: Device %s not available.\n", ctl.device.name);
+ fprintf(stderr, _("arping: Device %s not available.\n"), ctl.device.name);
exit(2);
}
- fprintf(stderr, "arping: Suitable device could not be determined. Please, use option -I.\n");
+ fprintf(stderr, _("arping: Suitable device could not be determined. Please, use option -I.\n"));
usage();
}
@@ -1170,7 +1190,7 @@ int main(int argc, char **argv)
}
if (ctl.source && inet_aton(ctl.source, &ctl.gsrc) != 1) {
- fprintf(stderr, "arping: invalid source %s\n", ctl.source);
+ fprintf(stderr, _("arping: invalid source %s\n"), ctl.source);
exit(2);
}
@@ -1190,7 +1210,7 @@ int main(int argc, char **argv)
if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, ctl.device.name,
strlen(ctl.device.name) + 1) == -1)
- perror("WARNING: interface is ignored");
+ perror(_("WARNING: interface is ignored"));
disable_capability_raw(&ctl);
}
@@ -1210,7 +1230,7 @@ int main(int argc, char **argv)
saddr.sin_addr = ctl.gdst;
if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)) == -1)
- perror("WARNING: setsockopt(SO_DONTROUTE)");
+ perror(_("WARNING: setsockopt(SO_DONTROUTE)"));
if (connect(probe_fd, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) {
perror("connect");
exit(2);
@@ -1242,7 +1262,7 @@ int main(int argc, char **argv)
}
if (((struct sockaddr_ll *)&ctl.me)->sll_halen == 0) {
if (!ctl.quiet)
- printf("Interface \"%s\" is not ARPable (no ll address)\n", ctl.device.name);
+ printf(_("Interface \"%s\" is not ARPable (no ll address)\n"), ctl.device.name);
exit(ctl.dad ? 0 : 2);
}
@@ -1251,12 +1271,12 @@ int main(int argc, char **argv)
set_device_broadcast(&ctl);
if (!ctl.quiet) {
- printf("ARPING %s ", inet_ntoa(ctl.gdst));
- printf("from %s %s\n", inet_ntoa(ctl.gsrc), ctl.device.name ? ctl.device.name : "");
+ printf(_("ARPING %s "), inet_ntoa(ctl.gdst));
+ printf(_("from %s %s\n"), inet_ntoa(ctl.gsrc), ctl.device.name ? ctl.device.name : "");
}
if (!ctl.source && !ctl.gsrc.s_addr && !ctl.dad) {
- fprintf(stderr, "arping: no source address in not-DAD mode\n");
+ fprintf(stderr, _("arping: no source address in not-DAD mode\n"));
exit(2);
}
diff --git a/clockdiff.c b/clockdiff.c
index 55dbdf0..9035e1c 100644
--- a/clockdiff.c
+++ b/clockdiff.c
@@ -76,6 +76,21 @@
# include <sys/capability.h>
#endif
+#ifdef ENABLE_NLS
+# include <locale.h>
+#endif
+
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# undef bindtextdomain
+# define bindtextdomain(Domain, Directory) /* empty */
+# undef textdomain
+# define textdomain(Domain) /* empty */
+# define _(Text) Text
+#endif
+
#define MAX_HOSTNAMELEN NI_MAXHOST
enum {
@@ -232,12 +247,12 @@ static int measure_inner_loop(struct run_state *ctl, struct measure_vars *mv)
ctl->acked = mv->icp->un.echo.sequence;
if (ctl->ip_opt_len) {
if ((opt[3] & 0xF) != IPOPT_TS_PRESPEC) {
- fprintf(stderr, "Wrong timestamp %d\n", opt[3] & 0xF);
+ fprintf(stderr, _("Wrong timestamp %d\n"), opt[3] & 0xF);
return NONSTDTIME;
}
if (opt[3] >> 4) {
if ((opt[3] >> 4) != 1 || ctl->ip_opt_len != 4 + 3 * 8)
- fprintf(stderr, "Overflow %d hops\n", opt[3] >> 4);
+ fprintf(stderr, _("Overflow %d hops\n"), opt[3] >> 4);
}
sendtime = recvtime = histime = histime1 = 0;
for (i = 0; i < (opt[2] - 5) / 8; i++) {
@@ -262,7 +277,7 @@ static int measure_inner_loop(struct run_state *ctl, struct measure_vars *mv)
}
if (!(sendtime & histime & histime1 & recvtime)) {
- fprintf(stderr, "wrong timestamps\n");
+ fprintf(stderr, _("wrong timestamps\n"));
return -1;
}
} else {
@@ -430,7 +445,7 @@ static int measure(struct run_state *ctl)
static void usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, _(
"\nUsage:\n"
" clockdiff [options] <destination>\n"
"\nOptions:\n"
@@ -439,7 +454,7 @@ static void usage(void)
" -o1 use three-term ip timestamp and icmp echo\n"
" -V print version and exit\n"
" <destination> dns name or ip address\n"
- "\nFor more details see clockdiff(8).\n");
+ "\nFor more details see clockdiff(8).\n"));
exit(1);
}
@@ -571,7 +586,7 @@ int main(int argc, char **argv)
}
if (setsockopt(ctl.sock_raw, IPPROTO_IP, IP_OPTIONS, rspace, ctl.ip_opt_len) < 0) {
- perror("ping: IP_OPTIONS (fallback to icmp tstamps)");
+ perror(_("ping: IP_OPTIONS (fallback to icmp tstamps)"));
ctl.ip_opt_len = 0;
}
}
@@ -581,19 +596,19 @@ int main(int argc, char **argv)
if (errno)
perror("measure");
else
- fprintf(stderr, "measure: unknown failure\n");
+ fprintf(stderr, _("measure: unknown failure\n"));
exit(1);
}
switch (measure_status) {
case HOSTDOWN:
- fprintf(stderr, "%s is down\n", ctl.hisname);
+ fprintf(stderr, _("%s is down\n"), ctl.hisname);
exit(1);
case NONSTDTIME:
- fprintf(stderr, "%s time transmitted in a non-standard format\n", ctl.hisname);
+ fprintf(stderr, _("%s time transmitted in a non-standard format\n"), ctl.hisname);
exit(1);
case UNREACHABLE:
- fprintf(stderr, "%s is unreachable\n", ctl.hisname);
+ fprintf(stderr, _("%s is unreachable\n"), ctl.hisname);
exit(1);
default:
break;
@@ -603,7 +618,7 @@ int main(int argc, char **argv)
time_t now = time(NULL);
if (ctl.interactive)
- printf("\nhost=%s rtt=%ld(%ld)ms/%ldms delta=%dms/%dms %s",
+ printf(_("\nhost=%s rtt=%ld(%ld)ms/%ldms delta=%dms/%dms %s"),
ctl.hisname, ctl.rtt, ctl.rtt_sigma, ctl.min_rtt,
ctl.measure_delta, ctl.measure_delta1, ctime(&now));
else
diff --git a/meson.build b/meson.build
index 19dbcec..0bc8fb4 100644
--- a/meson.build
+++ b/meson.build
@@ -65,6 +65,17 @@ if opt != ''
conf.set_quoted('DEFAULT_DEVICE', opt, description : 'arping default device.')
endif
+opt = get_option('USE_GETTEXT')
+if opt == true
+ prefix = get_option('prefix')
+ localedir = get_option('localedir')
+ add_project_arguments(['-DGETTEXT_PACKAGE="iputils"'], language: 'c')
+
+ conf.set('ENABLE_NLS', 1, description : 'If set enable I18N.')
+ conf.set_quoted('LOCALEDIR', join_paths(prefix, localedir))
+ subdir ('po')
+endif
+
opt = get_option('USE_SYSFS')
if opt == true
conf.set('USE_SYSFS', 1, description : 'If set use /sys file system.')
diff --git a/meson_options.txt b/meson_options.txt
index 80fce5e..94069a4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -55,3 +55,6 @@ option('USE_SYSFS', type : 'boolean', value : true,
option('systemdunitdir', type: 'string', value: '',
description: 'Directory for systemd units')
+
+option('USE_GETTEXT', type: 'boolean', value: false,
+ description: 'Enable I18N')
diff --git a/ping.c b/ping.c
index 17a3162..697bd75 100644
--- a/ping.c
+++ b/ping.c
@@ -229,10 +229,14 @@ main(int argc, char **argv)
limit_capabilities();
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
setlocale(LC_ALL, "");
if (!strcmp(setlocale(LC_ALL, NULL), "C"))
hints.ai_flags &= ~ AI_CANONIDN;
+#ifdef ENABLE_NLS
+ bindtextdomain (PACKAGE_NAME, LOCALEDIR);
+ textdomain (PACKAGE_NAME);
+#endif
#endif
/* Support being called using `ping4` or `ping6` symlinks */
@@ -247,7 +251,7 @@ main(int argc, char **argv)
/* IPv4 specific options */
case '4':
if (hints.ai_family != AF_UNSPEC)
- error(2, 0, "only one -4 or -6 option may be specified");
+ error(2, 0, _("only one -4 or -6 option may be specified"));
hints.ai_family = AF_INET;
break;
case 'b':
@@ -255,12 +259,12 @@ main(int argc, char **argv)
break;
case 'R':
if (options & F_TIMESTAMP)
- error(2, 0, "only one of -T or -R may be used");
+ error(2, 0, _("only one of -T or -R may be used"));
options |= F_RROUTE;
break;
case 'T':
if (options & F_RROUTE)
- error(2, 0, "only one of -T or -R may be used");
+ error(2, 0, _("only one of -T or -R may be used"));
options |= F_TIMESTAMP;
if (strcmp(optarg, "tsonly") == 0)
ts_type = IPOPT_TS_TSONLY;
@@ -269,12 +273,12 @@ main(int argc, char **argv)
else if (strcmp(optarg, "tsprespec") == 0)
ts_type = IPOPT_TS_PRESPEC;
else
- error(2, 0, "invalid timestamp type: %s", optarg);
+ error(2, 0, _("invalid timestamp type: %s"), optarg);
break;
/* IPv6 specific options */
case '6':
if (hints.ai_family != AF_UNSPEC)
- error(2, 0, "only one -4 or -6 option may be specified");
+ error(2, 0, _("only one -4 or -6 option may be specified"));
hints.ai_family = AF_INET6;
break;
case 'F':
@@ -299,7 +303,7 @@ main(int argc, char **argv)
case 'c':
npackets = atoi(optarg);
if (npackets <= 0)
- error(2, 0, "bad number of packets to transmit: %ld", npackets);
+ error(2, 0, _("bad number of packets to transmit: %ld"), npackets);
break;
case 'd':
options |= F_SO_DEBUG;
@@ -311,9 +315,9 @@ main(int argc, char **argv)
{
double optval;
- optval = ping_strtod(optarg, "bad timing interval");
+ optval = ping_strtod(optarg, _("bad timing interval"));
if (isgreater(optval, (double)(INT_MAX / 1000)))
- error(2, 0, "bad timing interval: %s", optarg);
+ error(2, 0, _("bad timing interval: %s"), optarg);
interval = (int)(optval * 1000);
options |= F_INTERVAL;
}
@@ -324,7 +328,7 @@ main(int argc, char **argv)
char *p, *addr = strdup(optarg);
if (!addr)
- error(2, errno, "cannot copy: %s", optarg);
+ error(2, errno, _("cannot copy: %s"), optarg);
p = strchr(addr, SCOPE_DELIMITER);
if (p) {
@@ -333,7 +337,7 @@ main(int argc, char **argv)
}
if (inet_pton(AF_INET6, addr, (char*)&source6.sin6_addr) <= 0)
- error(2, 0, "invalid source address: %s", optarg);
+ error(2, 0, _("invalid source address: %s"), optarg);
options |= F_STRICTSOURCE;
@@ -347,11 +351,11 @@ main(int argc, char **argv)
case 'l':
preload = atoi(optarg);
if (preload <= 0)
- error(2, 0, "bad preload value: %s, should be 1..%d", optarg, MAX_DUP_CHK);
+ error(2, 0, _("bad preload value: %s, should be 1..%d"), optarg, MAX_DUP_CHK);
if (preload > MAX_DUP_CHK)
preload = MAX_DUP_CHK;
if (uid && preload > 3)
- error(2, 0, "cannot set preload to value greater than 3: %d", preload);
+ error(2, 0, _("cannot set preload to value greater than 3: %d"), preload);
break;
case 'L':
options |= F_NOLOOP;
@@ -361,7 +365,7 @@ main(int argc, char **argv)
char *endp;
mark = (int)strtoul(optarg, &endp, 10);
if (mark < 0 || *endp != '\0')
- error(2, 0, "mark cannot be negative: %s", optarg);
+ error(2, 0, _("mark cannot be negative: %s"), optarg);
options |= F_MARK;
break;
}
@@ -373,7 +377,7 @@ main(int argc, char **argv)
else if (strcmp(optarg, "want") == 0)
pmtudisc = IP_PMTUDISC_WANT;
else
- error(2, 0, "invalid -M argument: %s", optarg);
+ error(2, 0, _("invalid -M argument: %s"), optarg);
break;
case 'n':
options |= F_NUMERIC;
@@ -403,20 +407,20 @@ main(int argc, char **argv)
case 's':
datalen = atoi(optarg);
if (datalen < 0)
- error(2, 0, "illegal packet size: %d", datalen);
+ error(2, 0, _("illegal packet size: %d"), datalen);
if (datalen > MAXPACKET - 8)
- error(2, 0, "packet size too large: %d", datalen);
+ error(2, 0, _("packet size too large: %d"), datalen);
break;
case 'S':
sndbuf = atoi(optarg);
if (sndbuf <= 0)
- error(2, 0, "bad sndbuf value: %s", optarg);
+ error(2, 0, _("bad sndbuf value: %s"), optarg);
break;
case 't':
options |= F_TTL;
ttl = atoi(optarg);
if (ttl < 0 || ttl > 255)
- error(2, 0, "ttl out of range: %s", optarg);
+ error(2, 0, _("ttl out of range: %s"), optarg);
break;
case 'U':
options |= F_LATENCY;
@@ -430,15 +434,15 @@ main(int argc, char **argv)
case 'w':
deadline = atoi(optarg);
if (deadline < 0)
- error(2, 0, "bad wait time: %s", optarg);
+ error(2, 0, _("bad wait time: %s"), optarg);
break;
case 'W':
{
double optval;
- optval = ping_strtod(optarg, "bad linger time");
+ optval = ping_strtod(optarg, _("bad linger time"));
if (isless(optval, 0.001) || isgreater(optval, (double)(INT_MAX / 1000)))
- error(2, 0, "bad linger time: %s", optarg);
+ error(2, 0, _("bad linger time: %s"), optarg);
/* lingertime will be converted to usec later */
lingertime = (int)(optval * 1000);
}
@@ -498,7 +502,7 @@ main(int argc, char **argv)
status = ping6_run(argc, argv, ai, &sock6);
break;
default:
- error(2, 0, "unknown protocol family: %d", ai->ai_family);
+ error(2, 0, _("unknown protocol family: %d"), ai->ai_family);
}
if (status == 0)
@@ -598,7 +602,7 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
if (IN_MULTICAST(ntohl(dst.sin_addr.s_addr))) {
struct ip_mreqn imr;
if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0)
- error(2, 0, "unknown iface: %s", device);
+ error(2, 0, _("unknown iface: %s"), device);
memset(&imr, 0, sizeof(imr));
imr.imr_ifindex = ifr.ifr_ifindex;
if (setsockopt(fd, SOL_IP, IP_MULTICAST_IF, &imr, sizeof(imr)) == -1)
@@ -611,7 +615,7 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
if (settos &&
setsockopt(probe_fd, IPPROTO_IP, IP_TOS, (char *)&settos, sizeof(int)) < 0)
- error(0, errno, "warning: QOS sockopts");
+ error(0, errno, _("warning: QOS sockopts"));
dst.sin_port = htons(1025);
if (nroute)
@@ -620,11 +624,11 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
if (errno == EACCES) {
if (broadcast_pings == 0)
error(2, 0,
- "Do you want to ping broadcast? Then -b. If not, check your local firewall rules");
- fprintf(stderr, "WARNING: pinging broadcast address\n");
+ _("Do you want to ping broadcast? Then -b. If not, check your local firewall rules"));
+ fprintf(stderr, _("WARNING: pinging broadcast address\n"));
if (setsockopt(probe_fd, SOL_SOCKET, SO_BROADCAST,
&broadcast_pings, sizeof(broadcast_pings)) < 0)
- error(2, errno, "cannot set broadcasting");
+ error(2, errno, _("cannot set broadcasting"));
if (connect(probe_fd, (struct sockaddr*)&dst, sizeof(dst)) == -1)
error(2, errno, "connect");
} else
@@ -641,7 +645,7 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
ret = getifaddrs(&ifa0);
if (ret)
- error(2, errno, "gatifaddrs failed");
+ error(2, errno, _("gatifaddrs failed"));
for (ifa = ifa0; ifa; ifa = ifa->ifa_next) {
if (!ifa->ifa_name || !ifa->ifa_addr ||
ifa->ifa_addr->sa_family != AF_INET)
@@ -659,7 +663,7 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
}
freeifaddrs(ifa0);
if (!ifa)
- error(0, 0, "Warning: source address might be selected on device other than: %s", device);
+ error(0, 0, _("Warning: source address might be selected on device other than: %s"), device);
}
close(probe_fd);
} while (0);
@@ -673,15 +677,15 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, device, IFNAMSIZ-1);
if (ioctl(sock->fd, SIOCGIFINDEX, &ifr) < 0)
- error(2, 0, "unknown iface: %s", device);
+ error(2, 0, _("unknown iface: %s"), device);
}
if (broadcast_pings || IN_MULTICAST(ntohl(whereto.sin_addr.s_addr))) {
if (uid) {
if (interval < 1000)
- error(2, 0, "broadcast ping with too short interval: %d", interval);
+ error(2, 0, _("broadcast ping with too short interval: %d"), interval);
if (pmtudisc >= 0 && pmtudisc != IP_PMTUDISC_DO)
- error(2, 0, "broadcast ping does not fragment");
+ error(2, 0, _("broadcast ping does not fragment"));
}
if (pmtudisc < 0)
pmtudisc = IP_PMTUDISC_DO;
@@ -705,18 +709,18 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
(1<<ICMP_REDIRECT)|
(1<<ICMP_ECHOREPLY));
if (setsockopt(sock->fd, SOL_RAW, ICMP_FILTER, &filt, sizeof filt) == -1)
- error(0, errno, "WARNING: setsockopt(ICMP_FILTER)");
+ error(0, errno, _("WARNING: setsockopt(ICMP_FILTER)"));
}
hold = 1;
if (setsockopt(sock->fd, SOL_IP, IP_RECVERR, &hold, sizeof hold))
- error(0, 0, "WARNING: your kernel is veeery old. No problems.");
+ error(0, 0, _("WARNING: your kernel is veeery old. No problems."));
if (sock->socktype == SOCK_DGRAM) {
if (setsockopt(sock->fd, SOL_IP, IP_RECVTTL, &hold, sizeof hold))
- error(0, errno, "WARNING: setsockopt(IP_RECVTTL)");
+ error(0, errno, _("WARNING: setsockopt(IP_RECVTTL)"));
if (setsockopt(sock->fd, SOL_IP, IP_RETOPTS, &hold, sizeof hold))
- error(0, errno, "WARNING: setsockopt(IP_RETOPTS)");
+ error(0, errno, _("WARNING: setsockopt(IP_RETOPTS)"));
}
/* record route option */
@@ -777,43 +781,42 @@ int ping4_run(int argc, char **argv, struct addrinfo *ai, socket_st *sock)
if (broadcast_pings) {
if (setsockopt(sock->fd, SOL_SOCKET, SO_BROADCAST, &broadcast_pings, sizeof broadcast_pings) < 0)
- error(2, errno, "cannot set broadcasting");
+ error(2, errno, _("cannot set broadcasting"));
}
if (options & F_NOLOOP) {
int loop = 0;
if (setsockopt(sock->fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof loop) == -1)
- error(2, errno, "cannot disable multicast loopback");
+ error(2, errno, _("cannot disable multicast loopback"));
}
if (options & F_TTL) {
int ittl = ttl;
if (setsockopt(sock->fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof ttl) == -1)
- error(2, errno, "cannot set multicast time-to-live");
+ error(2, errno, _("cannot set multicast time-to-live"));
if (setsockopt(sock->fd, IPPROTO_IP, IP_TTL, &ittl, sizeof ittl) == -1)
- error(2, errno, "cannot set unicast time-to-live");
+ error(2, errno, _("cannot set unicast time-to-live"));
}
if (datalen > 0xFFFF - 8 - optlen - 20)
- error(2, 0, "packet size %d is too large. Maximum is %d",
+ error(2, 0, _("packet size %d is too large. Maximum is %d"),
datalen, 0xFFFF - 8 - 20 - optlen);
if (datalen >= (int) sizeof(struct timeval)) /* can we time transfer */
timing = 1;
packlen = datalen + MAXIPLEN + MAXICMPLEN;
if (!(packet = (unsigned char *)malloc((unsigned int)packlen)))
- error(2, errno, "memory allocation failed");
+ error(2, errno, _("memory allocation failed"));
- printf("PING %s (%s) ", hostname, inet_ntoa(whereto.sin_addr));
+ printf(_("PING %s (%s) "), hostname, inet_ntoa(whereto.sin_addr));
if (device || (options&F_STRICTSOURCE))
- printf("from %s %s: ", inet_ntoa(source.sin_addr), device ? device : "");
- printf("%d(%d) bytes of data.\n", datalen, datalen+8+optlen+20);
+ printf(_("from %s %s: "), inet_ntoa(source.sin_addr), device ? device : "");
+ printf(_("%d(%d) bytes of data.\n"), datalen, datalen+8+optlen+20);
setup(sock);
main_loop(&ping4_func_set, sock, packet, packlen);
}
-
int ping4_receive_error_msg(socket_st *sock)
{
ssize_t res;
@@ -859,9 +862,9 @@ int ping4_receive_error_msg(socket_st *sock)
if (options & F_FLOOD)
write_stdout("E", 1);
else if (e->ee_errno != EMSGSIZE)
- error(0, 0, "local error: %s", strerror(e->ee_errno));
+ error(0, 0, _("local error: %s"), strerror(e->ee_errno));
else
- error(0, 0, "local error: message too long, mtu=%u", e->ee_info);
+ error(0, 0, _("local error: message too long, mtu=%u"), e->ee_info);
nerrors++;
} else if (e->ee_origin == SO_EE_ORIGIN_ICMP) {
struct sockaddr_in *sin = (struct sockaddr_in*)(e+1);
@@ -885,7 +888,7 @@ int ping4_receive_error_msg(socket_st *sock)
write_stdout("\bE", 2);
} else {
print_timestamp();
- printf("From %s icmp_seq=%u ", pr_addr(sin, sizeof *sin), ntohs(icmph.un.echo.sequence));
+ printf(_("From %s icmp_seq=%u "), pr_addr(sin, sizeof *sin), ntohs(icmph.un.echo.sequence));
pr_icmph(e->ee_type, e->ee_code, e->ee_info, NULL);
fflush(stdout);
}
@@ -957,7 +960,7 @@ static
void pr_echo_reply(uint8_t *_icp, int len __attribute__((__unused__)))
{
struct icmphdr *icp = (struct icmphdr *)_icp;
- printf(" icmp_seq=%u", ntohs(icp->un.echo.sequence));
+ printf(_(" icmp_seq=%u"), ntohs(icp->un.echo.sequence));
}
int
@@ -980,7 +983,7 @@ ping4_parse_reply(struct socket_st *sock, struct msghdr *msg, int cc, void *addr
hlen = ip->ihl*4;
if (cc < hlen + 8 || ip->ihl < 5) {
if (options & F_VERBOSE)
- error(0, 0, "packet too short (%d bytes) from %s", cc,
+ error(0, 0, _("packet too short (%d bytes) from %s"), cc,
pr_addr(from, sizeof *from));
return 1;
}
@@ -1056,11 +1059,11 @@ ping4_parse_reply(struct socket_st *sock, struct msghdr *msg, int cc, void *addr
if (options & (F_QUIET | F_FLOOD))
return 1;
print_timestamp();
- printf("From %s: icmp_seq=%u ",
+ printf(_("From %s: icmp_seq=%u "),
pr_addr(from, sizeof *from),
ntohs(icp1->un.echo.sequence));
if (csfailed)
- printf("(BAD CHECKSUM)");
+ printf(_("(BAD CHECKSUM)"));
pr_icmph(icp->type, icp->code, ntohl(icp->un.gateway), icp);
return 1;
}
@@ -1082,9 +1085,9 @@ ping4_parse_reply(struct socket_st *sock, struct msghdr *msg, int cc, void *addr
gettimeofday(&recv_time, NULL);
printf("%lu.%06lu ", (unsigned long)recv_time.tv_sec, (unsigned long)recv_time.tv_usec);
}
- printf("From %s: ", pr_addr(from, sizeof *from));
+ printf(_("From %s: "), pr_addr(from, sizeof *from));
if (csfailed) {
- printf("(BAD CHECKSUM)\n");
+ printf(_("(BAD CHECKSUM)\n"));
return 0;
}
pr_icmph(icp->type, icp->code, ntohl(icp->un.gateway), icp);
@@ -1154,149 +1157,149 @@ void pr_icmph(uint8_t type, uint8_t code, uint32_t info, struct icmphdr *icp)
{
switch(type) {
case ICMP_ECHOREPLY:
- printf("Echo Reply\n");
+ printf(_("Echo Reply\n"));
/* XXX ID + Seq + Data */
break;
case ICMP_DEST_UNREACH:
switch(code) {
case ICMP_NET_UNREACH:
- printf("Destination Net Unreachable\n");
+ printf(_("Destination Net Unreachable\n"));
break;
case ICMP_HOST_UNREACH:
- printf("Destination Host Unreachable\n");
+ printf(_("Destination Host Unreachable\n"));
break;
case ICMP_PROT_UNREACH:
- printf("Destination Protocol Unreachable\n");
+ printf(_("Destination Protocol Unreachable\n"));
break;
case ICMP_PORT_UNREACH:
- printf("Destination Port Unreachable\n");
+ printf(_("Destination Port Unreachable\n"));
break;
case ICMP_FRAG_NEEDED:
- printf("Frag needed and DF set (mtu = %u)\n", info);
+ printf(_("Frag needed and DF set (mtu = %u)\n"), info);
break;
case ICMP_SR_FAILED:
- printf("Source Route Failed\n");
+ printf(_("Source Route Failed\n"));
break;
case ICMP_NET_UNKNOWN:
- printf("Destination Net Unknown\n");
+ printf(_("Destination Net Unknown\n"));
break;
case ICMP_HOST_UNKNOWN:
- printf("Destination Host Unknown\n");
+ printf(_("Destination Host Unknown\n"));
break;
case ICMP_HOST_ISOLATED:
- printf("Source Host Isolated\n");
+ printf(_("Source Host Isolated\n"));
break;
case ICMP_NET_ANO:
- printf("Destination Net Prohibited\n");
+ printf(_("Destination Net Prohibited\n"));
break;
case ICMP_HOST_ANO:
- printf("Destination Host Prohibited\n");
+ printf(_("Destination Host Prohibited\n"));
break;
case ICMP_NET_UNR_TOS:
- printf("Destination Net Unreachable for Type of Service\n");
+ printf(_("Destination Net Unreachable for Type of Service\n"));
break;
case ICMP_HOST_UNR_TOS:
- printf("Destination Host Unreachable for Type of Service\n");
+ printf(_("Destination Host Unreachable for Type of Service\n"));
break;
case ICMP_PKT_FILTERED:
- printf("Packet filtered\n");
+ printf(_("Packet filtered\n"));
break;
case ICMP_PREC_VIOLATION:
- printf("Precedence Violation\n");
+ printf(_("Precedence Violation\n"));
break;
case ICMP_PREC_CUTOFF:
- printf("Precedence Cutoff\n");
+ printf(_("Precedence Cutoff\n"));
break;
default:
- printf("Dest Unreachable, Bad Code: %d\n", code);
+ printf(_("Dest Unreachable, Bad Code: %d\n"), code);
break;
}
if (icp && (options & F_VERBOSE))
pr_iph((struct iphdr*)(icp + 1));
break;
case ICMP_SOURCE_QUENCH:
- printf("Source Quench\n");
+ printf(_("Source Quench\n"));
if (icp && (options & F_VERBOSE))
pr_iph((struct iphdr*)(icp + 1));
break;
case ICMP_REDIRECT:
switch(code) {
case ICMP_REDIR_NET:
- printf("Redirect Network");
+ printf(_("Redirect Network"));
break;
case ICMP_REDIR_HOST:
- printf("Redirect Host");
+ printf(_("Redirect Host"));
break;
case ICMP_REDIR_NETTOS:
- printf("Redirect Type of Service and Network");
+ printf(_("Redirect Type of Service and Network"));
break;
case ICMP_REDIR_HOSTTOS:
- printf("Redirect Type of Service and Host");
+ printf(_("Redirect Type of Service and Host"));
break;
default:
- printf("Redirect, Bad Code: %d", code);
+ printf(_("Redirect, Bad Code: %d"), code);
break;
}
{
struct sockaddr_in sin = { .sin_family = AF_INET, .sin_addr = { icp ? icp->un.gateway : info } };
- printf("(New nexthop: %s)\n", pr_addr(&sin, sizeof sin));
+ printf(_("(New nexthop: %s)\n"), pr_addr(&sin, sizeof sin));
}
if (icp && (options & F_VERBOSE))
pr_iph((struct iphdr*)(icp + 1));
break;
case ICMP_ECHO:
- printf("Echo Request\n");
+ printf(_("Echo Request\n"));
/* XXX ID + Seq + Data */
break;
case ICMP_TIME_EXCEEDED:
switch(code) {
case ICMP_EXC_TTL:
- printf("Time to live exceeded\n");
+ printf(_("Time to live exceeded\n"));
break;
case ICMP_EXC_FRAGTIME:
- printf("Frag reassembly time exceeded\n");
+ printf(_("Frag reassembly time exceeded\n"));
break;
default:
- printf("Time exceeded, Bad Code: %d\n", code);
+ printf(_("Time exceeded, Bad Code: %d\n"), code);
break;
}
if (icp && (options & F_VERBOSE))
pr_iph((struct iphdr*)(icp + 1));
break;
case ICMP_PARAMETERPROB:
- printf("Parameter problem: pointer = %u\n", icp ? (ntohl(icp->un.gateway)>>24) : info);
+ printf(_("Parameter problem: pointer = %u\n"), icp ? (ntohl(icp->un.gateway)>>24) : info);
if (icp && (options & F_VERBOSE))
pr_iph((struct iphdr*)(icp + 1));
break;
case ICMP_TIMESTAMP:
- printf("Timestamp\n");
+ printf(_("Timestamp\n"));
/* XXX ID + Seq + 3 timestamps */
break;
case ICMP_TIMESTAMPREPLY:
- printf("Timestamp Reply\n");
+ printf(_("Timestamp Reply\n"));
/* XXX ID + Seq + 3 timestamps */
break;
case ICMP_INFO_REQUEST:
- printf("Information Request\n");
+ printf(_("Information Request\n"));
/* XXX ID + Seq */
break;
case ICMP_INFO_REPLY:
- printf("Information Reply\n");
+ printf(_("Information Reply\n"));
/* XXX ID + Seq */
break;
#ifdef ICMP_MASKREQ
case ICMP_MASKREQ:
- printf("Address Mask Request\n");
+ printf(_("Address Mask Request\n"));
break;
#endif
#ifdef ICMP_MASKREPLY
case ICMP_MASKREPLY:
- printf("Address Mask Reply\n");
+ printf(_("Address Mask Reply\n"));
break;
#endif
default:
- printf("Bad ICMP type: %d\n", type);
+ printf(_("Bad ICMP type: %d\n"), type);
}
}
@@ -1317,7 +1320,7 @@ void pr_options(unsigned char * cp, int hlen)
if (*optptr == IPOPT_NOP) {
totlen--;
optptr++;
- printf("\nNOP");
+ printf(_("\nNOP"));
continue;
}
cp = optptr;
@@ -1328,7 +1331,7 @@ void pr_options(unsigned char * cp, int hlen)
switch (*cp) {
case IPOPT_SSRR:
case IPOPT_LSRR:
- printf("\n%cSRR: ", *cp==IPOPT_SSRR ? 'S' : 'L');
+ printf(_("\n%cSRR: "), *cp==IPOPT_SSRR ? 'S' : 'L');
j = *++cp;
cp++;
if (j > IPOPT_MINOFF) {
@@ -1361,12 +1364,12 @@ void pr_options(unsigned char * cp, int hlen)
if (i == old_rrlen
&& !memcmp(cp, old_rr, i)
&& !(options & F_FLOOD)) {
- printf("\t(same route)");
+ printf(_("\t(same route)"));
break;
}
old_rrlen = i;
memcpy(old_rr, (char *)cp, i);
- printf("\nRR: ");
+ printf(_("\nRR: "));
cp++;
for (;;) {
uint32_t address;
@@ -1397,7 +1400,7 @@ void pr_options(unsigned char * cp, int hlen)
if (i <= 0)
break;
flags = *++cp;
- printf("\nTS: ");
+ printf(_("\nTS: "));
cp++;
for (;;) {
long l;
@@ -1424,13 +1427,13 @@ void pr_options(unsigned char * cp, int hlen)
if (l & 0x80000000) {
if (nonstdtime==0)
- printf("\t%ld absolute not-standard", l&0x7fffffff);
+ printf(_("\t%ld absolute not-standard"), l&0x7fffffff);
else
- printf("\t%ld not-standard", (l&0x7fffffff) - nonstdtime);
+ printf(_("\t%ld not-standard"), (l&0x7fffffff) - nonstdtime);
nonstdtime = l&0x7fffffff;
} else {
if (stdtime==0)
- printf("\t%ld absolute", l);
+ printf(_("\t%ld absolute"), l);
else
printf("\t%ld", l - stdtime);
stdtime = l;
@@ -1441,11 +1444,11 @@ void pr_options(unsigned char * cp, int hlen)
break;
}
if (flags>>4)
- printf("Unrecorded hops: %d\n", flags>>4);
+ printf(_("Unrecorded hops: %d\n"), flags>>4);
break;
}
default:
- printf("\nunknown option %x", *cp);
+ printf(_("\nunknown option %x"), *cp);
break;
}
totlen -= olen;
@@ -1466,12 +1469,12 @@ void pr_iph(struct iphdr *ip)
hlen = ip->ihl << 2;
cp = (unsigned char *)ip + 20; /* point to options */
- printf("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst Data\n");
- printf(" %1x %1x %02x %04x %04x",
+ printf(_("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst Data\n"));
+ printf(_(" %1x %1x %02x %04x %04x"),
ip->version, ip->ihl, ip->tos, ip->tot_len, ip->id);
- printf(" %1x %04x", ((ip->frag_off) & 0xe000) >> 13,
+ printf(_(" %1x %04x"), ((ip->frag_off) & 0xe000) >> 13,
(ip->frag_off) & 0x1fff);
- printf(" %02x %02x %04x", ip->ttl, ip->protocol, ip->check);
+ printf(_(" %02x %02x %04x"), ip->ttl, ip->protocol, ip->check);
printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->saddr));
printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->daddr));
printf("\n");
@@ -1530,10 +1533,10 @@ int parsetos(char *str)
/* doesn't look like decimal or hex, eh? */
if (*ep != '\0')
- error(2, 0, "bad TOS value: %s", str);
+ error(2, 0, _("bad TOS value: %s"), str);
if (tos > TOS_MAX)
- error(2, 0, "the decimal value of TOS bits must be in range 0-255: %d", tos);
+ error(2, 0, _("the decimal value of TOS bits must be in range 0-255: %d"), tos);
return(tos);
}
@@ -1552,10 +1555,10 @@ int parseflow(char *str)
/* doesn't look like decimal or hex, eh? */
if (*ep != '\0')
- error(2, 0, "bad value for flowinfo: %s", str);
+ error(2, 0, _("bad value for flowinfo: %s"), str);
if (val & ~IPV6_FLOWINFO_FLOWLABEL)
- error(2, 0, "flow value is greater than 20 bits: %s", str);
+ error(2, 0, _("flow value is greater than 20 bits: %s"), str);
return(val);
}
@@ -1587,5 +1590,5 @@ void ping4_install_filter(socket_st *sock)
insns[2] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
if (setsockopt(sock->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
- error(0, errno, "WARNING: failed to install socket filter");
+ error(0, errno, _("WARNING: failed to install socket filter"));
}
diff --git a/ping.h b/ping.h
index 91cff9b..0e94a8f 100644
--- a/ping.h
+++ b/ping.h
@@ -40,8 +40,22 @@
#include <sys/capability.h>
#endif
+#if defined(USE_IDN) || defined(ENABLE_NLS)
+# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# undef bindtextdomain
+# define bindtextdomain(Domain, Directory) /* empty */
+# undef textdomain
+# define textdomain(Domain) /* empty */
+# define _(Text) Text
+#endif
+
#ifdef USE_IDN
-#include <locale.h>
#include <idn2.h>
#ifndef AI_IDN
diff --git a/ping6_common.c b/ping6_common.c
index b0d53da..daccf71 100644
--- a/ping6_common.c
+++ b/ping6_common.c
@@ -108,7 +108,7 @@ unsigned int if_name2index(const char *ifname)
{
unsigned int i = if_nametoindex(ifname);
if (!i)
- error(2, 0, "unknown iface: %s", ifname);
+ error(2, 0, _("unknown iface: %s"), ifname);
return i;
}
@@ -220,7 +220,7 @@ static int niquery_nonce(uint8_t *nonce, int fill)
return ntohsp((uint16_t *)nonce);
}
# else
- error(3, ENOSYS, "niquery_nonce() crypto disabled");
+ error(3, ENOSYS, _("niquery_nonce() crypto disabled"));
# endif
}
#endif
@@ -258,7 +258,7 @@ static inline int niquery_check_nonce(uint8_t *nonce)
static int niquery_set_qtype(int type)
{
if (niquery_is_enabled() && ni_query != type) {
- printf("Qtype conflict\n");
+ printf(_("Qtype conflict\n"));
return -1;
}
ni_query = type;
@@ -310,7 +310,7 @@ static inline int niquery_is_subject_valid(void)
static int niquery_set_subject_type(int type)
{
if (niquery_is_subject_valid() && ni_subject_type != type) {
- printf("Subject type conflict\n");
+ printf(_("Subject type conflict\n"));
return -1;
}
ni_subject_type = type;
@@ -401,7 +401,7 @@ static int niquery_option_subject_name_handler(int index, const char *name)
#ifdef USE_IDN
rc = idn2_lookup_ul(name, &idn, IDN2_FLAGS);
if (rc)
- error(2, 0, "IDN encoding error: %s", idn2_strerror(rc));
+ error(2, 0, _("IDN encoding error: %s"), idn2_strerror(rc));
#else
idn = strdup(name);
if (!idn)
@@ -412,7 +412,7 @@ static int niquery_option_subject_name_handler(int index, const char *name)
if (p) {
*p = '\0';
if (strlen(p + 1) >= IFNAMSIZ)
- error(1, 0, "too long scope name");
+ error(1, 0, _("too long scope name"));
}
namelen = strlen(idn);
@@ -436,7 +436,7 @@ static int niquery_option_subject_name_handler(int index, const char *name)
plus non-fqdn indicator. */
buf = malloc(buflen);
if (!buf) {
- error(0, errno, "memory allocation failed");
+ error(0, errno, _("memory allocation failed"));
goto errexit;
}
@@ -448,10 +448,10 @@ static int niquery_option_subject_name_handler(int index, const char *name)
n = dn_comp(canonname, (unsigned char *)buf, buflen, dnptrs, lastdnptr);
if (n < 0) {
- error(0, 0, "inappropriate subject name: %s", canonname);
+ error(0, 0, _("inappropriate subject name: %s"), canonname);
goto errexit;
} else if ((size_t) n >= buflen) {
- error(0, 0, "dn_comp() returned too long result");
+ error(0, 0, _("dn_comp() returned too long result"));
goto errexit;
}
@@ -479,7 +479,7 @@ static int niquery_option_subject_name_handler(int index, const char *name)
return 0;
oomexit:
- error(0, errno, "memory allocation failed");
+ error(0, errno, _("memory allocation failed"));
errexit:
free(buf);
free(canonname);
@@ -490,13 +490,13 @@ errexit:
static int niquery_option_subject_name_handler(int index __attribute__((__unused__)),
const char *name __attribute__((__unused__)))
{
- error(3, ENOSYS, "niquery_option_subject_name_handler() crypto disabled");
+ error(3, ENOSYS, _("niquery_option_subject_name_handler() crypto disabled"));
}
#endif
int niquery_option_help_handler(int index __attribute__((__unused__)), const char *arg __attribute__((__unused__)))
{
- fprintf(stderr, "ping -6 -N <nodeinfo opt>\n"
+ fprintf(stderr, _("ping -6 -N <nodeinfo opt>\n"
"Help:\n"
" help\n"
"Query:\n"
@@ -514,7 +514,7 @@ int niquery_option_help_handler(int index __attribute__((__unused__)), const cha
" subject-ipv4=addr\n"
" subject-name=name\n"
" subject-fqdn=name\n"
- );
+ ));
exit(2);
}
@@ -580,7 +580,7 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
if (!ai) {
status = getaddrinfo(target, NULL, &hints, &result);
if (status)
- error(2, 0, "%s: %s", target, gai_strerror(status));
+ error(2, 0, _("%s: %s"), target, gai_strerror(status));
ai = result;
}
@@ -598,7 +598,7 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
firsthop.sin6_scope_id = whereto.sin6_scope_id;
/* Verify scope_id is the same as intermediate nodes */
if (firsthop.sin6_scope_id && scope_id && firsthop.sin6_scope_id != scope_id)
- error(2, 0, "scope discrepancy among the nodes");
+ error(2, 0, _("scope discrepancy among the nodes"));
else if (!scope_id)
scope_id = firsthop.sin6_scope_id;
}
@@ -669,7 +669,7 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
break;
}
if (!ifa)
- error(0, 0, "Warning: source address might be selected on device other than: %s", device);
+ error(0, 0, _("Warning: source address might be selected on device other than: %s"), device);
freeifaddrs(ifa0);
}
@@ -696,9 +696,9 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
if ((whereto.sin6_addr.s6_addr16[0]&htons(0xff00)) == htons (0xff00)) {
if (uid) {
if (interval < 1000)
- error(2, 0, "multicast ping with too short interval: %d", interval);
+ error(2, 0, _("multicast ping with too short interval: %d"), interval);
if (pmtudisc >= 0 && pmtudisc != IPV6_PMTUDISC_DO)
- error(2, 0, "multicast ping does not fragment");
+ error(2, 0, _("multicast ping does not fragment"));
}
if (pmtudisc < 0)
pmtudisc = IPV6_PMTUDISC_DO;
@@ -719,7 +719,7 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
}
packlen = datalen + 8 + 4096 + 40 + 8; /* 4096 for rthdr */
if (!(packet = (unsigned char *)malloc((unsigned int)packlen)))
- error(2, errno, "memory allocation failed");
+ error(2, errno, _("memory allocation failed"));
hold = 1;
@@ -739,7 +739,7 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
/* checksum should be enabled by default and setting this
* option might fail anyway.
*/
- error(0, errno, "setsockopt(RAW_CHECKSUM) failed - try to continue");
+ error(0, errno, _("setsockopt(RAW_CHECKSUM) failed - try to continue"));
}
#else
{
@@ -770,13 +770,13 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
if (options & F_NOLOOP) {
int loop = 0;
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop, sizeof loop) == -1)
- error(2, errno, "can't disable multicast loopback");
+ error(2, errno, _("can't disable multicast loopback"));
}
if (options & F_TTL) {
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof ttl) == -1)
- error(2, errno, "can't set multicast hop limit");
+ error(2, errno, _("can't set multicast hop limit"));
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof ttl) == -1)
- error(2, errno, "can't set unicast hop limit");
+ error(2, errno, _("can't set unicast hop limit"));
}
const int on = 1;
@@ -788,14 +788,14 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
setsockopt(sock->fd, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, sizeof on) == -1
#endif
)
- error(2, errno, "can't receive hop limit");
+ error(2, errno, _("can't receive hop limit"));
if (options & F_TCLASS) {
#ifdef IPV6_TCLASS
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_TCLASS, &tclass, sizeof tclass) == -1)
- error(2, errno, "setsockopt(IPV6_TCLASS)");
+ error(2, errno, _("setsockopt(IPV6_TCLASS)"));
#else
- error(0, 0, "traffic class is not supported");
+ error(0, 0, _("traffic class is not supported"));
#endif
}
@@ -811,32 +811,32 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
freq->flr_share = IPV6_FL_S_EXCL;
memcpy(&freq->flr_dst, &whereto.sin6_addr, 16);
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_FLOWLABEL_MGR, freq, freq_len) == -1)
- error(2, errno, "can't set flowlabel");
+ error(2, errno, _("can't set flowlabel"));
flowlabel = freq->flr_label;
#else
- error(2, 0, "flow labels are not supported");
+ error(2, 0, _("flow labels are not supported"));
#endif
#ifdef IPV6_FLOWINFO_SEND
whereto.sin6_flowinfo = flowlabel;
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND, &on, sizeof on) == -1)
- error(2, errno, "can't send flowinfo");
+ error(2, errno, _("can't send flowinfo"));
#else
- error(2, 0, "flowinfo is not supported");
+ error(2, 0, _("flowinfo is not supported"));
#endif
}
- printf("PING %s(%s) ", hostname, pr_addr(&whereto, sizeof whereto));
+ printf(_("PING %s(%s) "), hostname, pr_addr(&whereto, sizeof whereto));
if (flowlabel)
- printf(", flow 0x%05x, ", (unsigned)ntohl(flowlabel));
+ printf(_(", flow 0x%05x, "), (unsigned)ntohl(flowlabel));
if (device || (options&F_STRICTSOURCE)) {
int saved_options = options;
options |= F_NUMERIC;
- printf("from %s %s: ", pr_addr(&source6, sizeof source6), device ? device : "");
+ printf(_("from %s %s: "), pr_addr(&source6, sizeof source6), device ? device : "");
options = saved_options;
}
- printf("%d data bytes\n", datalen);
+ printf(_("%d data bytes\n"), datalen);
setup(sock);
@@ -890,9 +890,9 @@ int ping6_receive_error_msg(socket_st *sock)
if (options & F_FLOOD)
write_stdout("E", 1);
else if (e->ee_errno != EMSGSIZE)
- error(0, e->ee_errno, "local error");
+ error(0, e->ee_errno, _("local error"));
else
- error(0, 0, "local error: message too long, mtu: %u", e->ee_info);
+ error(0, 0, _("local error: message too long, mtu: %u"), e->ee_info);
nerrors++;
} else if (e->ee_origin == SO_EE_ORIGIN_ICMP6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)(e+1);
@@ -914,7 +914,7 @@ int ping6_receive_error_msg(socket_st *sock)
write_stdout("\bE", 2);
} else {
print_timestamp();
- printf("From %s icmp_seq=%u ", pr_addr(sin6, sizeof *sin6), ntohs(icmph.icmp6_seq));
+ printf(_("From %s icmp_seq=%u "), pr_addr(sin6, sizeof *sin6), ntohs(icmph.icmp6_seq));
pr_icmph(e->ee_type, e->ee_code, e->ee_info);
putchar('\n');
fflush(stdout);
@@ -1018,7 +1018,7 @@ int ping6_send_probe(socket_st *sock, void *packet, unsigned packet_size)
void pr_echo_reply(uint8_t *_icmph, int cc __attribute__((__unused__)))
{
struct icmp6_hdr *icmph = (struct icmp6_hdr *) _icmph;
- printf(" icmp_seq=%u", ntohs(icmph->icmp6_seq));
+ printf(_(" icmp_seq=%u"), ntohs(icmph->icmp6_seq));
}
static void putchar_safe(char c)
@@ -1042,7 +1042,7 @@ void pr_niquery_reply_name(struct ni_hdr *nih, int len)
len -= sizeof(struct ni_hdr) + 4;
if (len < 0) {
- printf(" parse error (too short)");
+ printf(_(" parse error (too short)"));
return;
}
while (p < end) {
@@ -1056,7 +1056,7 @@ void pr_niquery_reply_name(struct ni_hdr *nih, int len)
ret = dn_expand(h, end, p, buf, sizeof(buf));
if (ret < 0) {
- printf(" parse error (truncated)");
+ printf(_(" parse error (truncated)"));
break;
}
if (p + ret < end && *(p + ret) == '\0')
@@ -1103,7 +1103,7 @@ void pr_niquery_reply_addr(struct ni_hdr *nih, int len)
}
p = h;
if (len < 0) {
- printf(" parse error (too short)");
+ printf(_(" parse error (too short)"));
return;
}
@@ -1112,11 +1112,11 @@ void pr_niquery_reply_addr(struct ni_hdr *nih, int len)
putchar(',');
if (p + sizeof(uint32_t) + aflen > end) {
- printf(" parse error (truncated)");
+ printf(_(" parse error (truncated)"));
break;
}
if (!inet_ntop(af, p + sizeof(uint32_t), buf, sizeof(buf)))
- printf(" unexpeced error in inet_ntop(%s)",
+ printf(_(" unexpeced error in inet_ntop(%s)"),
strerror(errno));
else
printf(" %s", buf);
@@ -1125,7 +1125,7 @@ void pr_niquery_reply_addr(struct ni_hdr *nih, int len)
continued = 1;
}
if (truncated)
- printf(" (truncated)");
+ printf(_(" (truncated)"));
}
static
@@ -1144,19 +1144,19 @@ void pr_niquery_reply(uint8_t *_nih, int len)
pr_niquery_reply_addr(nih, len);
break;
default:
- printf(" unknown qtype(0x%02x)", ntohs(nih->ni_qtype));
+ printf(_(" unknown qtype(0x%02x)"), ntohs(nih->ni_qtype));
}
break;
case NI_REFUSED:
- printf(" refused");
+ printf(_(" refused"));
break;
case NI_UNKNOWN:
- printf(" unknown");
+ printf(_(" unknown"));
break;
default:
- printf(" unknown code(%02x)", ntohs(nih->ni_code));
+ printf(_(" unknown code(%02x)"), ntohs(nih->ni_code));
}
- printf("; seq=%u;", ntohsp((uint16_t*)nih->ni_nonce));
+ printf(_("; seq=%u;"), ntohsp((uint16_t*)nih->ni_nonce));
}
/*
@@ -1195,7 +1195,7 @@ ping6_parse_reply(socket_st *sock, struct msghdr *msg, int cc, void *addr, struc
icmph = (struct icmp6_hdr *) buf;
if (cc < 8) {
if (options & F_VERBOSE)
- error(0, 0, "packet too short: %d bytes", cc);
+ error(0, 0, _("packet too short: %d bytes"), cc);
return 1;
}
@@ -1256,13 +1256,13 @@ ping6_parse_reply(socket_st *sock, struct msghdr *msg, int cc, void *addr, struc
return 0;
}
print_timestamp();
- printf("From %s: icmp_seq=%u ", pr_addr(from, sizeof *from), ntohs(icmph1->icmp6_seq));
+ printf(_("From %s: icmp_seq=%u "), pr_addr(from, sizeof *from), ntohs(icmph1->icmp6_seq));
} else {
/* We've got something other than an ECHOREPLY */
if (!(options & F_VERBOSE) || uid)
return 1;
print_timestamp();
- printf("From %s: ", pr_addr(from, sizeof *from));
+ printf(_("From %s: "), pr_addr(from, sizeof *from));
}
pr_icmph(icmph->icmp6_type, icmph->icmp6_code, ntohl(icmph->icmp6_mtu));
}
@@ -1284,71 +1284,71 @@ int pr_icmph(uint8_t type, uint8_t code, uint32_t info)
{
switch(type) {
case ICMP6_DST_UNREACH:
- printf("Destination unreachable: ");
+ printf(_("Destination unreachable: "));
switch (code) {
case ICMP6_DST_UNREACH_NOROUTE:
- printf("No route");
+ printf(_("No route"));
break;
case ICMP6_DST_UNREACH_ADMIN:
- printf("Administratively prohibited");
+ printf(_("Administratively prohibited"));
break;
case ICMP6_DST_UNREACH_BEYONDSCOPE:
- printf("Beyond scope of source address");
+ printf(_("Beyond scope of source address"));
break;
case ICMP6_DST_UNREACH_ADDR:
- printf("Address unreachable");
+ printf(_("Address unreachable"));
break;
case ICMP6_DST_UNREACH_NOPORT:
- printf("Port unreachable");
+ printf(_("Port unreachable"));
break;
default:
- printf("Unknown code %d", code);
+ printf(_("Unknown code %d"), code);
break;
}
break;
case ICMP6_PACKET_TOO_BIG:
- printf("Packet too big: mtu=%u", info);
+ printf(_("Packet too big: mtu=%u"), info);
if (code)
- printf(", code=%d", code);
+ printf(_(", code=%d"), code);
break;
case ICMP6_TIME_EXCEEDED:
- printf("Time exceeded: ");
+ printf(_("Time exceeded: "));
if (code == ICMP6_TIME_EXCEED_TRANSIT)
- printf("Hop limit");
+ printf(_("Hop limit"));
else if (code == ICMP6_TIME_EXCEED_REASSEMBLY)
- printf("Defragmentation failure");
+ printf(_("Defragmentation failure"));
else
- printf("code %d", code);
+ printf(_("code %d"), code);
break;
case ICMP6_PARAM_PROB:
- printf("Parameter problem: ");
+ printf(_("Parameter problem: "));
if (code == ICMP6_PARAMPROB_HEADER)
- printf("Wrong header field ");
+ printf(_("Wrong header field "));
else if (code == ICMP6_PARAMPROB_NEXTHEADER)
- printf("Unknown header ");
+ printf(_("Unknown header "));
else if (code == ICMP6_PARAMPROB_OPTION)
- printf("Unknown option ");
+ printf(_("Unknown option "));
else
- printf("code %d ", code);
- printf ("at %u", info);
+ printf(_("code %d "), code);
+ printf (_("at %u"), info);
break;
case ICMP6_ECHO_REQUEST:
- printf("Echo request");
+ printf(_("Echo request"));
break;
case ICMP6_ECHO_REPLY:
- printf("Echo reply");
+ printf(_("Echo reply"));
break;
case MLD_LISTENER_QUERY:
- printf("MLD Query");
+ printf(_("MLD Query"));
break;
case MLD_LISTENER_REPORT:
- printf("MLD Report");
+ printf(_("MLD Report"));
break;
case MLD_LISTENER_REDUCTION:
- printf("MLD Reduction");
+ printf(_("MLD Reduction"));
break;
default:
- printf("unknown icmp type: %u", type);
+ printf(_("unknown icmp type: %u"), type);
}
return 0;
@@ -1379,5 +1379,5 @@ void ping6_install_filter(socket_st *sock)
insns[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(ident), 0, 1);
if (setsockopt(sock->fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
- error(0, errno, "WARNING: failed to install socket filter");
+ error(0, errno, _("WARNING: failed to install socket filter"));
}
diff --git a/ping_common.c b/ping_common.c
index 3e092f1..5e2115f 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -264,7 +264,7 @@ void fill(char *patp, unsigned char *packet, unsigned packet_size)
for (cp = patp; *cp; cp++) {
if (!isxdigit(*cp))
- error(2, 0, "patterns must be specified as hex digits: %s", cp);
+ error(2, 0, _("patterns must be specified as hex digits: %s"), cp);
}
ii = sscanf(patp,
"%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x",
@@ -279,7 +279,7 @@ void fill(char *patp, unsigned char *packet, unsigned packet_size)
bp[jj + kk] = pat[jj];
}
if (!(options & F_QUIET)) {
- printf("PATTERN: 0x");
+ printf(_("PATTERN: 0x"));
for (jj = 0; jj < ii; ++jj)
printf("%02x", bp[jj] & 0xFF);
printf("\n");
@@ -399,7 +399,7 @@ int pinger(ping_func_set_st *fset, socket_st *sock)
if (options & F_OUTSTANDING) {
if (ntransmitted > 0 && !rcvd_test(ntransmitted)) {
print_timestamp();
- printf("no answer yet for icmp_seq=%lu\n", (ntransmitted % MAX_DUP_CHK));
+ printf(_("no answer yet for icmp_seq=%lu\n"), (ntransmitted % MAX_DUP_CHK));
fflush(stdout);
}
}
@@ -499,7 +499,7 @@ void sock_setbufs(socket_st *sock, int alloc)
setsockopt(sock->fd, SOL_SOCKET, SO_RCVBUF, (char *)&hold, sizeof(hold));
if (getsockopt(sock->fd, SOL_SOCKET, SO_RCVBUF, (char *)&hold, &tmplen) == 0) {
if (hold < rcvbuf)
- error(0, 0, "WARNING: probably, rcvbuf is not enough to hold preload");
+ error(0, 0, _("WARNING: probably, rcvbuf is not enough to hold preload"));
}
}
@@ -515,10 +515,10 @@ void setup(socket_st *sock)
interval = 0;
if (uid && interval < MINUSERINTERVAL)
- error(2, 0, "cannot flood; minimal interval allowed for user is %dms", MINUSERINTERVAL);
+ error(2, 0, _("cannot flood; minimal interval allowed for user is %dms"), MINUSERINTERVAL);
if (interval >= INT_MAX/preload)
- error(2, 0, "illegal preload and/or interval: %d", interval);
+ error(2, 0, _("illegal preload and/or interval: %d"), interval);
hold = 1;
if (options & F_SO_DEBUG)
@@ -530,7 +530,7 @@ void setup(socket_st *sock)
if (!(options&F_LATENCY)) {
int on = 1;
if (setsockopt(sock->fd, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on)))
- error(0, 0, "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP");
+ error(0, 0, _("Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP"));
}
#endif
#ifdef SO_MARK
@@ -547,7 +547,7 @@ void setup(socket_st *sock)
/* we probably dont wanna exit since old kernels
* dont support mark ..
*/
- error(0, errno_save, "Warning: Failed to set mark: %d", mark);
+ error(0, errno_save, _("Warning: Failed to set mark: %d"), mark);
}
}
#endif
@@ -806,7 +806,7 @@ restamp:
tvsub(tv, &tmp_tv);
triptime = tv->tv_sec * 1000000 + tv->tv_usec;
if (triptime < 0) {
- error(0, 0, "Warning: time of day goes back (%ldus), taking countermeasures", triptime);
+ error(0, 0, _("Warning: time of day goes back (%ldus), taking countermeasures"), triptime);
triptime = 0;
if (!(options & F_LATENCY)) {
gettimeofday(tv, NULL);
@@ -856,42 +856,42 @@ restamp:
uint8_t *cp, *dp;
print_timestamp();
- printf("%d bytes from %s:", cc, from);
+ printf(_("%d bytes from %s:"), cc, from);
if (pr_reply)
pr_reply(icmph, cc);
if (hops >= 0)
- printf(" ttl=%d", hops);
+ printf(_(" ttl=%d"), hops);
if (cc < datalen+8) {
- printf(" (truncated)\n");
+ printf(_(" (truncated)\n"));
return 1;
}
if (timing) {
if (triptime >= 100000)
- printf(" time=%ld ms", (triptime+500)/1000);
+ printf(_(" time=%ld ms"), (triptime+500)/1000);
else if (triptime >= 10000)
- printf(" time=%ld.%01ld ms", (triptime+50)/1000,
+ printf(_(" time=%ld.%01ld ms"), (triptime+50)/1000,
((triptime+50)%1000)/100);
else if (triptime >= 1000)
- printf(" time=%ld.%02ld ms", (triptime+5)/1000,
+ printf(_(" time=%ld.%02ld ms"), (triptime+5)/1000,
((triptime+5)%1000)/10);
else
- printf(" time=%ld.%03ld ms", triptime/1000,
+ printf(_(" time=%ld.%03ld ms"), triptime/1000,
triptime%1000);
}
if (dupflag)
- printf(" (DUP!)");
+ printf(_(" (DUP!)"));
if (csfailed)
- printf(" (BAD CHECKSUM!)");
+ printf(_(" (BAD CHECKSUM!)"));
/* check the data */
cp = ((unsigned char*)ptr) + sizeof(struct timeval);
dp = &outpack[8 + sizeof(struct timeval)];
for (i = sizeof(struct timeval); i < datalen; ++i, ++cp, ++dp) {
if (*cp != *dp) {
- printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
+ printf(_("\nwrong data byte #%d should be 0x%x but was 0x%x"),
i, *dp, *cp);
cp = (unsigned char*)ptr + sizeof(struct timeval);
for (i = sizeof(struct timeval); i < datalen; ++i, ++cp) {
@@ -934,23 +934,23 @@ void finish(void)
putchar('\n');
fflush(stdout);
- printf("--- %s ping statistics ---\n", hostname);
- printf("%ld packets transmitted, ", ntransmitted);
- printf("%ld received", nreceived);
+ printf(_("--- %s ping statistics ---\n"), hostname);
+ printf(_("%ld packets transmitted, "), ntransmitted);
+ printf(_("%ld received"), nreceived);
if (nrepeats)
- printf(", +%ld duplicates", nrepeats);
+ printf(_(", +%ld duplicates"), nrepeats);
if (nchecksum)
- printf(", +%ld corrupted", nchecksum);
+ printf(_(", +%ld corrupted"), nchecksum);
if (nerrors)
- printf(", +%ld errors", nerrors);
+ printf(_(", +%ld errors"), nerrors);
if (ntransmitted) {
#ifdef USE_IDN
setlocale(LC_ALL, "C");
#endif
- printf(", %g%% packet loss",
+ printf(_(", %g%% packet loss"),
(float) ((((long long)(ntransmitted - nreceived)) * 100.0) /
ntransmitted));
- printf(", time %ldms", 1000*tv.tv_sec+(tv.tv_usec+500)/1000);
+ printf(_(", time %ldms"), 1000*tv.tv_sec+(tv.tv_usec+500)/1000);
}
putchar('\n');
@@ -961,7 +961,7 @@ void finish(void)
tsum2 /= nreceived + nrepeats;
tmdev = llsqrt(tsum2 - tsum * tsum);
- printf("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms",
+ printf(_("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms"),
(long)tmin/1000, (long)tmin%1000,
(unsigned long)(tsum/1000), (long)(tsum%1000),
(long)tmax/1000, (long)tmax%1000,
@@ -970,12 +970,12 @@ void finish(void)
comma = ", ";
}
if (pipesize > 1) {
- printf("%spipe %d", comma, pipesize);
+ printf(_("%spipe %d"), comma, pipesize);
comma = ", ";
}
if (nreceived && (!interval || (options&(F_FLOOD|F_ADAPTIVE))) && ntransmitted > 1) {
int ipg = (1000000*(long long)tv.tv_sec+tv.tv_usec)/(ntransmitted-1);
- printf("%sipg/ewma %d.%03d/%d.%03d ms",
+ printf(_("%sipg/ewma %d.%03d/%d.%03d ms"),
comma, ipg/1000, ipg%1000, rtt/8000, (rtt/8)%1000);
}
putchar('\n');
@@ -993,12 +993,13 @@ void status(void)
if (ntransmitted)
loss = (((long long)(ntransmitted - nreceived)) * 100) / ntransmitted;
- fprintf(stderr, "\r%ld/%ld packets, %d%% loss", nreceived, ntransmitted, loss);
+ fprintf(stderr, "\r");
+ fprintf(stderr, _("%ld/%ld packets, %d%% loss"), nreceived, ntransmitted, loss);
if (nreceived && timing) {
tavg = tsum / (nreceived + nrepeats);
- fprintf(stderr, ", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms",
+ fprintf(stderr, _(", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms"),
(long)tmin/1000, (long)tmin%1000,
tavg/1000, tavg%1000,
rtt/8000, (rtt/8)%1000,
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..0b0433d
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1,2 @@
+ja
+
diff --git a/po/POTFILES b/po/POTFILES
new file mode 100644
index 0000000..f811ed8
--- /dev/null
+++ b/po/POTFILES
@@ -0,0 +1,7 @@
+arping.c
+clockdiff.c
+ping.c
+ping_common.c
+ping6_common.c
+tracepath.c
+traceroute6.c
diff --git a/po/iputils.pot b/po/iputils.pot
new file mode 100644
index 0000000..b48c01c
--- /dev/null
+++ b/po/iputils.pot
@@ -0,0 +1,1548 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the iputils package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: iputils\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-11-16 03:31+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: arping.c:191
+#, c-format
+msgid ""
+"\n"
+"Usage:\n"
+" arping [options] <destination>\n"
+"\n"
+"Options:\n"
+" -f quit on first reply\n"
+" -q be quiet\n"
+" -b keep on broadcasting, do not unicast\n"
+" -D duplicate address detection mode\n"
+" -U unsolicited ARP mode, update your neighbours\n"
+" -A ARP answer mode, update your neighbours\n"
+" -V print version and exit\n"
+" -c <count> how many packets to send\n"
+" -w <timeout> how long to wait for a reply\n"
+" -i <interval> set interval between packets (default: 1 second)\n"
+" -I <device> which ethernet device to use"
+msgstr ""
+
+#: arping.c:210
+#, c-format
+msgid ""
+"\n"
+" -s <source> source ip address\n"
+" <destination> dns name or ip address\n"
+"\n"
+"For more details see arping(8).\n"
+msgstr ""
+
+#: arping.c:385
+#, c-format
+msgid "Sent %d probes (%d broadcast(s))\n"
+msgstr ""
+
+#: arping.c:386
+#, c-format
+msgid "Received %d response(s)"
+msgstr ""
+
+#: arping.c:390
+#, c-format
+msgid "%d request(s)"
+msgstr ""
+
+#: arping.c:392
+#, c-format
+msgid "%s%d broadcast(s)"
+msgstr ""
+
+#: arping.c:487
+msgid "Unicast"
+msgstr ""
+
+#: arping.c:487
+msgid "Broadcast"
+msgstr ""
+
+#: arping.c:488
+#, c-format
+msgid "%s from "
+msgstr ""
+
+#: arping.c:488
+msgid "reply"
+msgstr ""
+
+#: arping.c:488
+msgid "request"
+msgstr ""
+
+#: arping.c:493
+#, c-format
+msgid "for %s "
+msgstr ""
+
+#: arping.c:498
+#, c-format
+msgid "for "
+msgstr ""
+
+#: arping.c:508
+#, c-format
+msgid " %ld.%03ldms\n"
+msgstr ""
+
+#: arping.c:510
+#, c-format
+msgid " UNSOLICITED?\n"
+msgstr ""
+
+#: arping.c:562
+#, c-format
+msgid "Interface \"%s\" is down\n"
+msgstr ""
+
+#: arping.c:570
+#, c-format
+msgid "Interface \"%s\" is not ARPable\n"
+msgstr ""
+
+#: arping.c:852
+#, c-format
+msgid "arping: too many interfaces!?\n"
+msgstr ""
+
+#: arping.c:919
+#, c-format
+msgid "WARNING: using default broadcast address.\n"
+msgstr ""
+
+#: arping.c:1164
+#, c-format
+msgid "arping: Device %s not available.\n"
+msgstr ""
+
+#: arping.c:1167
+#, c-format
+msgid ""
+"arping: Suitable device could not be determined. Please, use option -I.\n"
+msgstr ""
+
+#: arping.c:1193
+#, c-format
+msgid "arping: invalid source %s\n"
+msgstr ""
+
+#: arping.c:1213 traceroute6.c:880
+msgid "WARNING: interface is ignored"
+msgstr ""
+
+#: arping.c:1233
+msgid "WARNING: setsockopt(SO_DONTROUTE)"
+msgstr ""
+
+#: arping.c:1265
+#, c-format
+msgid "Interface \"%s\" is not ARPable (no ll address)\n"
+msgstr ""
+
+#: arping.c:1274
+#, c-format
+msgid "ARPING %s "
+msgstr ""
+
+#: arping.c:1275
+#, c-format
+msgid "from %s %s\n"
+msgstr ""
+
+#: arping.c:1279
+#, c-format
+msgid "arping: no source address in not-DAD mode\n"
+msgstr ""
+
+#: clockdiff.c:458
+#, c-format
+msgid "Wrong timestamp %d\n"
+msgstr ""
+
+#: clockdiff.c:463
+#, c-format
+msgid "Overflow %d hops\n"
+msgstr ""
+
+#: clockdiff.c:488
+#, c-format
+msgid "wrong timestamps\n"
+msgstr ""
+
+#: clockdiff.c:572
+#, c-format
+msgid ""
+"\n"
+"Usage:\n"
+" clockdiff [options] <destination>\n"
+"\n"
+"Options:\n"
+" without -o, use ip timestamp only\n"
+" -o use ip timestamp and icmp echo\n"
+" -o1 use three-term ip timestamp and icmp echo\n"
+" -V print version and exit\n"
+" <destination> dns name or ip address\n"
+"\n"
+"For more details see clockdiff(8).\n"
+msgstr ""
+
+#: clockdiff.c:710
+msgid "ping: IP_OPTIONS (fallback to icmp tstamps)"
+msgstr ""
+
+#: clockdiff.c:719
+#, c-format
+msgid "measure: unknown failure\n"
+msgstr ""
+
+#: clockdiff.c:725
+#, c-format
+msgid "%s is down\n"
+msgstr ""
+
+#: clockdiff.c:728
+#, c-format
+msgid "%s time transmitted in a non-standard format\n"
+msgstr ""
+
+#: clockdiff.c:731
+#, c-format
+msgid "%s is unreachable\n"
+msgstr ""
+
+#: clockdiff.c:742
+#, c-format
+msgid ""
+"\n"
+"host=%s rtt=%ld(%ld)ms/%ldms delta=%dms/%dms %s"
+msgstr ""
+
+#: ping.c:254 ping.c:281
+msgid "only one -4 or -6 option may be specified"
+msgstr ""
+
+#: ping.c:262 ping.c:267
+msgid "only one of -T or -R may be used"
+msgstr ""
+
+#: ping.c:276
+#, c-format
+msgid "invalid timestamp type: %s"
+msgstr ""
+
+#: ping.c:306
+#, c-format
+msgid "bad number of packets to transmit: %ld"
+msgstr ""
+
+#: ping.c:318
+msgid "bad timing interval"
+msgstr ""
+
+#: ping.c:320
+#, c-format
+msgid "bad timing interval: %s"
+msgstr ""
+
+#: ping.c:331
+#, c-format
+msgid "cannot copy: %s"
+msgstr ""
+
+#: ping.c:340
+#, c-format
+msgid "invalid source address: %s"
+msgstr ""
+
+#: ping.c:354
+#, c-format
+msgid "bad preload value: %s, should be 1..%d"
+msgstr ""
+
+#: ping.c:358
+#, c-format
+msgid "cannot set preload to value greater than 3: %d"
+msgstr ""
+
+#: ping.c:368
+#, c-format
+msgid "mark cannot be negative: %s"
+msgstr ""
+
+#: ping.c:380
+#, c-format
+msgid "invalid -M argument: %s"
+msgstr ""
+
+#: ping.c:410
+#, c-format
+msgid "illegal packet size: %d"
+msgstr ""
+
+#: ping.c:412
+#, c-format
+msgid "packet size too large: %d"
+msgstr ""
+
+#: ping.c:417
+#, c-format
+msgid "bad sndbuf value: %s"
+msgstr ""
+
+#: ping.c:423
+#, c-format
+msgid "ttl out of range: %s"
+msgstr ""
+
+#: ping.c:437
+#, c-format
+msgid "bad wait time: %s"
+msgstr ""
+
+#: ping.c:443
+msgid "bad linger time"
+msgstr ""
+
+#: ping.c:445
+#, c-format
+msgid "bad linger time: %s"
+msgstr ""
+
+#: ping.c:505
+#, c-format
+msgid "unknown protocol family: %d"
+msgstr ""
+
+#: ping.c:605 ping.c:680 ping6_common.c:111
+#, c-format
+msgid "unknown iface: %s"
+msgstr ""
+
+#: ping.c:618
+msgid "warning: QOS sockopts"
+msgstr ""
+
+#: ping.c:627
+msgid ""
+"Do you want to ping broadcast? Then -b. If not, check your local firewall "
+"rules"
+msgstr ""
+
+#: ping.c:628
+#, c-format
+msgid "WARNING: pinging broadcast address\n"
+msgstr ""
+
+#: ping.c:631 ping.c:784
+msgid "cannot set broadcasting"
+msgstr ""
+
+#: ping.c:648
+msgid "gatifaddrs failed"
+msgstr ""
+
+#: ping.c:666 ping6_common.c:672
+#, c-format
+msgid "Warning: source address might be selected on device other than: %s"
+msgstr ""
+
+#: ping.c:686
+#, c-format
+msgid "broadcast ping with too short interval: %d"
+msgstr ""
+
+#: ping.c:688
+msgid "broadcast ping does not fragment"
+msgstr ""
+
+#: ping.c:712
+msgid "WARNING: setsockopt(ICMP_FILTER)"
+msgstr ""
+
+#: ping.c:717
+msgid "WARNING: your kernel is veeery old. No problems."
+msgstr ""
+
+#: ping.c:721
+msgid "WARNING: setsockopt(IP_RECVTTL)"
+msgstr ""
+
+#: ping.c:723
+msgid "WARNING: setsockopt(IP_RETOPTS)"
+msgstr ""
+
+#: ping.c:790
+msgid "cannot disable multicast loopback"
+msgstr ""
+
+#: ping.c:795
+msgid "cannot set multicast time-to-live"
+msgstr ""
+
+#: ping.c:797
+msgid "cannot set unicast time-to-live"
+msgstr ""
+
+#: ping.c:801
+#, c-format
+msgid "packet size %d is too large. Maximum is %d"
+msgstr ""
+
+#: ping.c:808 ping6_common.c:439 ping6_common.c:482 ping6_common.c:722
+msgid "memory allocation failed"
+msgstr ""
+
+#: ping.c:810
+#, c-format
+msgid "PING %s (%s) "
+msgstr ""
+
+#: ping.c:812 ping6_common.c:836
+#, c-format
+msgid "from %s %s: "
+msgstr ""
+
+#: ping.c:813
+#, c-format
+msgid "%d(%d) bytes of data.\n"
+msgstr ""
+
+#: ping.c:865
+#, c-format
+msgid "local error: %s"
+msgstr ""
+
+#: ping.c:867
+#, c-format
+msgid "local error: message too long, mtu=%u"
+msgstr ""
+
+#: ping.c:891 ping6_common.c:917
+#, c-format
+msgid "From %s icmp_seq=%u "
+msgstr ""
+
+#: ping.c:963 ping6_common.c:1021
+#, c-format
+msgid " icmp_seq=%u"
+msgstr ""
+
+#: ping.c:986
+#, c-format
+msgid "packet too short (%d bytes) from %s"
+msgstr ""
+
+#: ping.c:1062 ping6_common.c:1259
+#, c-format
+msgid "From %s: icmp_seq=%u "
+msgstr ""
+
+#: ping.c:1066
+#, c-format
+msgid "(BAD CHECKSUM)"
+msgstr ""
+
+#: ping.c:1088 ping6_common.c:1265
+#, c-format
+msgid "From %s: "
+msgstr ""
+
+#: ping.c:1090
+#, c-format
+msgid "(BAD CHECKSUM)\n"
+msgstr ""
+
+#: ping.c:1160
+#, c-format
+msgid "Echo Reply\n"
+msgstr ""
+
+#: ping.c:1166
+#, c-format
+msgid "Destination Net Unreachable\n"
+msgstr ""
+
+#: ping.c:1169
+#, c-format
+msgid "Destination Host Unreachable\n"
+msgstr ""
+
+#: ping.c:1172
+#, c-format
+msgid "Destination Protocol Unreachable\n"
+msgstr ""
+
+#: ping.c:1175
+#, c-format
+msgid "Destination Port Unreachable\n"
+msgstr ""
+
+#: ping.c:1178
+#, c-format
+msgid "Frag needed and DF set (mtu = %u)\n"
+msgstr ""
+
+#: ping.c:1181
+#, c-format
+msgid "Source Route Failed\n"
+msgstr ""
+
+#: ping.c:1184
+#, c-format
+msgid "Destination Net Unknown\n"
+msgstr ""
+
+#: ping.c:1187
+#, c-format
+msgid "Destination Host Unknown\n"
+msgstr ""
+
+#: ping.c:1190
+#, c-format
+msgid "Source Host Isolated\n"
+msgstr ""
+
+#: ping.c:1193
+#, c-format
+msgid "Destination Net Prohibited\n"
+msgstr ""
+
+#: ping.c:1196
+#, c-format
+msgid "Destination Host Prohibited\n"
+msgstr ""
+
+#: ping.c:1199
+#, c-format
+msgid "Destination Net Unreachable for Type of Service\n"
+msgstr ""
+
+#: ping.c:1202
+#, c-format
+msgid "Destination Host Unreachable for Type of Service\n"
+msgstr ""
+
+#: ping.c:1205
+#, c-format
+msgid "Packet filtered\n"
+msgstr ""
+
+#: ping.c:1208
+#, c-format
+msgid "Precedence Violation\n"
+msgstr ""
+
+#: ping.c:1211
+#, c-format
+msgid "Precedence Cutoff\n"
+msgstr ""
+
+#: ping.c:1214
+#, c-format
+msgid "Dest Unreachable, Bad Code: %d\n"
+msgstr ""
+
+#: ping.c:1221
+#, c-format
+msgid "Source Quench\n"
+msgstr ""
+
+#: ping.c:1228
+#, c-format
+msgid "Redirect Network"
+msgstr ""
+
+#: ping.c:1231
+#, c-format
+msgid "Redirect Host"
+msgstr ""
+
+#: ping.c:1234
+#, c-format
+msgid "Redirect Type of Service and Network"
+msgstr ""
+
+#: ping.c:1237
+#, c-format
+msgid "Redirect Type of Service and Host"
+msgstr ""
+
+#: ping.c:1240
+#, c-format
+msgid "Redirect, Bad Code: %d"
+msgstr ""
+
+#: ping.c:1246
+#, c-format
+msgid "(New nexthop: %s)\n"
+msgstr ""
+
+#: ping.c:1252
+#, c-format
+msgid "Echo Request\n"
+msgstr ""
+
+#: ping.c:1258
+#, c-format
+msgid "Time to live exceeded\n"
+msgstr ""
+
+#: ping.c:1261
+#, c-format
+msgid "Frag reassembly time exceeded\n"
+msgstr ""
+
+#: ping.c:1264
+#, c-format
+msgid "Time exceeded, Bad Code: %d\n"
+msgstr ""
+
+#: ping.c:1271
+#, c-format
+msgid "Parameter problem: pointer = %u\n"
+msgstr ""
+
+#: ping.c:1276
+#, c-format
+msgid "Timestamp\n"
+msgstr ""
+
+#: ping.c:1280
+#, c-format
+msgid "Timestamp Reply\n"
+msgstr ""
+
+#: ping.c:1284
+#, c-format
+msgid "Information Request\n"
+msgstr ""
+
+#: ping.c:1288
+#, c-format
+msgid "Information Reply\n"
+msgstr ""
+
+#: ping.c:1293
+#, c-format
+msgid "Address Mask Request\n"
+msgstr ""
+
+#: ping.c:1298
+#, c-format
+msgid "Address Mask Reply\n"
+msgstr ""
+
+#: ping.c:1302
+#, c-format
+msgid "Bad ICMP type: %d\n"
+msgstr ""
+
+#: ping.c:1323
+#, c-format
+msgid ""
+"\n"
+"NOP"
+msgstr ""
+
+#: ping.c:1334
+#, c-format
+msgid ""
+"\n"
+"%cSRR: "
+msgstr ""
+
+#: ping.c:1367
+#, c-format
+msgid "\t(same route)"
+msgstr ""
+
+#: ping.c:1372
+#, c-format
+msgid ""
+"\n"
+"RR: "
+msgstr ""
+
+#: ping.c:1403
+#, c-format
+msgid ""
+"\n"
+"TS: "
+msgstr ""
+
+#: ping.c:1430
+#, c-format
+msgid "\t%ld absolute not-standard"
+msgstr ""
+
+#: ping.c:1432
+#, c-format
+msgid "\t%ld not-standard"
+msgstr ""
+
+#: ping.c:1436
+#, c-format
+msgid "\t%ld absolute"
+msgstr ""
+
+#: ping.c:1447
+#, c-format
+msgid "Unrecorded hops: %d\n"
+msgstr ""
+
+#: ping.c:1451
+#, c-format
+msgid ""
+"\n"
+"unknown option %x"
+msgstr ""
+
+#: ping.c:1472
+#, c-format
+msgid "Vr HL TOS Len ID Flg off TTL Pro cks Src Dst Data\n"
+msgstr ""
+
+#: ping.c:1473
+#, c-format
+msgid " %1x %1x %02x %04x %04x"
+msgstr ""
+
+#: ping.c:1475
+#, c-format
+msgid " %1x %04x"
+msgstr ""
+
+#: ping.c:1477
+#, c-format
+msgid " %02x %02x %04x"
+msgstr ""
+
+#: ping.c:1536
+#, c-format
+msgid "bad TOS value: %s"
+msgstr ""
+
+#: ping.c:1539
+#, c-format
+msgid "the decimal value of TOS bits must be in range 0-255: %d"
+msgstr ""
+
+#: ping.c:1558
+#, c-format
+msgid "bad value for flowinfo: %s"
+msgstr ""
+
+#: ping.c:1561
+#, c-format
+msgid "flow value is greater than 20 bits: %s"
+msgstr ""
+
+#: ping.c:1593 ping6_common.c:1382
+msgid "WARNING: failed to install socket filter"
+msgstr ""
+
+#: ping_common.c:267
+#, c-format
+msgid "patterns must be specified as hex digits: %s"
+msgstr ""
+
+#: ping_common.c:282
+#, c-format
+msgid "PATTERN: 0x"
+msgstr ""
+
+#: ping_common.c:402
+#, c-format
+msgid "no answer yet for icmp_seq=%lu\n"
+msgstr ""
+
+#: ping_common.c:502
+msgid "WARNING: probably, rcvbuf is not enough to hold preload"
+msgstr ""
+
+#: ping_common.c:518
+#, c-format
+msgid "cannot flood; minimal interval allowed for user is %dms"
+msgstr ""
+
+#: ping_common.c:521
+#, c-format
+msgid "illegal preload and/or interval: %d"
+msgstr ""
+
+#: ping_common.c:533
+msgid "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP"
+msgstr ""
+
+#: ping_common.c:550
+#, c-format
+msgid "Warning: Failed to set mark: %d"
+msgstr ""
+
+#: ping_common.c:809
+#, c-format
+msgid "Warning: time of day goes back (%ldus), taking countermeasures"
+msgstr ""
+
+#: ping_common.c:859
+#, c-format
+msgid "%d bytes from %s:"
+msgstr ""
+
+#: ping_common.c:865
+#, c-format
+msgid " ttl=%d"
+msgstr ""
+
+#: ping_common.c:868
+#, c-format
+msgid " (truncated)\n"
+msgstr ""
+
+#: ping_common.c:873
+#, c-format
+msgid " time=%ld ms"
+msgstr ""
+
+#: ping_common.c:875
+#, c-format
+msgid " time=%ld.%01ld ms"
+msgstr ""
+
+#: ping_common.c:878
+#, c-format
+msgid " time=%ld.%02ld ms"
+msgstr ""
+
+#: ping_common.c:881
+#, c-format
+msgid " time=%ld.%03ld ms"
+msgstr ""
+
+#: ping_common.c:885
+#, c-format
+msgid " (DUP!)"
+msgstr ""
+
+#: ping_common.c:887
+#, c-format
+msgid " (BAD CHECKSUM!)"
+msgstr ""
+
+#: ping_common.c:894
+#, c-format
+msgid ""
+"\n"
+"wrong data byte #%d should be 0x%x but was 0x%x"
+msgstr ""
+
+#: ping_common.c:937
+#, c-format
+msgid "--- %s ping statistics ---\n"
+msgstr ""
+
+#: ping_common.c:938
+#, c-format
+msgid "%ld packets transmitted, "
+msgstr ""
+
+#: ping_common.c:939
+#, c-format
+msgid "%ld received"
+msgstr ""
+
+#: ping_common.c:941
+#, c-format
+msgid ", +%ld duplicates"
+msgstr ""
+
+#: ping_common.c:943
+#, c-format
+msgid ", +%ld corrupted"
+msgstr ""
+
+#: ping_common.c:945
+#, c-format
+msgid ", +%ld errors"
+msgstr ""
+
+#: ping_common.c:950
+#, c-format
+msgid ", %g%% packet loss"
+msgstr ""
+
+#: ping_common.c:953
+#, c-format
+msgid ", time %ldms"
+msgstr ""
+
+#: ping_common.c:964
+#, c-format
+msgid "rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms"
+msgstr ""
+
+#: ping_common.c:973
+#, c-format
+msgid "%spipe %d"
+msgstr ""
+
+#: ping_common.c:978
+#, c-format
+msgid "%sipg/ewma %d.%03d/%d.%03d ms"
+msgstr ""
+
+#: ping_common.c:997
+#, c-format
+msgid "%ld/%ld packets, %d%% loss"
+msgstr ""
+
+#: ping_common.c:1002
+#, c-format
+msgid ", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms"
+msgstr ""
+
+#: ping6_common.c:223
+msgid "niquery_nonce() crypto disabled"
+msgstr ""
+
+#: ping6_common.c:261
+#, c-format
+msgid "Qtype conflict\n"
+msgstr ""
+
+#: ping6_common.c:313
+#, c-format
+msgid "Subject type conflict\n"
+msgstr ""
+
+#: ping6_common.c:404
+#, c-format
+msgid "IDN encoding error: %s"
+msgstr ""
+
+#: ping6_common.c:415
+msgid "too long scope name"
+msgstr ""
+
+#: ping6_common.c:451
+#, c-format
+msgid "inappropriate subject name: %s"
+msgstr ""
+
+#: ping6_common.c:454
+msgid "dn_comp() returned too long result"
+msgstr ""
+
+#: ping6_common.c:493
+msgid "niquery_option_subject_name_handler() crypto disabled"
+msgstr ""
+
+#: ping6_common.c:499
+#, c-format
+msgid ""
+"ping -6 -N <nodeinfo opt>\n"
+"Help:\n"
+" help\n"
+"Query:\n"
+" name\n"
+" ipv6\n"
+" ipv6-all\n"
+" ipv6-compatible\n"
+" ipv6-global\n"
+" ipv6-linklocal\n"
+" ipv6-sitelocal\n"
+" ipv4\n"
+" ipv4-all\n"
+"Subject:\n"
+" subject-ipv6=addr\n"
+" subject-ipv4=addr\n"
+" subject-name=name\n"
+" subject-fqdn=name\n"
+msgstr ""
+
+#: ping6_common.c:583
+#, c-format
+msgid "%s: %s"
+msgstr ""
+
+#: ping6_common.c:601
+msgid "scope discrepancy among the nodes"
+msgstr ""
+
+#: ping6_common.c:699
+#, c-format
+msgid "multicast ping with too short interval: %d"
+msgstr ""
+
+#: ping6_common.c:701
+msgid "multicast ping does not fragment"
+msgstr ""
+
+#: ping6_common.c:742
+msgid "setsockopt(RAW_CHECKSUM) failed - try to continue"
+msgstr ""
+
+#: ping6_common.c:773
+msgid "can't disable multicast loopback"
+msgstr ""
+
+#: ping6_common.c:777
+msgid "can't set multicast hop limit"
+msgstr ""
+
+#: ping6_common.c:779
+msgid "can't set unicast hop limit"
+msgstr ""
+
+#: ping6_common.c:791
+msgid "can't receive hop limit"
+msgstr ""
+
+#: ping6_common.c:796
+msgid "setsockopt(IPV6_TCLASS)"
+msgstr ""
+
+#: ping6_common.c:798
+msgid "traffic class is not supported"
+msgstr ""
+
+#: ping6_common.c:814
+msgid "can't set flowlabel"
+msgstr ""
+
+#: ping6_common.c:817
+msgid "flow labels are not supported"
+msgstr ""
+
+#: ping6_common.c:823
+msgid "can't send flowinfo"
+msgstr ""
+
+#: ping6_common.c:825
+msgid "flowinfo is not supported"
+msgstr ""
+
+#: ping6_common.c:829
+#, c-format
+msgid "PING %s(%s) "
+msgstr ""
+
+#: ping6_common.c:831
+#, c-format
+msgid ", flow 0x%05x, "
+msgstr ""
+
+#: ping6_common.c:839
+#, c-format
+msgid "%d data bytes\n"
+msgstr ""
+
+#: ping6_common.c:893
+msgid "local error"
+msgstr ""
+
+#: ping6_common.c:895
+#, c-format
+msgid "local error: message too long, mtu: %u"
+msgstr ""
+
+#: ping6_common.c:1045 ping6_common.c:1106
+#, c-format
+msgid " parse error (too short)"
+msgstr ""
+
+#: ping6_common.c:1059 ping6_common.c:1115
+#, c-format
+msgid " parse error (truncated)"
+msgstr ""
+
+#: ping6_common.c:1119
+#, c-format
+msgid " unexpeced error in inet_ntop(%s)"
+msgstr ""
+
+#: ping6_common.c:1128
+#, c-format
+msgid " (truncated)"
+msgstr ""
+
+#: ping6_common.c:1147
+#, c-format
+msgid " unknown qtype(0x%02x)"
+msgstr ""
+
+#: ping6_common.c:1151
+#, c-format
+msgid " refused"
+msgstr ""
+
+#: ping6_common.c:1154
+#, c-format
+msgid " unknown"
+msgstr ""
+
+#: ping6_common.c:1157
+#, c-format
+msgid " unknown code(%02x)"
+msgstr ""
+
+#: ping6_common.c:1159
+#, c-format
+msgid "; seq=%u;"
+msgstr ""
+
+#: ping6_common.c:1198
+#, c-format
+msgid "packet too short: %d bytes"
+msgstr ""
+
+#: ping6_common.c:1287
+#, c-format
+msgid "Destination unreachable: "
+msgstr ""
+
+#: ping6_common.c:1290
+#, c-format
+msgid "No route"
+msgstr ""
+
+#: ping6_common.c:1293
+#, c-format
+msgid "Administratively prohibited"
+msgstr ""
+
+#: ping6_common.c:1296
+#, c-format
+msgid "Beyond scope of source address"
+msgstr ""
+
+#: ping6_common.c:1299
+#, c-format
+msgid "Address unreachable"
+msgstr ""
+
+#: ping6_common.c:1302
+#, c-format
+msgid "Port unreachable"
+msgstr ""
+
+#: ping6_common.c:1305
+#, c-format
+msgid "Unknown code %d"
+msgstr ""
+
+#: ping6_common.c:1310
+#, c-format
+msgid "Packet too big: mtu=%u"
+msgstr ""
+
+#: ping6_common.c:1312
+#, c-format
+msgid ", code=%d"
+msgstr ""
+
+#: ping6_common.c:1315
+#, c-format
+msgid "Time exceeded: "
+msgstr ""
+
+#: ping6_common.c:1317
+#, c-format
+msgid "Hop limit"
+msgstr ""
+
+#: ping6_common.c:1319
+#, c-format
+msgid "Defragmentation failure"
+msgstr ""
+
+#: ping6_common.c:1321
+#, c-format
+msgid "code %d"
+msgstr ""
+
+#: ping6_common.c:1324
+#, c-format
+msgid "Parameter problem: "
+msgstr ""
+
+#: ping6_common.c:1326
+#, c-format
+msgid "Wrong header field "
+msgstr ""
+
+#: ping6_common.c:1328
+#, c-format
+msgid "Unknown header "
+msgstr ""
+
+#: ping6_common.c:1330
+#, c-format
+msgid "Unknown option "
+msgstr ""
+
+#: ping6_common.c:1332
+#, c-format
+msgid "code %d "
+msgstr ""
+
+#: ping6_common.c:1333
+#, c-format
+msgid "at %u"
+msgstr ""
+
+#: ping6_common.c:1336
+#, c-format
+msgid "Echo request"
+msgstr ""
+
+#: ping6_common.c:1339
+#, c-format
+msgid "Echo reply"
+msgstr ""
+
+#: ping6_common.c:1342
+#, c-format
+msgid "MLD Query"
+msgstr ""
+
+#: ping6_common.c:1345
+#, c-format
+msgid "MLD Report"
+msgstr ""
+
+#: ping6_common.c:1348
+#, c-format
+msgid "MLD Reduction"
+msgstr ""
+
+#: ping6_common.c:1351
+#, c-format
+msgid "unknown icmp type: %u"
+msgstr ""
+
+#: tracepath.c:240
+#, c-format
+msgid ""
+"cmsg6:%d\n"
+" "
+msgstr ""
+
+#: tracepath.c:252
+#, c-format
+msgid ""
+"cmsg4:%d\n"
+" "
+msgstr ""
+
+#: tracepath.c:257
+#, c-format
+msgid "no info\n"
+msgstr ""
+
+#: tracepath.c:261
+msgid "[LOCALHOST]"
+msgstr ""
+
+#: tracepath.c:309
+#, c-format
+msgid "%3ld.%03ldms "
+msgstr ""
+
+#: tracepath.c:311
+#, c-format
+msgid "(This broken router returned corrupted payload) "
+msgstr ""
+
+#: tracepath.c:326
+#, c-format
+msgid "pmtu %d\n"
+msgstr ""
+
+#: tracepath.c:331
+#, c-format
+msgid "reached\n"
+msgstr ""
+
+#: tracepath.c:347 tracepath.c:349
+#, c-format
+msgid "asymm %2d "
+msgstr ""
+
+#: tracepath.c:365
+msgid "NET ERROR"
+msgstr ""
+
+#: tracepath.c:410
+#, c-format
+msgid "%2d?: reply received 8)\n"
+msgstr ""
+
+#: tracepath.c:416
+#, c-format
+msgid "%2d: send failed\n"
+msgstr ""
+
+#: tracepath.c:423
+#, c-format
+msgid ""
+"\n"
+"Usage\n"
+" tracepath [options] <destination>\n"
+"\n"
+"Options:\n"
+" -4 use IPv4\n"
+" -6 use IPv6\n"
+" -b print both name and ip\n"
+" -l <length> use packet <length>\n"
+" -m <hops> use maximum <hops>\n"
+" -n no dns name resolution\n"
+" -p <port> use destination <port>\n"
+" -V print version and exit\n"
+" <destination> dns name or ip address\n"
+"\n"
+"For more details see tracepath(8).\n"
+msgstr ""
+
+#: tracepath.c:481 tracepath.c:489
+#, c-format
+msgid "tracepath: Only one -4 or -6 option may be specified\n"
+msgstr ""
+
+#: tracepath.c:503
+#, c-format
+msgid "Error: pktlen must be > %d and <= %d.\n"
+msgstr ""
+
+#: tracepath.c:512
+#, c-format
+msgid "Error: max hops must be 0 .. %d (inclusive).\n"
+msgstr ""
+
+#: tracepath.c:664
+#, c-format
+msgid "%2d: no reply\n"
+msgstr ""
+
+#: tracepath.c:671
+#, c-format
+msgid " Resume: pmtu %d "
+msgstr ""
+
+#: tracepath.c:673
+#, c-format
+msgid "hops %d "
+msgstr ""
+
+#: tracepath.c:675
+#, c-format
+msgid "back %d "
+msgstr ""
+
+#: tracepath.c:680
+#, c-format
+msgid "Error: pktlen must be > %d and <= %d\n"
+msgstr ""
+
+#: traceroute6.c:458
+#, c-format
+msgid "traceroute: wrote %s %d chars, ret=%d\n"
+msgstr ""
+
+#: traceroute6.c:487
+msgid "Error"
+msgstr ""
+
+#: traceroute6.c:489
+msgid "Destination Unreachable"
+msgstr ""
+
+#: traceroute6.c:491
+msgid "Packet Too Big"
+msgstr ""
+
+#: traceroute6.c:493
+msgid "Time Exceeded in Transit"
+msgstr ""
+
+#: traceroute6.c:495
+msgid "Parameter Problem"
+msgstr ""
+
+#: traceroute6.c:497
+msgid "Echo Request"
+msgstr ""
+
+#: traceroute6.c:499
+msgid "Echo Reply"
+msgstr ""
+
+#: traceroute6.c:501
+msgid "Membership Query"
+msgstr ""
+
+#: traceroute6.c:503
+msgid "Membership Report"
+msgstr ""
+
+#: traceroute6.c:505
+msgid "Membership Reduction"
+msgstr ""
+
+#: traceroute6.c:507
+msgid "Router Solicitation"
+msgstr ""
+
+#: traceroute6.c:509
+msgid "Router Advertisement"
+msgstr ""
+
+#: traceroute6.c:511
+msgid "Neighbor Solicitation"
+msgstr ""
+
+#: traceroute6.c:513
+msgid "Neighbor Advertisement"
+msgstr ""
+
+#: traceroute6.c:515
+msgid "Redirect"
+msgstr ""
+
+#: traceroute6.c:517
+msgid "Neighbor Query"
+msgstr ""
+
+#: traceroute6.c:519
+msgid "Neighbor Reply"
+msgstr ""
+
+#: traceroute6.c:521
+msgid "Multicast Listener Report packet"
+msgstr ""
+
+#: traceroute6.c:523
+msgid "Home Agent Address Discovery Request Message"
+msgstr ""
+
+#: traceroute6.c:525
+msgid "Home Agent Address Discovery Reply message"
+msgstr ""
+
+#: traceroute6.c:527
+msgid "Mobile Prefix Solicitation Message"
+msgstr ""
+
+#: traceroute6.c:529
+msgid "Mobile Prefix Solicitation Advertisement"
+msgstr ""
+
+#: traceroute6.c:531
+msgid "OUT-OF-RANGE"
+msgstr ""
+
+#: traceroute6.c:621
+#, c-format
+msgid ""
+"\n"
+"Usage:\n"
+" traceroute6 [options] <destination>\n"
+"\n"
+"Options:\n"
+" -d use SO_DEBUG socket option\n"
+" -i <device> bind to <device>\n"
+" -m <hops> use maximum <hops>\n"
+" -n no dns name resolution\n"
+" -p <port> use destination <port>\n"
+" -q <nprobes> number of probes\n"
+" -r use SO_DONTROUTE socket option\n"
+" -s <address> use source <address>\n"
+" -v verbose output\n"
+" -w <timeout> time to wait for response\n"
+"\n"
+"For more details see traceroute6(8).\n"
+msgstr ""
+
+#: traceroute6.c:713
+#, c-format
+msgid "traceroute: max ttl must be >1.\n"
+msgstr ""
+
+#: traceroute6.c:723
+#, c-format
+msgid "traceroute: port must be >0.\n"
+msgstr ""
+
+#: traceroute6.c:730
+#, c-format
+msgid "traceroute: nprobes must be >0.\n"
+msgstr ""
+
+#: traceroute6.c:753
+#, c-format
+msgid "traceroute: wait must be >1 sec.\n"
+msgstr ""
+
+#: traceroute6.c:781
+#, c-format
+msgid "traceroute: %s: %s\n"
+msgstr ""
+
+#: traceroute6.c:809
+#, c-format
+msgid "traceroute: packet size must be %d <= s < %d.\n"
+msgstr ""
+
+#: traceroute6.c:819
+#, c-format
+msgid "malloc failed\n"
+msgstr ""
+
+#: traceroute6.c:847
+#, c-format
+msgid "setsockopt(RAW_CHECKSUM) failed - try to continue."
+msgstr ""
+
+#: traceroute6.c:899
+#, c-format
+msgid "traceroute: unknown addr %s\n"
+msgstr ""
+
+#: traceroute6.c:913
+#, c-format
+msgid "traceroute to %s (%s)"
+msgstr ""
+
+#: traceroute6.c:916
+#, c-format
+msgid " from %s"
+msgstr ""
+
+#: traceroute6.c:917
+#, c-format
+msgid ", %d hops max, %d byte packets\n"
+msgstr ""
+
+#: traceroute6.c:943
+#, c-format
+msgid " %.4f ms"
+msgstr ""
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..ebabae3
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+ i18n = import('i18n')
+ i18n.gettext(meson.project_name(), args: '--directory=' + meson.source_root()
+)
diff --git a/tracepath.c b/tracepath.c
index 4155199..6ffe061 100644
--- a/tracepath.c
+++ b/tracepath.c
@@ -27,8 +27,22 @@
#include <sys/uio.h>
#include <unistd.h>
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# undef bindtextdomain
+# define bindtextdomain(Domain, Directory) /* empty */
+# undef textdomain
+# define textdomain(Domain) /* empty */
+# define _(Text) Text
+#endif
+
+#ifdef USE_IDN
# ifndef AI_IDN
# define AI_IDN 0x0040
# endif
@@ -223,7 +237,7 @@ static int recverr(struct run_state *const ctl)
memcpy(&rethops, CMSG_DATA(cmsg), sizeof(rethops));
break;
default:
- printf("cmsg6:%d\n ", cmsg->cmsg_type);
+ printf(_("cmsg6:%d\n "), cmsg->cmsg_type);
}
break;
case SOL_IP:
@@ -235,16 +249,16 @@ static int recverr(struct run_state *const ctl)
rethops = *(uint8_t *)CMSG_DATA(cmsg);
break;
default:
- printf("cmsg4:%d\n ", cmsg->cmsg_type);
+ printf(_("cmsg4:%d\n "), cmsg->cmsg_type);
}
}
}
if (e == NULL) {
- printf("no info\n");
+ printf(_("no info\n"));
return 0;
}
if (e->ee_origin == SO_EE_ORIGIN_LOCAL)
- printf("%2d?: %-32s ", ctl->ttl, "[LOCALHOST]");
+ printf("%2d?: %-32s ", ctl->ttl, _("[LOCALHOST]"));
else if (e->ee_origin == SO_EE_ORIGIN_ICMP6 ||
e->ee_origin == SO_EE_ORIGIN_ICMP) {
char abuf[NI_MAXHOST];
@@ -292,9 +306,9 @@ static int recverr(struct run_state *const ctl)
struct timeval res;
timersub(&tv, rettv, &res);
- printf("%3ld.%03ldms ", res.tv_sec * 1000 + res.tv_usec / 1000, res.tv_usec % 1000);
+ printf(_("%3ld.%03ldms "), res.tv_sec * 1000 + res.tv_usec / 1000, res.tv_usec % 1000);
if (broken_router)
- printf("(This broken router returned corrupted payload) ");
+ printf(_("(This broken router returned corrupted payload) "));
}
if (rethops <= 64)
@@ -309,12 +323,12 @@ static int recverr(struct run_state *const ctl)
printf("\n");
break;
case EMSGSIZE:
- printf("pmtu %d\n", e->ee_info);
+ printf(_("pmtu %d\n"), e->ee_info);
ctl->mtu = e->ee_info;
progress = ctl->mtu;
break;
case ECONNREFUSED:
- printf("reached\n");
+ printf(_("reached\n"));
ctl->hops_to = sndhops < 0 ? ctl->ttl : sndhops;
ctl->hops_from = rethops;
return 0;
@@ -330,9 +344,9 @@ static int recverr(struct run_state *const ctl)
e->ee_code == ICMPV6_EXC_HOPLIMIT)) {
if (rethops >= 0) {
if (sndhops >= 0 && rethops != sndhops)
- printf("asymm %2d ", rethops);
+ printf(_("asymm %2d "), rethops);
else if (sndhops < 0 && rethops != ctl->ttl)
- printf("asymm %2d ", rethops);
+ printf(_("asymm %2d "), rethops);
}
printf("\n");
break;
@@ -348,7 +362,7 @@ static int recverr(struct run_state *const ctl)
default:
printf("\n");
errno = e->ee_errno;
- perror("NET ERROR");
+ perror(_("NET ERROR"));
return 0;
}
goto restart;
@@ -393,19 +407,19 @@ static int probe_ttl(struct run_state *const ctl)
if (i < MAX_PROBES) {
data_wait(ctl);
if (recv(ctl->socket_fd, ctl->pktbuf, ctl->mtu, MSG_DONTWAIT) > 0) {
- printf("%2d?: reply received 8)\n", ctl->ttl);
+ printf(_("%2d?: reply received 8)\n"), ctl->ttl);
return 0;
}
return recverr(ctl);
}
- printf("%2d: send failed\n", ctl->ttl);
+ printf(_("%2d: send failed\n"), ctl->ttl);
return 0;
}
static void usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, _(
"\nUsage\n"
" tracepath [options] <destination>\n"
"\nOptions:\n"
@@ -418,7 +432,7 @@ static void usage(void)
" -p <port> use destination <port>\n"
" -V print version and exit\n"
" <destination> dns name or ip address\n"
- "\nFor more details see tracepath(8).\n");
+ "\nFor more details see tracepath(8).\n"));
exit(-1);
}
@@ -445,8 +459,12 @@ int main(int argc, char **argv)
char *p;
char pbuf[NI_MAXSERV];
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
setlocale(LC_ALL, "");
+#ifdef ENABLE_NLS
+ bindtextdomain (PACKAGE_NAME, LOCALEDIR);
+ textdomain (PACKAGE_NAME);
+#endif
#endif
/* Support being called using `tracepath4` or `tracepath6` symlinks */
@@ -460,7 +478,7 @@ int main(int argc, char **argv)
case '4':
if (hints.ai_family == AF_INET6) {
fprintf(stderr,
- "tracepath: Only one -4 or -6 option may be specified\n");
+ _("tracepath: Only one -4 or -6 option may be specified\n"));
exit(2);
}
hints.ai_family = AF_INET;
@@ -468,7 +486,7 @@ int main(int argc, char **argv)
case '6':
if (hints.ai_family == AF_INET) {
fprintf(stderr,
- "tracepath: Only one -4 or -6 option may be specified\n");
+ _("tracepath: Only one -4 or -6 option may be specified\n"));
exit(2);
}
hints.ai_family = AF_INET6;
@@ -482,7 +500,7 @@ int main(int argc, char **argv)
case 'l':
if ((ctl.mtu = atoi(optarg)) <= ctl.overhead) {
fprintf(stderr,
- "Error: pktlen must be > %d and <= %d.\n",
+ _("Error: pktlen must be > %d and <= %d.\n"),
ctl.overhead, INT_MAX);
exit(1);
}
@@ -491,7 +509,7 @@ int main(int argc, char **argv)
ctl.max_hops = atoi(optarg);
if (ctl.max_hops < 0 || ctl.max_hops > MAX_HOPS_LIMIT) {
fprintf(stderr,
- "Error: max hops must be 0 .. %d (inclusive).\n",
+ _("Error: max hops must be 0 .. %d (inclusive).\n"),
MAX_HOPS_LIMIT);
exit(1);
}
@@ -643,23 +661,23 @@ int main(int argc, char **argv)
}
if (res < 0)
- printf("%2d: no reply\n", ctl.ttl);
+ printf(_("%2d: no reply\n"), ctl.ttl);
}
printf(" Too many hops: pmtu %d\n", ctl.mtu);
done:
freeaddrinfo(result);
- printf(" Resume: pmtu %d ", ctl.mtu);
+ printf(_(" Resume: pmtu %d "), ctl.mtu);
if (ctl.hops_to >= 0)
- printf("hops %d ", ctl.hops_to);
+ printf(_("hops %d "), ctl.hops_to);
if (ctl.hops_from >= 0)
- printf("back %d ", ctl.hops_from);
+ printf(_("back %d "), ctl.hops_from);
printf("\n");
exit(0);
pktlen_error:
- fprintf(stderr, "Error: pktlen must be > %d and <= %d\n",
+ fprintf(stderr, _("Error: pktlen must be > %d and <= %d\n"),
ctl.overhead, INT_MAX);
exit(1);
}
diff --git a/traceroute6.c b/traceroute6.c
index 4af071b..4bc1dbd 100644
--- a/traceroute6.c
+++ b/traceroute6.c
@@ -251,8 +251,22 @@
# include <sys/capability.h>
#endif
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
# include <locale.h>
+#endif
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# undef bindtextdomain
+# define bindtextdomain(Domain, Directory) /* empty */
+# undef textdomain
+# define textdomain(Domain) /* empty */
+# define _(Text) Text
+#endif
+
+#ifdef USE_IDN
# ifndef NI_IDN
# define NI_IDN 32
# endif
@@ -441,7 +455,7 @@ static void send_probe(struct run_state *ctl, uint32_t seq, int ttl)
if (i < 0 || i != ctl->datalen) {
if (i < 0)
perror("sendto");
- printf("traceroute: wrote %s %d chars, ret=%d\n", ctl->hostname, ctl->datalen, i);
+ printf(_("traceroute: wrote %s %d chars, ret=%d\n"), ctl->hostname, ctl->datalen, i);
fflush(stdout);
}
}
@@ -470,51 +484,51 @@ static char const *pr_type(const uint8_t t)
switch (t) {
/* Unknown */
case 0:
- return "Error";
+ return _("Error");
case ICMPV6_DEST_UNREACH:
- return "Destination Unreachable";
+ return _("Destination Unreachable");
case ICMPV6_PKT_TOOBIG:
- return "Packet Too Big";
+ return _("Packet Too Big");
case ICMPV6_TIME_EXCEED:
- return "Time Exceeded in Transit";
+ return _("Time Exceeded in Transit");
case ICMPV6_PARAMPROB:
- return "Parameter Problem";
+ return _("Parameter Problem");
case ICMPV6_ECHO_REQUEST:
- return "Echo Request";
+ return _("Echo Request");
case ICMPV6_ECHO_REPLY:
- return "Echo Reply";
+ return _("Echo Reply");
case ICMPV6_MGM_QUERY:
- return "Membership Query";
+ return _("Membership Query");
case ICMPV6_MGM_REPORT:
- return "Membership Report";
+ return _("Membership Report");
case ICMPV6_MGM_REDUCTION:
- return "Membership Reduction";
+ return _("Membership Reduction");
case NDISC_ROUTER_SOLICITATION:
- return "Router Solicitation";
+ return _("Router Solicitation");
case NDISC_ROUTER_ADVERTISEMENT:
- return "Router Advertisement";
+ return _("Router Advertisement");
case NDISC_NEIGHBOUR_SOLICITATION:
- return "Neighbor Solicitation";
+ return _("Neighbor Solicitation");
case NDISC_NEIGHBOUR_ADVERTISEMENT:
- return "Neighbor Advertisement";
+ return _("Neighbor Advertisement");
case NDISC_REDIRECT:
- return "Redirect";
+ return _("Redirect");
case ICMPV6_NI_QUERY:
- return "Neighbor Query";
+ return _("Neighbor Query");
case ICMPV6_NI_REPLY:
- return "Neighbor Reply";
+ return _("Neighbor Reply");
case ICMPV6_MLD2_REPORT:
- return "Multicast Listener Report packet";
+ return _("Multicast Listener Report packet");
case ICMPV6_DHAAD_REQUEST:
- return "Home Agent Address Discovery Request Message";
+ return _("Home Agent Address Discovery Request Message");
case ICMPV6_DHAAD_REPLY:
- return "Home Agent Address Discovery Reply message";
+ return _("Home Agent Address Discovery Reply message");
case ICMPV6_MOBILE_PREFIX_SOL:
- return "Mobile Prefix Solicitation Message";
+ return _("Mobile Prefix Solicitation Message");
case ICMPV6_MOBILE_PREFIX_ADV:
- return "Mobile Prefix Solicitation Advertisement";
+ return _("Mobile Prefix Solicitation Advertisement");
default:
- return "OUT-OF-RANGE";
+ return _("OUT-OF-RANGE");
}
abort();
}
@@ -603,7 +617,7 @@ static void print(struct run_state *ctl, struct sockaddr_in6 *from)
static __attribute__((noreturn)) void usage(void)
{
- fprintf(stderr,
+ fprintf(stderr, _(
"\nUsage:\n"
" traceroute6 [options] <destination>\n"
"\nOptions:\n"
@@ -617,7 +631,7 @@ static __attribute__((noreturn)) void usage(void)
" -s <address> use source <address>\n"
" -v verbose output\n"
" -w <timeout> time to wait for response\n"
- "\nFor more details see traceroute6(8).\n");
+ "\nFor more details see traceroute6(8).\n"));
exit(1);
}
@@ -681,8 +695,12 @@ int main(int argc, char **argv)
}
#endif
-#ifdef USE_IDN
+#if defined(USE_IDN) || defined(ENABLE_NLS)
setlocale(LC_ALL, "");
+#ifdef ENABLE_NLS
+ bindtextdomain (PACKAGE_NAME, LOCALEDIR);
+ textdomain (PACKAGE_NAME);
+#endif
#endif
while ((ch = getopt(argc, argv, "dm:np:q:rs:w:vi:V")) != EOF) {
switch (ch) {
@@ -692,7 +710,7 @@ int main(int argc, char **argv)
case 'm':
ctl.max_ttl = atoi(optarg);
if (ctl.max_ttl <= 1) {
- fprintf(stderr, "traceroute: max ttl must be >1.\n");
+ fprintf(stderr, _("traceroute: max ttl must be >1.\n"));
exit(1);
}
break;
@@ -702,14 +720,14 @@ int main(int argc, char **argv)
case 'p':
ctl.port = atoi(optarg);
if (ctl.port < 1) {
- fprintf(stderr, "traceroute: port must be >0.\n");
+ fprintf(stderr, _("traceroute: port must be >0.\n"));
exit(1);
}
break;
case 'q':
ctl.nprobes = atoi(optarg);
if (ctl.nprobes < 1) {
- fprintf(stderr, "traceroute: nprobes must be >0.\n");
+ fprintf(stderr, _("traceroute: nprobes must be >0.\n"));
exit(1);
}
break;
@@ -732,7 +750,7 @@ int main(int argc, char **argv)
case 'w':
ctl.waittime = atoi(optarg);
if (ctl.waittime <= 1) {
- fprintf(stderr, "traceroute: wait must be >1 sec.\n");
+ fprintf(stderr, _("traceroute: wait must be >1 sec.\n"));
exit(1);
}
break;
@@ -760,7 +778,7 @@ int main(int argc, char **argv)
} else {
status = getaddrinfo(*argv, NULL, &hints6, &result);
if (status) {
- fprintf(stderr, "traceroute: %s: %s\n", *argv, gai_strerror(status));
+ fprintf(stderr, _("traceroute: %s: %s\n"), *argv, gai_strerror(status));
exit(1);
}
@@ -788,7 +806,7 @@ int main(int argc, char **argv)
ctl.datalen = sizeof(struct pkt_format);
else if (ctl.datalen < (int)sizeof(struct pkt_format) || ctl.datalen >= MAXPACKET) {
fprintf(stderr,
- "traceroute: packet size must be %d <= s < %d.\n",
+ _("traceroute: packet size must be %d <= s < %d.\n"),
(int)sizeof(struct pkt_format), MAXPACKET);
exit(1);
}
@@ -798,7 +816,7 @@ int main(int argc, char **argv)
ctl.sendbuff = malloc(ctl.datalen);
if (ctl.sendbuff == NULL) {
- fprintf(stderr, "malloc failed\n");
+ fprintf(stderr, _("malloc failed\n"));
exit(1);
}
@@ -826,7 +844,7 @@ int main(int argc, char **argv)
* checksum should be enabled by default and setting this
* option might fail anyway.
*/
- fprintf(stderr, "setsockopt(RAW_CHECKSUM) failed - try to continue.");
+ fprintf(stderr, _("setsockopt(RAW_CHECKSUM) failed - try to continue."));
}
#endif
@@ -859,7 +877,7 @@ int main(int argc, char **argv)
if (setsockopt
(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, ctl.device,
strlen(ctl.device) + 1) == -1)
- perror("WARNING: interface is ignored");
+ perror(_("WARNING: interface is ignored"));
}
ctl.firsthop.sin6_port = htons(get_ip_unprivileged_port_start(1025));
if (connect(probe_fd, (struct sockaddr *)&ctl.firsthop,
@@ -878,7 +896,7 @@ int main(int argc, char **argv)
memset((char *)&ctl.saddr, 0, sizeof(ctl.saddr));
ctl.saddr.sin6_family = AF_INET6;
if (inet_pton(AF_INET6, ctl.source, &ctl.saddr.sin6_addr) <= 0) {
- printf("traceroute: unknown addr %s\n", ctl.source);
+ printf(_("traceroute: unknown addr %s\n"), ctl.source);
exit(1);
}
}
@@ -892,11 +910,11 @@ int main(int argc, char **argv)
exit(1);
}
- fprintf(stderr, "traceroute to %s (%s)", ctl.hostname,
+ fprintf(stderr, _("traceroute to %s (%s)"), ctl.hostname,
inet_ntop(AF_INET6, &to->sin6_addr, pa, sizeof(pa)));
- fprintf(stderr, " from %s", inet_ntop(AF_INET6, &ctl.saddr.sin6_addr, pa, sizeof(pa)));
- fprintf(stderr, ", %d hops max, %d byte packets\n", ctl.max_ttl, ctl.datalen);
+ fprintf(stderr, _(" from %s"), inet_ntop(AF_INET6, &ctl.saddr.sin6_addr, pa, sizeof(pa)));
+ fprintf(stderr, _(", %d hops max, %d byte packets\n"), ctl.max_ttl, ctl.datalen);
fflush(stderr);
for (ttl = 1; ttl <= ctl.max_ttl; ++ttl) {
@@ -922,7 +940,7 @@ int main(int argc, char **argv)
memcpy(&lastaddr,
&from.sin6_addr, sizeof(lastaddr));
}
- printf(" %.4f ms", deltaT(&t1, &t2));
+ printf(_(" %.4f ms"), deltaT(&t1, &t2));
switch (i - 1) {
case ICMP6_DST_UNREACH_NOPORT:
got_there = 1;