Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / miniupnpd / testgetifaddr.c
blobf5ec1c7a28bf47cf113eafcd44c2d69077223264
1 /* $Id: testgetifaddr.c,v 1.5 2012/06/22 16:11:58 nanard Exp $ */
2 /* MiniUPnP project
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006-2011 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
7 #include <stdio.h>
8 #include <syslog.h>
9 #include "getifaddr.h"
11 #if defined(__sun)
12 /* solaris 10 does not define LOG_PERROR */
13 #define LOG_PERROR 0
14 #endif
16 int main(int argc, char * * argv) {
17 char addr[64];
18 if(argc < 2) {
19 fprintf(stderr, "Usage:\t%s interface_name\n", argv[0]);
20 return 1;
23 openlog("testgetifaddr", LOG_CONS|LOG_PERROR, LOG_USER);
24 if(getifaddr(argv[1], addr, sizeof(addr)) < 0) {
25 fprintf(stderr, "Cannot get address for interface %s.\n", argv[1]);
26 return 1;
28 printf("Interface %s has IP address %s.\n", argv[1], addr);
29 return 0;