miniupnpd/testgetifaddr: display addr and mask

This commit is contained in:
Thomas Bernard 2013-04-27 17:52:49 +02:00
parent 333c28a502
commit d178b14fd3
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $Id: testgetifaddr.c,v 1.6 2013/03/23 10:46:55 nanard Exp $ */ /* $Id: testgetifaddr.c,v 1.7 2013/04/27 15:38:57 nanard Exp $ */
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard * (c) 2006-2013 Thomas Bernard
@ -6,7 +6,10 @@
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
#include <stdio.h> #include <stdio.h>
#include <syslog.h> #include <syslog.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h>
#include "getifaddr.h" #include "getifaddr.h"
#if defined(__sun) #if defined(__sun)
@ -29,5 +32,7 @@ int main(int argc, char * * argv) {
return 1; return 1;
} }
printf("Interface %s has IP address %s.\n", argv[1], str_addr); printf("Interface %s has IP address %s.\n", argv[1], str_addr);
printf("addr=%s ", inet_ntoa(addr));
printf("mask=%s\n", inet_ntoa(mask));
return 0; return 0;
} }