summaryrefslogtreecommitdiff
path: root/mndp.c
diff options
context:
space:
mode:
authorBoian Bonev <bbonev@ipacct.com>2012-10-30 08:18:39 +0200
committerBoian Bonev <bbonev@ipacct.com>2012-10-30 08:18:39 +0200
commit9fc27002f6566f01bc68303ed8496ae0059601f4 (patch)
tree40bd2a54aa6445a9fbd9cba603c44ee90e211121 /mndp.c
parentfcd2e8043815a9f5ccfb11786579e1563adfb889 (diff)
parent11b726cee17622304839279fdce47feb9b86f4f7 (diff)
downloadMAC-Telnet-9fc27002f6566f01bc68303ed8496ae0059601f4.tar.gz
MAC-Telnet-9fc27002f6566f01bc68303ed8496ae0059601f4.zip
Merge branch 'master' of https://github.com/haakonnessjoen/MAC-Telnet
Diffstat (limited to 'mndp.c')
-rw-r--r--mndp.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/mndp.c b/mndp.c
index 1b070e2..b229d3b 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 %s\E[m\n", _("MAC-Address"), _("Identity (platform version hardware) uptime"));
+
while(1) {
struct mt_mndp_info *packet;
/* Wait for a UDP packet */
@@ -91,7 +104,7 @@ int main(int argc, char **argv) {
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);
}