summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHåkon Nessjøen <haakon.nessjoen@gmail.com>2012-02-28 14:32:53 +0100
committerHåkon Nessjøen <haakon.nessjoen@gmail.com>2012-02-28 14:32:53 +0100
commit210b1b5574afb381b87d6d34860009a905ed6848 (patch)
tree689c46e05840980520835fc01adb4a1446aa26bf
parent11ee3dc65c67d6a5c98347287cee50963029d412 (diff)
downloadMAC-Telnet-210b1b5574afb381b87d6d34860009a905ed6848.tar.gz
MAC-Telnet-210b1b5574afb381b87d6d34860009a905ed6848.zip
Added i18n support
-rw-r--r--Makefile5
-rw-r--r--interfaces.c5
-rw-r--r--macping.c42
-rw-r--r--mactelnet.c54
-rw-r--r--mactelnetd.c87
-rw-r--r--mndp.c20
-rw-r--r--po/mactelnet.pot397
-rw-r--r--protocol.c20
8 files changed, 536 insertions, 94 deletions
diff --git a/Makefile b/Makefile
index 6effde6..ca64341 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,8 @@ dist-clean:
rm -f mactelnet macping mactelnetd mndp
rm -f *.o
+dist: dist-clean po/mactelnet.pot
+
install: all install-docs
install -d $(DESTDIR)/usr/bin
install mndp $(DESTDIR)/usr/bin/
@@ -25,6 +27,9 @@ install-docs:
install -d $(DESTDIR)/usr/share/man/man1/
install docs/*.1 $(DESTDIR)/usr/share/man/man1/
+po/mactelnet.pot: *.c
+ xgettext --package-name=mactelnet --msgid-bugs-address=haakon.nessjoen@gmail.com -d mactelnet -C -k_ -kgettext_noop *.c -o po/mactelnet.pot
+
users.o: users.c users.h
${CC} -Wall ${CFLAGS} -DUSERSFILE='"/etc/mactelnetd.users"' -c users.c
diff --git a/interfaces.c b/interfaces.c
index 89c1776..0ed2d8e 100644
--- a/interfaces.c
+++ b/interfaces.c
@@ -16,6 +16,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <libintl.h>
+#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -41,6 +43,7 @@
#include "protocol.h"
#include "interfaces.h"
+#define _(String) gettext (String)
struct net_interface *net_get_interface_ptr(struct net_interface *interfaces, int max_devices, char *name, int create) {
int i;
@@ -281,7 +284,7 @@ int net_send_udp(const int fd, struct net_interface *interface, const unsigned c
unsigned char *rest = (unsigned char *)(buffer + 20 + 14 + sizeof(struct udphdr));
if (((void *)rest - (void*)buffer) + datalen > ETH_FRAME_LEN) {
- fprintf(stderr, "packet size too large\n");
+ fprintf(stderr, _("packet size too large\n"));
free(buffer);
return 0;
}
diff --git a/macping.c b/macping.c
index 2e90bc7..5321dfa 100644
--- a/macping.c
+++ b/macping.c
@@ -16,6 +16,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <libintl.h>
+#include <locale.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
@@ -36,6 +38,8 @@
#define PROGRAM_NAME "MAC-Ping"
+#define _(String) gettext (String)
+
static int sockfd, insockfd;
static unsigned short ping_size = 38;
@@ -82,8 +86,8 @@ static void display_results() {
}
printf("\n");
- printf("%d packets transmitted, %d packets received, %d%% packet loss\n", ping_sent, pong_received, 100 - percent);
- printf("round-trip min/avg/max = %.2f/%.2f/%.2f ms\n", min_ms, avg_ms/pong_received, max_ms);
+ printf(_("%d packets transmitted, %d packets received, %d%% packet loss\n"), ping_sent, pong_received, 100 - percent);
+ printf(_("round-trip min/avg/max = %.2f/%.2f/%.2f ms\n"), min_ms, avg_ms/pong_received, max_ms);
/* For bash scripting */
if (pong_received == 0) {
@@ -103,6 +107,10 @@ int main(int argc, char **argv) {
struct mt_packet packet;
int i;
+ setlocale(LC_ALL, "");
+ bindtextdomain("mactelnet","/usr/share/locale");
+ textdomain("mactelnet");
+
while (1) {
c = getopt(argc, argv, "fs:c:hv?");
@@ -138,28 +146,28 @@ int main(int argc, char **argv) {
/* We don't want people to use this for the wrong reasons */
if (fastmode && (send_packets == 0 || send_packets > 100)) {
- fprintf(stderr, "Number of packets to send must be more than 0 and less than 100 in fast mode.\n");
+ fprintf(stderr, _("Number of packets to send must be more than 0 and less than 100 in fast mode.\n"));
return 1;
}
if (argc - optind < 1 || print_help) {
print_version();
- fprintf(stderr, "Usage: %s <MAC> [-h] [-f] [-c <count>] [-s <packet size>]\n", argv[0]);
+ fprintf(stderr, _("Usage: %s <MAC> [-h] [-f] [-c <count>] [-s <packet size>]\n"), argv[0]);
if (print_help) {
- fprintf(stderr, "\nParameters:\n");
- fprintf(stderr, " MAC MAC-Address of the RouterOS/mactelnetd device.\n");
- fprintf(stderr, " -f Fast mode, do not wait before sending next ping request.\n");
- fprintf(stderr, " -s Specify size of ping packet.\n");
- fprintf(stderr, " -c Number of packets to send. (0 = unlimited)\n");
- fprintf(stderr, " -h This help.\n");
+ fprintf(stderr, _("\nParameters:\n"));
+ fprintf(stderr, _(" MAC MAC-Address of the RouterOS/mactelnetd device.\n"));
+ fprintf(stderr, _(" -f Fast mode, do not wait before sending next ping request.\n"));
+ fprintf(stderr, _(" -s Specify size of ping packet.\n"));
+ fprintf(stderr, _(" -c Number of packets to send. (0 = unlimited)\n"));
+ fprintf(stderr, _(" -h This help.\n"));
fprintf(stderr, "\n");
}
return 1;
}
if (ping_size > ETH_FRAME_LEN - 42) {
- fprintf(stderr, "Packet size must be between 18 and %d\n", ETH_FRAME_LEN - 42 + 18);
+ fprintf(stderr, _("Packet size must be between 18 and %d\n"), ETH_FRAME_LEN - 42 + 18);
exit(1);
}
@@ -168,7 +176,7 @@ int main(int argc, char **argv) {
* broadcast mac address.
*/
if (geteuid() != 0) {
- fprintf(stderr, "You need to have root privileges to use %s.\n", argv[0]);
+ fprintf(stderr, _("You need to have root privileges to use %s.\n"), argv[0]);
return 1;
}
@@ -196,7 +204,7 @@ int main(int argc, char **argv) {
/* Bind to specified address/port */
if (bind(insockfd, (struct sockaddr *)&si_me, sizeof(si_me))==-1) {
- fprintf(stderr, "Error binding to %s:%d\n", inet_ntoa(si_me.sin_addr), MT_MNDP_PORT);
+ fprintf(stderr, _("Error binding to %s:%d\n"), inet_ntoa(si_me.sin_addr), MT_MNDP_PORT);
return 1;
}
@@ -255,7 +263,7 @@ int main(int argc, char **argv) {
}
if (sent == 0) {
- fprintf(stderr, "Error sending packet.\n");
+ fprintf(stderr, _("Error sending packet.\n"));
continue;
}
ping_sent++;
@@ -273,7 +281,7 @@ int main(int argc, char **argv) {
reads = select(insockfd+1, &read_fds, NULL, NULL, &timeout);
if (reads <= 0) {
waitforpacket = 0;
- fprintf(stderr, "%s ping timeout\n", ether_ntoa((struct ether_addr *)&dstmac));
+ fprintf(stderr, _("%s ping timeout\n"), ether_ntoa((struct ether_addr *)&dstmac));
break;
}
@@ -311,9 +319,9 @@ int main(int argc, char **argv) {
avg_ms += diff;
- printf("%s %d byte, ping time %.2f ms%s\n", ether_ntoa((struct ether_addr *)&(pkthdr.srcaddr)), result, diff, (char *)(memcmp(&pongtimestamp,&lasttimestamp,sizeof(lasttimestamp)) == 0 ? " DUP" : ""));
+ printf(_("%s %d byte, ping time %.2f ms%s\n"), ether_ntoa((struct ether_addr *)&(pkthdr.srcaddr)), result, diff, (char *)(memcmp(&pongtimestamp,&lasttimestamp,sizeof(lasttimestamp)) == 0 ? " DUP" : ""));
} else {
- printf("%s Reply of %d bytes of unequal data\n", ether_ntoa((struct ether_addr *)&(pkthdr.srcaddr)), result);
+ printf(_("%s Reply of %d bytes of unequal data\n"), ether_ntoa((struct ether_addr *)&(pkthdr.srcaddr)), result);
}
pong_received++;
memcpy(&lasttimestamp, &pongtimestamp, sizeof(pongtimestamp));
diff --git a/mactelnet.c b/mactelnet.c
index ca27f15..c78b262 100644
--- a/mactelnet.c
+++ b/mactelnet.c
@@ -1,4 +1,4 @@
-/*find
+/*
Mac-Telnet - Connect to RouterOS or mactelnetd devices via MAC address
Copyright (C) 2010, Håkon Nessjøen <haakon.nessjoen@gmail.com>
@@ -17,6 +17,8 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _BSD_SOURCE
+#include <libintl.h>
+#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -44,6 +46,8 @@
#define PROGRAM_NAME "MAC-Telnet"
+#define _(String) gettext (String)
+
static int sockfd = 0;
static int insockfd;
@@ -147,7 +151,7 @@ static int send_udp(struct mt_packet *packet, int retransmit) {
reset_term();
}
- fprintf(stderr, "\nConnection timed out\n");
+ fprintf(stderr, _("\nConnection timed out\n"));
exit(1);
}
return sent_bytes;
@@ -296,13 +300,13 @@ static int handle_packet(unsigned char *data, int data_len) {
send_udp(&odata, 0);
if (!quiet_mode) {
- fprintf(stderr, "Connection closed.\n");
+ fprintf(stderr, _("Connection closed.\n"));
}
/* exit */
running = 0;
} else {
- fprintf(stderr, "Unhandeled packet type: %d received from server %s\n", pkthdr.ptype, ether_ntoa((struct ether_addr *)dstmac));
+ fprintf(stderr, _("Unhandeled packet type: %d received from server %s\n"), pkthdr.ptype, ether_ntoa((struct ether_addr *)dstmac));
return -1;
}
@@ -324,7 +328,7 @@ static int find_interface() {
bzero(emptymac, ETH_ALEN);
if (net_get_interfaces(interfaces, MAX_INTERFACES) <= 0) {
- fprintf(stderr, "Error: No suitable devices found\n");
+ fprintf(stderr, _("Error: No suitable devices found\n"));
exit(1);
}
@@ -399,6 +403,10 @@ int main (int argc, char **argv) {
int c;
int optval = 1;
+ setlocale(LC_ALL, "");
+ bindtextdomain("mactelnet","/usr/share/locale");
+ textdomain("mactelnet");
+
while (1) {
c = getopt(argc, argv, "nqt:u:p:vh?");
@@ -448,19 +456,19 @@ int main (int argc, char **argv) {
}
if (argc - optind < 1 || print_help) {
print_version();
- fprintf(stderr, "Usage: %s <MAC|identity> [-h] [-n] [-t <timeout>] [-u <username>] [-p <password>]\n", argv[0]);
+ fprintf(stderr, _("Usage: %s <MAC|identity> [-h] [-n] [-t <timeout>] [-u <username>] [-p <password>]\n"), argv[0]);
if (print_help) {
- fprintf(stderr, "\nParameters:\n");
- fprintf(stderr, " MAC MAC-Address of the RouterOS/mactelnetd device. Use mndp to discover it.\n");
- fprintf(stderr, " identity The identity/name of your destination device. Uses MNDP protocol to find it.\n");
- fprintf(stderr, " -n Do not use broadcast packets. Less insecure but requires root privileges.\n");
- fprintf(stderr, " -t Amount of seconds to wait for a response on each interface.\n");
- fprintf(stderr, " -u Specify username on command line.\n");
- fprintf(stderr, " -p Specify password on command line.\n");
- fprintf(stderr, " -q Quiet mode.\n");
- fprintf(stderr, " -h This help.\n");
- fprintf(stderr, "\n");
+ fprintf(stderr, _("\nParameters:\n"
+ " MAC MAC-Address of the RouterOS/mactelnetd device. Use mndp to discover it.\n"
+ " identity The identity/name of your destination device. Uses MNDP protocol to find it.\n"
+ " -n Do not use broadcast packets. Less insecure but requires root privileges.\n"
+ " -t Amount of seconds to wait for a response on each interface.\n"
+ " -u Specify username on command line.\n"
+ " -p Specify password on command line.\n"
+ " -q Quiet mode.\n"
+ " -h This help.\n"
+ "\n"));
}
return 1;
}
@@ -475,7 +483,7 @@ int main (int argc, char **argv) {
if (use_raw_socket) {
if (geteuid() != 0) {
- fprintf(stderr, "You need to have root privileges to use the -n parameter.\n");
+ fprintf(stderr, _("You need to have root privileges to use the -n parameter.\n"));
return 1;
}
@@ -507,14 +515,14 @@ int main (int argc, char **argv) {
if (!have_username) {
if (!quiet_mode) {
- printf("Login: ");
+ printf(_("Login: "));
}
scanf("%254s", username);
}
if (!have_password) {
char *tmp;
- tmp = getpass(quiet_mode ? "" : "Password: ");
+ tmp = getpass(quiet_mode ? "" : _("Password: "));
strncpy(password, tmp, sizeof(password) - 1);
password[sizeof(password) - 1] = '\0';
/* security */
@@ -539,7 +547,7 @@ int main (int argc, char **argv) {
setvbuf(stdout, (char*)NULL, _IONBF, 0);
if (!quiet_mode) {
- printf("Connecting to %s...", ether_ntoa((struct ether_addr *)dstmac));
+ printf(_("Connecting to %s..."), ether_ntoa((struct ether_addr *)dstmac));
}
/* Initialize receiving socket on the device chosen */
@@ -549,16 +557,16 @@ int main (int argc, char **argv) {
/* Bind to udp port */
if (bind(insockfd, (struct sockaddr *)&si_me, sizeof(si_me)) == -1) {
- fprintf(stderr, "Error binding to %s:%d, %s\n", inet_ntoa(si_me.sin_addr), sourceport, strerror(errno));
+ fprintf(stderr, _("Error binding to %s:%d, %s\n"), inet_ntoa(si_me.sin_addr), sourceport, strerror(errno));
return 1;
}
if (!find_interface() || (result = recvfrom(insockfd, buff, 1400, 0, 0, 0)) < 1) {
- fprintf(stderr, "Connection failed.\n");
+ fprintf(stderr, _("Connection failed.\n"));
return 1;
}
if (!quiet_mode) {
- printf("done\n");
+ printf(_("done\n"));
}
/* Handle first received packet */
diff --git a/mactelnetd.c b/mactelnetd.c
index d3d462d..a2c0956 100644
--- a/mactelnetd.c
+++ b/mactelnetd.c
@@ -18,6 +18,8 @@
*/
#define _XOPEN_SOURCE 600
#define _BSD_SOURCE
+#include <libintl.h>
+#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -63,6 +65,9 @@
/* Max ~5 pings per second */
#define MT_MAXPPS MT_MNDP_BROADCAST_INTERVAL * 5
+#define _(String) gettext (String)
+#define gettext_noop(String) String
+
static int sockfd;
static int insockfd;
static int mndpsockfd;
@@ -236,12 +241,12 @@ static void setup_sockets() {
memcpy(&(si_me.sin_addr.s_addr), interfaces[i].ipv4_addr, IPV4_ALEN);
if (bind(interfaces[i].socketfd, (struct sockaddr *)&si_me, sizeof(si_me))==-1) {
- fprintf(stderr, "Error binding to %s:%d, %s\n", inet_ntoa(si_me.sin_addr), sourceport, strerror(errno));
+ fprintf(stderr, _("Error binding to %s:%d, %s\n"), inet_ntoa(si_me.sin_addr), sourceport, strerror(errno));
continue;
}
}
- syslog(LOG_NOTICE, "Listening on %s for %s\n", interfaces[i].name, ether_ntoa(mac));
+ syslog(LOG_NOTICE, _("Listening on %s for %s\n"), interfaces[i].name, ether_ntoa(mac));
}
}
@@ -401,9 +406,9 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
}
if (user == NULL || memcmp(md5sum, curconn->trypassword, 17) != 0) {
- syslog(LOG_NOTICE, "(%d) Invalid login by %s.", curconn->seskey, curconn->username);
+ syslog(LOG_NOTICE, _("(%d) Invalid login by %s."), curconn->seskey, curconn->username);
- abort_connection(curconn, pkthdr, "Login failed, incorrect username or password\r\n");
+ abort_connection(curconn, pkthdr, _("Login failed, incorrect username or password\r\n"));
/* TODO: should wait some time (not with sleep) before returning, to minimalize brute force attacks */
return;
@@ -419,7 +424,7 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
curconn->ptsfd = posix_openpt(O_RDWR);
if (curconn->ptsfd == -1 || grantpt(curconn->ptsfd) == -1 || unlockpt(curconn->ptsfd) == -1) {
syslog(LOG_ERR, "posix_openpt: %s", strerror(errno));
- abort_connection(curconn, pkthdr, "Terminal error\r\n");
+ abort_connection(curconn, pkthdr, _("Terminal error\r\n"));
return;
}
@@ -430,8 +435,8 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
struct stat sb;
struct passwd *user = (struct passwd *)getpwnam(curconn->username);
if (user == NULL) {
- syslog(LOG_WARNING, "(%d) Login ok, but local user not accessible (%s).", curconn->seskey, curconn->username);
- abort_connection(curconn, pkthdr, "Local user not accessible\r\n");
+ syslog(LOG_WARNING, _("(%d) Login ok, but local user not accessible (%s)."), curconn->seskey, curconn->username);
+ abort_connection(curconn, pkthdr, _("Local user not accessible\r\n"));
return;
}
@@ -440,8 +445,8 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
curconn->slavefd = open(slavename, O_RDWR);
if (curconn->slavefd == -1) {
- syslog(LOG_ERR, "Error opening %s: %s", slavename, strerror(errno));
- abort_connection(curconn, pkthdr, "Error opening terminal\r\n");
+ syslog(LOG_ERR, _("Error opening %s: %s"), slavename, strerror(errno));
+ abort_connection(curconn, pkthdr, _("Error opening terminal\r\n"));
list_remove_connection(curconn);
return;
}
@@ -452,7 +457,7 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
/* Add login information to utmp/wtmp */
uwtmp_login(curconn);
- syslog(LOG_INFO, "(%d) User %s logged in.", curconn->seskey, curconn->username);
+ syslog(LOG_INFO, _("(%d) User %s logged in."), curconn->seskey, curconn->username);
/* Initialize terminal environment */
setenv("USER", user->pw_name, 1);
@@ -490,14 +495,14 @@ static void user_login(struct mt_connection *curconn, struct mt_mactelnet_hdr *p
/* Set user id/group id */
if ((setgid(user->pw_gid) != 0) || (setuid(user->pw_uid) != 0)) {
- syslog(LOG_ERR, "(%d) Could not log in %s (%d:%d): setuid/setgid: %s", curconn->seskey, curconn->username, user->pw_uid, user->pw_gid, strerror(errno));
- abort_connection(curconn, pkthdr, "Internal error\r\n");
+ syslog(LOG_ERR, _("(%d) Could not log in %s (%d:%d): setuid/setgid: %s"), curconn->seskey, curconn->username, user->pw_uid, user->pw_gid, strerror(errno));
+ abort_connection(curconn, pkthdr, _("Internal error\r\n"));
exit(0);
}
/* Abort login if /etc/nologin exists */
if (stat(_PATH_NOLOGIN, &sb) == 0 && getuid() != 0) {
- syslog(LOG_NOTICE, "(%d) User %s disconnected with " _PATH_NOLOGIN " message.", curconn->seskey, curconn->username);
+ syslog(LOG_NOTICE, _("(%d) User %s disconnected with " _PATH_NOLOGIN " message."), curconn->seskey, curconn->username);
display_nologin();
curconn->state = STATE_CLOSED;
init_packet(&pdata, MT_PTYPE_END, pkthdr->dstaddr, pkthdr->srcaddr, pkthdr->seskey, curconn->outcounter);
@@ -590,7 +595,7 @@ static void handle_data_packet(struct mt_connection *curconn, struct mt_mactelne
}
} else {
- syslog(LOG_WARNING, "(%d) Unhandeled control packet type: %d", curconn->seskey, cpkt.cptype);
+ syslog(LOG_WARNING, _("(%d) Unhandeled control packet type: %d"), curconn->seskey, cpkt.cptype);
}
/* Parse next control packet */
@@ -636,7 +641,7 @@ static void handle_packet(unsigned char *data, int data_len, const struct sockad
break;
case MT_PTYPE_SESSIONSTART:
- syslog(LOG_DEBUG, "(%d) New connection from %s.", pkthdr.seskey, ether_ntoa((struct ether_addr*)&(pkthdr.srcaddr)));
+ syslog(LOG_DEBUG, _("(%d) New connection from %s."), pkthdr.seskey, ether_ntoa((struct ether_addr*)&(pkthdr.srcaddr)));
curconn = calloc(1, sizeof(struct mt_connection));
curconn->seskey = pkthdr.seskey;
curconn->lastdata = time(NULL);
@@ -664,7 +669,7 @@ static void handle_packet(unsigned char *data, int data_len, const struct sockad
init_packet(&pdata, MT_PTYPE_END, pkthdr.dstaddr, pkthdr.srcaddr, pkthdr.seskey, pkthdr.counter);
send_udp(curconn, &pdata);
}
- syslog(LOG_DEBUG, "(%d) Connection closed.", curconn->seskey);
+ syslog(LOG_DEBUG, _("(%d) Connection closed."), curconn->seskey);
list_remove_connection(curconn);
return;
@@ -710,7 +715,7 @@ static void handle_packet(unsigned char *data, int data_len, const struct sockad
break;
default:
if (curconn) {
- syslog(LOG_WARNING, "(%d) Unhandeled packet type: %d", curconn->seskey, pkthdr.ptype);
+ syslog(LOG_WARNING, _("(%d) Unhandeled packet type: %d"), curconn->seskey, pkthdr.ptype);
init_packet(&pdata, MT_PTYPE_ACK, pkthdr.dstaddr, pkthdr.srcaddr, pkthdr.seskey, pkthdr.counter);
send_udp(curconn, &pdata);
}
@@ -802,14 +807,14 @@ void mndp_broadcast() {
void sigterm_handler() {
struct mt_connection *p;
struct mt_packet pdata;
- char message[] = "\r\n\r\nDaemon shutting down.\r\n";
+ char message[] = gettext_noop("\r\n\r\nDaemon shutting down.\r\n");
- syslog(LOG_NOTICE, "Daemon shutting down");
+ syslog(LOG_NOTICE, _("Daemon shutting down"));
for (p = connections_head; p != NULL; p = p->next) {
if (p->state == STATE_ACTIVE) {
init_packet(&pdata, MT_PTYPE_DATA, p->interface->mac_addr, p->srcmac, p->seskey, p->outcounter);
- add_control_packet(&pdata, MT_CPTYPE_PLAINDATA, message, strlen(message));
+ add_control_packet(&pdata, MT_CPTYPE_PLAINDATA, _(message), strlen(_(message)));
send_udp(p, &pdata);
init_packet(&pdata, MT_PTYPE_END, p->interface->mac_addr, p->srcmac, p->seskey, p->outcounter);
@@ -835,7 +840,7 @@ void sighup_handler() {
int i;
struct mt_connection *p;
- syslog(LOG_NOTICE, "SIGHUP: Reloading interfaces");
+ syslog(LOG_NOTICE, _("SIGHUP: Reloading interfaces"));
if (!use_raw_socket) {
for (i = 0; i < MAX_INTERFACES; ++i) {
@@ -846,7 +851,7 @@ void sighup_handler() {
bzero(interfaces, sizeof(interfaces));
if (net_get_interfaces(interfaces, MAX_INTERFACES) <= 0) {
- syslog(LOG_ERR, "No devices found! Exiting.\n");
+ syslog(LOG_ERR, _("No devices found! Exiting.\n"));
exit(1);
}
@@ -860,7 +865,7 @@ void sighup_handler() {
p->interface = interface;
} else {
struct mt_connection tmp;
- syslog(LOG_NOTICE, "(%d) Connection closed because interface %s is gone.", p->seskey, p->interface_name);
+ syslog(LOG_NOTICE, _("(%d) Connection closed because interface %s is gone."), p->seskey, p->interface_name);
tmp.next = p->next;
list_remove_connection(p);
p = &tmp;
@@ -884,6 +889,10 @@ int main (int argc, char **argv) {
int foreground = 0;
int interface_count = 0;
+ setlocale(LC_ALL, "");
+ bindtextdomain("mactelnet","/usr/share/locale");
+ textdomain("mactelnet");
+
while ((c = getopt(argc, argv, "fnvh?")) != -1) {
switch (c) {
case 'f':
@@ -909,20 +918,20 @@ int main (int argc, char **argv) {
if (print_help) {
print_version();
- fprintf(stderr, "Usage: %s [-f|-n|-h]\n", argv[0]);
+ fprintf(stderr, _("Usage: %s [-f|-n|-h]\n"), argv[0]);
if (print_help) {
- fprintf(stderr, "\nParameters:\n");
- fprintf(stderr, " -f Run process in foreground.\n");
- fprintf(stderr, " -n Do not use broadcast packets. Just a tad less insecure.\n");
- fprintf(stderr, " -h This help.\n");
- fprintf(stderr, "\n");
+ fprintf(stderr, _("\nParameters:\n"
+ " -f Run process in foreground.\n"
+ " -n Do not use broadcast packets. Just a tad less insecure.\n"
+ " -h This help.\n"
+ "\n"));
}
return 1;
}
if (geteuid() != 0) {
- fprintf(stderr, "You need to have root privileges to use %s.\n", argv[0]);
+ fprintf(stderr, _("You need to have root privileges to use %s.\n"), argv[0]);
return 1;
}
@@ -963,7 +972,7 @@ int main (int argc, char **argv) {
/* Bind to udp port */
if (bind(insockfd, (struct sockaddr *)&si_me, sizeof(si_me))==-1) {
- fprintf(stderr, "Error binding to %s:%d, %s\n", inet_ntoa(si_me.sin_addr), sourceport, strerror(errno));
+ fprintf(stderr, _("Error binding to %s:%d, %s\n"), inet_ntoa(si_me.sin_addr), sourceport, strerror(errno));
return 1;
}
@@ -985,11 +994,11 @@ int main (int argc, char **argv) {
/* Bind to udp port */
if (bind(mndpsockfd, (struct sockaddr *)&si_me_mndp, sizeof(si_me_mndp))==-1) {
- fprintf(stderr, "MNDP: Error binding to %s:%d, %s\n", inet_ntoa(si_me_mndp.sin_addr), MT_MNDP_PORT, strerror(errno));
+ fprintf(stderr, _("MNDP: Error binding to %s:%d, %s\n"), inet_ntoa(si_me_mndp.sin_addr), MT_MNDP_PORT, strerror(errno));
}
openlog("mactelnetd", LOG_PID, LOG_DAEMON);
- syslog(LOG_NOTICE, "Bound to %s:%d", inet_ntoa(si_me.sin_addr), sourceport);
+ syslog(LOG_NOTICE, _("Bound to %s:%d"), inet_ntoa(si_me.sin_addr), sourceport);
/* Enumerate available interfaces */
net_get_interfaces(interfaces, MAX_INTERFACES);
@@ -1015,7 +1024,7 @@ int main (int argc, char **argv) {
}
if (interface_count == 0) {
- syslog(LOG_ERR, "Unable to find any valid network interfaces\n");
+ syslog(LOG_ERR, _("Unable to find any valid network interfaces\n"));
exit(1);
}
@@ -1091,9 +1100,9 @@ int main (int argc, char **argv) {
init_packet(&pdata, MT_PTYPE_END, p->dstmac, p->srcmac, p->seskey, p->outcounter);
send_udp(p, &pdata);
if (p->username != NULL) {
- syslog(LOG_INFO, "(%d) Connection to user %s closed.", p->seskey, p->username);
+ syslog(LOG_INFO, _("(%d) Connection to user %s closed."), p->seskey, p->username);
} else {
- syslog(LOG_INFO, "(%d) Connection closed.", p->seskey);
+ syslog(LOG_INFO, _("(%d) Connection closed."), p->seskey);
}
tmp.next = p->next;
list_remove_connection(p);
@@ -1101,7 +1110,7 @@ int main (int argc, char **argv) {
}
}
else if (p->state == STATE_ACTIVE && p->ptsfd > 0 && p->wait_for_ack == 1 && FD_ISSET(p->ptsfd, &read_fds)) {
- printf("(%d) Waiting for ack\n", p->seskey);
+ printf(_("(%d) Waiting for ack\n"), p->seskey);
}
}
/* Handle select() timeout */
@@ -1117,9 +1126,9 @@ int main (int argc, char **argv) {
struct mt_connection *p,tmp;
for (p = connections_head; p != NULL; p = p->next) {
if (now - p->lastdata >= MT_CONNECTION_TIMEOUT) {
- syslog(LOG_INFO, "(%d) Session timed out", p->seskey);
+ syslog(LOG_INFO, _("(%d) Session timed out"), p->seskey);
init_packet(&pdata, MT_PTYPE_DATA, p->dstmac, p->srcmac, p->seskey, p->outcounter);
- add_control_packet(&pdata, MT_CPTYPE_PLAINDATA, "Timeout\r\n", 9);
+ add_control_packet(&pdata, MT_CPTYPE_PLAINDATA, _("Timeout\r\n"), 9);
send_udp(p, &pdata);
init_packet(&pdata, MT_PTYPE_END, p->dstmac, p->srcmac, p->seskey, p->outcounter);
send_udp(p, &pdata);
diff --git a/mndp.c b/mndp.c
index 7f81545..1b070e2 100644
--- a/mndp.c
+++ b/mndp.c
@@ -16,6 +16,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <libintl.h>
+#include <locale.h>
#include <stdlib.h>
#include <stdio.h>
#include <arpa/inet.h>
@@ -24,6 +26,8 @@
#include "protocol.h"
#include "config.h"
+#define _(String) gettext (String)
+
/* Protocol data direction, not used here, but obligatory for protocol.c */
unsigned char mt_direction_fromserver = 0;
@@ -33,6 +37,10 @@ int main(int argc, char **argv) {
struct sockaddr_in si_me, si_remote;
unsigned char buff[MT_PACKET_LEN];
+ setlocale(LC_ALL, "");
+ bindtextdomain("mactelnet","/usr/share/locale");
+ textdomain("mactelnet");
+
/* Open a UDP socket handle */
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
@@ -46,16 +54,16 @@ int main(int argc, char **argv) {
/* Bind to specified address/port */
if (bind(sock, (struct sockaddr *)&si_me, sizeof(si_me))==-1) {
- fprintf(stderr, "Error binding to %s:%d\n", inet_ntoa(si_me.sin_addr), MT_MNDP_PORT);
+ fprintf(stderr, _("Error binding to %s:%d\n"), inet_ntoa(si_me.sin_addr), MT_MNDP_PORT);
return 1;
}
/* Write informative message to STDERR to make it easier to use the output in simple scripts */
- fprintf(stderr, "Searching for MikroTik routers... Abort with CTRL+C.\n");
+ fprintf(stderr, _("Searching for MikroTik routers... Abort with CTRL+C.\n"));
/* Set the socket to allow sending broadcast packets */
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &optval, sizeof (optval))==-1) {
- fprintf(stderr, "Unable to send broadcast packets: Operating in receive only mode.\n");
+ fprintf(stderr, _("Unable to send broadcast packets: Operating in receive only mode.\n"));
} else {
/* Request routers identify themselves */
unsigned int message = 0;
@@ -65,7 +73,7 @@ int main(int argc, char **argv) {
si_remote.sin_port = htons(MT_MNDP_PORT);
si_remote.sin_addr.s_addr = htonl(INADDR_BROADCAST);
if (sendto (sock, &message, sizeof (message), 0, (struct sockaddr *)&si_remote, sizeof(si_remote))==-1) {
- fprintf(stderr, "Unable to send broadcast packet: Operating in receive only mode.\n");
+ fprintf(stderr, _("Unable to send broadcast packet: Operating in receive only mode.\n"));
}
}
@@ -74,7 +82,7 @@ int main(int argc, char **argv) {
/* Wait for a UDP packet */
result = recvfrom(sock, buff, MT_PACKET_LEN, 0, 0, 0);
if (result < 0) {
- fprintf(stderr, "Error occured. aborting\n");
+ fprintf(stderr, _("An error occured. aborting\n"));
exit(1);
}
@@ -88,7 +96,7 @@ int main(int argc, char **argv) {
printf(" (%s %s %s)", packet->platform, packet->version, packet->hardware);
}
if (packet->uptime > 0) {
- printf(" up %d days %d hours", packet->uptime / 86400, packet->uptime % 86400 / 3600);
+ printf(_(" up %d days %d hours"), packet->uptime / 86400, packet->uptime % 86400 / 3600);
}
putchar('\n');
}
diff --git a/po/mactelnet.pot b/po/mactelnet.pot
new file mode 100644
index 0000000..bd1734e
--- /dev/null
+++ b/po/mactelnet.pot
@@ -0,0 +1,397 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: mactelnet\n"
+"Report-Msgid-Bugs-To: haakon.nessjoen@gmail.com\n"
+"POT-Creation-Date: 2012-02-28 14:29+0100\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"
+
+#: interfaces.c:287
+#, c-format
+msgid "packet size too large\n"
+msgstr ""
+
+#: macping.c:89
+#, c-format
+msgid "%d packets transmitted, %d packets received, %d%% packet loss\n"
+msgstr ""
+
+#: macping.c:90
+#, c-format
+msgid "round-trip min/avg/max = %.2f/%.2f/%.2f ms\n"
+msgstr ""
+
+#: macping.c:149
+#, c-format
+msgid ""
+"Number of packets to send must be more than 0 and less than 100 in fast "
+"mode.\n"
+msgstr ""
+
+#: macping.c:155
+#, c-format
+msgid "Usage: %s <MAC> [-h] [-f] [-c <count>] [-s <packet size>]\n"
+msgstr ""
+
+#: macping.c:158
+#, c-format
+msgid ""
+"\n"
+"Parameters:\n"
+msgstr ""
+
+#: macping.c:159
+#, c-format
+msgid " MAC MAC-Address of the RouterOS/mactelnetd device.\n"
+msgstr ""
+
+#: macping.c:160
+#, c-format
+msgid " -f Fast mode, do not wait before sending next ping request.\n"
+msgstr ""
+
+#: macping.c:161
+#, c-format
+msgid " -s Specify size of ping packet.\n"
+msgstr ""
+
+#: macping.c:162
+#, c-format
+msgid " -c Number of packets to send. (0 = unlimited)\n"
+msgstr ""
+
+#: macping.c:163
+#, c-format
+msgid " -h This help.\n"
+msgstr ""
+
+#: macping.c:170
+#, c-format
+msgid "Packet size must be between 18 and %d\n"
+msgstr ""
+
+#: macping.c:179 mactelnetd.c:934
+#, c-format
+msgid "You need to have root privileges to use %s.\n"
+msgstr ""
+
+#: macping.c:207 mndp.c:57 protocol.c:429
+#, c-format
+msgid "Error binding to %s:%d\n"
+msgstr ""
+
+#: macping.c:266
+#, c-format
+msgid "Error sending packet.\n"
+msgstr ""
+
+#: macping.c:284
+#, c-format
+msgid "%s ping timeout\n"
+msgstr ""
+
+#: macping.c:322
+#, c-format
+msgid "%s %d byte, ping time %.2f ms%s\n"
+msgstr ""
+
+#: macping.c:324
+#, c-format
+msgid "%s Reply of %d bytes of unequal data\n"
+msgstr ""
+
+#: mactelnet.c:154
+#, c-format
+msgid ""
+"\n"
+"Connection timed out\n"
+msgstr ""
+
+#: mactelnet.c:303
+#, c-format
+msgid "Connection closed.\n"
+msgstr ""
+
+#: mactelnet.c:309
+#, c-format
+msgid "Unhandeled packet type: %d received from server %s\n"
+msgstr ""
+
+#: mactelnet.c:331
+#, c-format
+msgid "Error: No suitable devices found\n"
+msgstr ""
+
+#: mactelnet.c:459
+#, c-format
+msgid ""
+"Usage: %s <MAC|identity> [-h] [-n] [-t <timeout>] [-u <username>] [-p "
+"<password>]\n"
+msgstr ""
+
+#: mactelnet.c:462
+#, c-format
+msgid ""
+"\n"
+"Parameters:\n"
+" MAC MAC-Address of the RouterOS/mactelnetd device. Use mndp to "
+"discover it.\n"
+" identity The identity/name of your destination device. Uses MNDP protocol "
+"to find it.\n"
+" -n Do not use broadcast packets. Less insecure but requires root "
+"privileges.\n"
+" -t Amount of seconds to wait for a response on each interface.\n"
+" -u Specify username on command line.\n"
+" -p Specify password on command line.\n"
+" -q Quiet mode.\n"
+" -h This help.\n"
+"\n"
+msgstr ""
+
+#: mactelnet.c:486
+#, c-format
+msgid "You need to have root privileges to use the -n parameter.\n"
+msgstr ""
+
+#: mactelnet.c:518
+#, c-format
+msgid "Login: "
+msgstr ""
+
+#: mactelnet.c:525
+msgid "Password: "
+msgstr ""
+
+#: mactelnet.c:550
+#, c-format
+msgid "Connecting to %s..."
+msgstr ""
+
+#: mactelnet.c:560 mactelnetd.c:244 mactelnetd.c:975
+#, c-format
+msgid "Error binding to %s:%d, %s\n"
+msgstr ""
+
+#: mactelnet.c:565
+#, c-format
+msgid "Connection failed.\n"
+msgstr ""
+
+#: mactelnet.c:569
+#, c-format
+msgid "done\n"
+msgstr ""
+
+#: mactelnetd.c:249
+#, c-format
+msgid "Listening on %s for %s\n"
+msgstr ""
+
+#: mactelnetd.c:409
+#, c-format
+msgid "(%d) Invalid login by %s."
+msgstr ""
+
+#: mactelnetd.c:411
+msgid "Login failed, incorrect username or password\r\n"
+msgstr ""
+
+#: mactelnetd.c:427
+msgid "Terminal error\r\n"
+msgstr ""
+
+#: mactelnetd.c:438
+#, c-format
+msgid "(%d) Login ok, but local user not accessible (%s)."
+msgstr ""
+
+#: mactelnetd.c:439
+msgid "Local user not accessible\r\n"
+msgstr ""
+
+#: mactelnetd.c:448
+#, c-format
+msgid "Error opening %s: %s"
+msgstr ""
+
+#: mactelnetd.c:449
+msgid "Error opening terminal\r\n"
+msgstr ""
+
+#: mactelnetd.c:460
+#, c-format
+msgid "(%d) User %s logged in."
+msgstr ""
+
+#: mactelnetd.c:498
+#, c-format
+msgid "(%d) Could not log in %s (%d:%d): setuid/setgid: %s"
+msgstr ""
+
+#: mactelnetd.c:499
+msgid "Internal error\r\n"
+msgstr ""
+
+#: mactelnetd.c:505
+#, c-format
+msgid "(%d) User %s disconnected with "
+msgstr ""
+
+#: mactelnetd.c:598
+#, c-format
+msgid "(%d) Unhandeled control packet type: %d"
+msgstr ""
+
+#: mactelnetd.c:644
+#, c-format
+msgid "(%d) New connection from %s."
+msgstr ""
+
+#: mactelnetd.c:672 mactelnetd.c:1105
+#, c-format
+msgid "(%d) Connection closed."
+msgstr ""
+
+#: mactelnetd.c:718
+#, c-format
+msgid "(%d) Unhandeled packet type: %d"
+msgstr ""
+
+#: mactelnetd.c:810
+msgid ""
+"\r\n"
+"\r\n"
+"Daemon shutting down.\r\n"
+msgstr ""
+
+#: mactelnetd.c:812
+msgid "Daemon shutting down"
+msgstr ""
+
+#: mactelnetd.c:843
+msgid "SIGHUP: Reloading interfaces"
+msgstr ""
+
+#: mactelnetd.c:854
+msgid "No devices found! Exiting.\n"
+msgstr ""
+
+#: mactelnetd.c:868
+#, c-format
+msgid "(%d) Connection closed because interface %s is gone."
+msgstr ""
+
+#: mactelnetd.c:921
+#, c-format
+msgid "Usage: %s [-f|-n|-h]\n"
+msgstr ""
+
+#: mactelnetd.c:924
+#, c-format
+msgid ""
+"\n"
+"Parameters:\n"
+" -f Run process in foreground.\n"
+" -n Do not use broadcast packets. Just a tad less insecure.\n"
+" -h This help.\n"
+"\n"
+msgstr ""
+
+#: mactelnetd.c:997
+#, c-format
+msgid "MNDP: Error binding to %s:%d, %s\n"
+msgstr ""
+
+#: mactelnetd.c:1001
+#, c-format
+msgid "Bound to %s:%d"
+msgstr ""
+
+#: mactelnetd.c:1027
+msgid "Unable to find any valid network interfaces\n"
+msgstr ""
+
+#: mactelnetd.c:1103
+#, c-format
+msgid "(%d) Connection to user %s closed."
+msgstr ""
+
+#: mactelnetd.c:1113
+#, c-format
+msgid "(%d) Waiting for ack\n"
+msgstr ""
+
+#: mactelnetd.c:1129
+#, c-format
+msgid "(%d) Session timed out"
+msgstr ""
+
+#: mactelnetd.c:1131
+msgid "Timeout\r\n"
+msgstr ""
+
+#: mndp.c:62
+#, c-format
+msgid "Searching for MikroTik routers... Abort with CTRL+C.\n"
+msgstr ""
+
+#: mndp.c:66
+#, c-format
+msgid "Unable to send broadcast packets: Operating in receive only mode.\n"
+msgstr ""
+
+#: mndp.c:76
+#, c-format
+msgid "Unable to send broadcast packet: Operating in receive only mode.\n"
+msgstr ""
+
+#: mndp.c:85
+#, c-format
+msgid "An error occured. aborting\n"
+msgstr ""
+
+#: mndp.c:99
+#, c-format
+msgid " up %d days %d hours"
+msgstr ""
+
+#: protocol.c:84 protocol.c:148
+#, c-format
+msgid "add_control_packet: ERROR, too large packet. Exceeds %d bytes\n"
+msgstr ""
+
+#: protocol.c:280
+#, c-format
+msgid "mndp_add_attribute: ERROR, too large packet. Exceeds %d bytes\n"
+msgstr ""
+
+#: protocol.c:444
+#, c-format
+msgid "Unable to send broadcast packet: Router lookup will be slow\n"
+msgstr ""
+
+#: protocol.c:527
+#, c-format
+msgid "Searching for '%s'..."
+msgstr ""
+
+#: protocol.c:531
+#, c-format
+msgid "not found\n"
+msgstr ""
+
+#: protocol.c:538
+#, c-format
+msgid "found\n"
+msgstr ""
diff --git a/protocol.c b/protocol.c
index 53380d1..4167d5e 100644
--- a/protocol.c
+++ b/protocol.c
@@ -17,6 +17,8 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define _BSD_SOURCE
+#include <libintl.h>
+#include <locale.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -32,6 +34,8 @@
#include "protocol.h"
#include "config.h"
+#define _(String) gettext (String)
+
int init_packet(struct mt_packet *packet, enum mt_ptype ptype, unsigned char *srcmac, unsigned char *dstmac, unsigned short sessionkey, unsigned int counter) {
unsigned char *data = packet->data;
@@ -77,7 +81,7 @@ int add_control_packet(struct mt_packet *packet, enum mt_cptype cptype, void *cp
/* Something is really wrong. Packets should never become over 1500 bytes */
if (packet->size + MT_CPHEADER_LEN + data_len > MT_PACKET_LEN) {
- fprintf(stderr, "add_control_packet: ERROR, too large packet. Exceeds %d bytes\n", MT_PACKET_LEN);
+ fprintf(stderr, _("add_control_packet: ERROR, too large packet. Exceeds %d bytes\n"), MT_PACKET_LEN);
return -1;
//exit(1);
}
@@ -141,7 +145,7 @@ int init_pongpacket(struct mt_packet *packet, unsigned char *srcmac, unsigned ch
int add_packetdata(struct mt_packet *packet, unsigned char *data, unsigned short length) {
if (packet->size + length > MT_PACKET_LEN) {
- fprintf(stderr, "add_control_packet: ERROR, too large packet. Exceeds %d bytes\n", MT_PACKET_LEN);
+ fprintf(stderr, _("add_control_packet: ERROR, too large packet. Exceeds %d bytes\n"), MT_PACKET_LEN);
return -1;
}
@@ -273,7 +277,7 @@ int mndp_add_attribute(struct mt_packet *packet, enum mt_mndp_attrtype attrtype,
/* Something is really wrong. Packets should never become over 1500 bytes */
if (packet->size + 4 + data_len > MT_PACKET_LEN) {
- fprintf(stderr, "mndp_add_attribute: ERROR, too large packet. Exceeds %d bytes\n", MT_PACKET_LEN);
+ fprintf(stderr, _("mndp_add_attribute: ERROR, too large packet. Exceeds %d bytes\n"), MT_PACKET_LEN);
return -1;
}
@@ -422,7 +426,7 @@ int query_mndp(const char *identity, unsigned char *mac) {
/* Bind to specified address/port */
if (bind(sock, (struct sockaddr *)&si_me, sizeof(si_me)) == -1) {
- fprintf(stderr, "Error binding to %s:%d\n", inet_ntoa(si_me.sin_addr), MT_MNDP_PORT);
+ fprintf(stderr, _("Error binding to %s:%d\n"), inet_ntoa(si_me.sin_addr), MT_MNDP_PORT);
close(sock);
return 0;
}
@@ -437,7 +441,7 @@ int query_mndp(const char *identity, unsigned char *mac) {
si_remote.sin_addr.s_addr = htonl(INADDR_BROADCAST);
if (sendto(sock, &message, sizeof (message), 0, (struct sockaddr *)&si_remote, sizeof(si_remote)) == -1) {
- fprintf(stderr, "Unable to send broadcast packet: Router lookup will be slow\n");
+ fprintf(stderr, _("Unable to send broadcast packet: Router lookup will be slow\n"));
fastlookup = 0;
} else {
fastlookup = 1;
@@ -520,18 +524,18 @@ int query_mndp_or_mac(char *address, unsigned char *dstmac, int verbose) {
* Search for Router by identity name, using MNDP
*/
if (verbose) {
- fprintf(stderr, "Searching for '%s'...", address);
+ fprintf(stderr, _("Searching for '%s'..."), address);
}
if (!query_mndp(address, dstmac)) {
if (verbose) {
- fprintf(stderr, "not found\n");
+ fprintf(stderr, _("not found\n"));
}
return 0;
}
/* Router found, display mac and continue */
if (verbose) {
- fprintf(stderr, "found\n");
+ fprintf(stderr, _("found\n"));
}
} else {
/* Convert mac address string to ether_addr struct */