1 /* $Id: testgetifaddr.c,v 1.5 2012/06/22 16:11:58 nanard Exp $ */
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 */
12 /* solaris 10 does not define LOG_PERROR */
16 int main(int argc
, char * * argv
) {
19 fprintf(stderr
, "Usage:\t%s interface_name\n", argv
[0]);
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]);
28 printf("Interface %s has IP address %s.\n", argv
[1], addr
);