From 7175eb2a1d83ae10a7bc0c1961a6d13fb40a1456 Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Sun, 20 May 2012 16:53:56 +0200 Subject: Added -l option to mactelnet, so you don't have to know about the mndp tool to find it. --- mndp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mndp.c') diff --git a/mndp.c b/mndp.c index 1b070e2..bec7c64 100644 --- a/mndp.c +++ b/mndp.c @@ -28,15 +28,26 @@ #define _(String) gettext (String) +/* This file is also used for the -l option in mactelnet */ +#ifndef FROM_MACTELNET + /* Protocol data direction, not used here, but obligatory for protocol.c */ unsigned char mt_direction_fromserver = 0; int main(int argc, char **argv) { +#else +int mndp(void) { +#endif int sock,result; int optval = 1; struct sockaddr_in si_me, si_remote; unsigned char buff[MT_PACKET_LEN]; +#ifdef FROM_MACTELNET + /* mactelnet.c has this set to 1 */ + mt_direction_fromserver = 0; +#endif + setlocale(LC_ALL, ""); bindtextdomain("mactelnet","/usr/share/locale"); textdomain("mactelnet"); @@ -77,6 +88,8 @@ int main(int argc, char **argv) { } } + printf("\n\E[1m%-17s Identity (platform version hardware) uptime\E[m\n", "MAC-Address"); + while(1) { struct mt_mndp_info *packet; /* Wait for a UDP packet */ -- cgit v1.2.3 From 8d0a3a56e5ce113a962ff04255dc38abac08640f Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Sun, 20 May 2012 17:20:00 +0200 Subject: Fixed missing translation in i18n template. Bugfixed Makefile a bit. --- Makefile | 9 ++++++--- mactelnet.c | 2 +- mndp.c | 4 ++-- po/mactelnet.pot | 51 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 39 insertions(+), 27 deletions(-) (limited to 'mndp.c') diff --git a/Makefile b/Makefile index 5b9ae91..1cecd59 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,14 @@ CC?=gcc all: macping mndp mactelnet mactelnetd -clean: dist-clean +clean: distclean -dist-clean: +distclean: rm -f mactelnet macping mactelnetd mndp + rm po/*.pot rm -f *.o -dist: dist-clean po/mactelnet.pot +dist: distclean po install: all install-docs install -d $(DESTDIR)/usr/bin @@ -27,6 +28,8 @@ install-docs: install -d $(DESTDIR)/usr/share/man/man1/ install docs/*.1 $(DESTDIR)/usr/share/man/man1/ +po: po/mactelnet.pot + po/mactelnet.pot: *.c xgettext --package-name=mactelnet --msgid-bugs-address=haakon.nessjoen@gmail.com -d mactelnet -C -c_ -k_ -kgettext_noop *.c -o po/mactelnet.pot diff --git a/mactelnet.c b/mactelnet.c index 6f2ec80..f83518f 100644 --- a/mactelnet.c +++ b/mactelnet.c @@ -461,7 +461,7 @@ int main (int argc, char **argv) { } if (argc - optind < 1 || print_help) { print_version(); - fprintf(stderr, _("Usage: %s [-h] [-n] [-t ] [-u ] [-p ] | <-l>\n"), argv[0]); + fprintf(stderr, _("Usage: %s [-h] [-n] [-t ] [-u ] [-p ] | -l\n"), argv[0]); if (print_help) { fprintf(stderr, _("\nParameters:\n" diff --git a/mndp.c b/mndp.c index bec7c64..b229d3b 100644 --- a/mndp.c +++ b/mndp.c @@ -88,7 +88,7 @@ int mndp(void) { } } - printf("\n\E[1m%-17s Identity (platform version hardware) uptime\E[m\n", "MAC-Address"); + printf("\n\E[1m%-17s %s\E[m\n", _("MAC-Address"), _("Identity (platform version hardware) uptime")); while(1) { struct mt_mndp_info *packet; @@ -104,7 +104,7 @@ int mndp(void) { if (packet != NULL) { /* Print it */ - printf(" %-17s %s", ether_ntoa((struct ether_addr *)packet->address), packet->identity); + printf("%-17s %s", ether_ntoa((struct ether_addr *)packet->address), packet->identity); if (packet->platform != NULL) { printf(" (%s %s %s)", packet->platform, packet->version, packet->hardware); } diff --git a/po/mactelnet.pot b/po/mactelnet.pot index 415844c..841d607 100644 --- a/po/mactelnet.pot +++ b/po/mactelnet.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: mactelnet\n" "Report-Msgid-Bugs-To: haakon.nessjoen@gmail.com\n" -"POT-Creation-Date: 2012-02-28 15:15+0100\n" +"POT-Creation-Date: 2012-05-20 17:16+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -67,7 +67,7 @@ msgstr "" msgid "You need to have root privileges to use %s.\n" msgstr "" -#: macping.c:207 mndp.c:57 protocol.c:429 +#: macping.c:207 mndp.c:68 protocol.c:429 #, c-format msgid "Error binding to %s:%d\n" msgstr "" @@ -92,36 +92,36 @@ msgstr "" msgid "%s Reply of %d bytes of unequal data\n" msgstr "" -#: mactelnet.c:154 +#: mactelnet.c:155 #, c-format msgid "" "\n" "Connection timed out\n" msgstr "" -#: mactelnet.c:303 +#: mactelnet.c:304 #, c-format msgid "Connection closed.\n" msgstr "" -#: mactelnet.c:309 +#: mactelnet.c:310 #, c-format msgid "Unhandeled packet type: %d received from server %s\n" msgstr "" -#: mactelnet.c:331 +#: mactelnet.c:332 #, c-format msgid "Error: No suitable devices found\n" msgstr "" -#: mactelnet.c:459 +#: mactelnet.c:464 #, c-format msgid "" "Usage: %s [-h] [-n] [-t ] [-u ] [-p " -"]\n" +"] | -l\n" msgstr "" -#: mactelnet.c:462 +#: mactelnet.c:467 #, c-format msgid "" "\n" @@ -130,6 +130,7 @@ msgid "" "discover it.\n" " identity The identity/name of your destination device. Uses MNDP protocol " "to find it.\n" +" -l List/Search for routers nearby. (using MNDP)\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" @@ -140,36 +141,36 @@ msgid "" "\n" msgstr "" -#: mactelnet.c:486 +#: mactelnet.c:492 #, c-format msgid "You need to have root privileges to use the -n parameter.\n" msgstr "" -#: mactelnet.c:518 +#: mactelnet.c:524 #, c-format msgid "Login: " msgstr "" -#: mactelnet.c:525 +#: mactelnet.c:531 msgid "Password: " msgstr "" -#: mactelnet.c:550 +#: mactelnet.c:556 #, c-format msgid "Connecting to %s..." msgstr "" -#: mactelnet.c:560 mactelnetd.c:244 mactelnetd.c:981 +#: mactelnet.c:566 mactelnetd.c:244 mactelnetd.c:981 #, c-format msgid "Error binding to %s:%d, %s\n" msgstr "" -#: mactelnet.c:565 +#: mactelnet.c:571 #, c-format msgid "Connection failed.\n" msgstr "" -#: mactelnet.c:569 +#: mactelnet.c:575 #, c-format msgid "done\n" msgstr "" @@ -329,27 +330,35 @@ msgstr "" msgid "Timeout\r\n" msgstr "" -#: mndp.c:62 +#: mndp.c:73 #, c-format msgid "Searching for MikroTik routers... Abort with CTRL+C.\n" msgstr "" -#: mndp.c:66 +#: mndp.c:77 #, c-format msgid "Unable to send broadcast packets: Operating in receive only mode.\n" msgstr "" -#: mndp.c:76 +#: mndp.c:87 #, c-format msgid "Unable to send broadcast packet: Operating in receive only mode.\n" msgstr "" -#: mndp.c:85 +#: mndp.c:91 +msgid "MAC-Address" +msgstr "" + +#: mndp.c:91 +msgid "Identity (platform version hardware) uptime" +msgstr "" + +#: mndp.c:98 #, c-format msgid "An error occured. aborting\n" msgstr "" -#: mndp.c:99 +#: mndp.c:112 #, c-format msgid " up %d days %d hours" msgstr "" -- cgit v1.2.3