$NetBSD: patch-ao,v 1.4 2008/04/06 20:21:18 christos Exp $ --- libatalk/util/getiface.c.orig 2005-01-31 14:50:54.000000000 -0500 +++ libatalk/util/getiface.c 2008-04-05 21:32:56.000000000 -0400 @@ -16,6 +16,10 @@ #include #endif +#ifdef HAVE_GETIFADDRS +#include +#endif + #include #include #include @@ -74,6 +78,28 @@ *list = new; return i; +#elif defined(HAVE_GETIFADDRS) + struct ifaddrs *ifa, *a; + int i; + char **new; + + if (!list) + return 0; + if (getifaddrs(&ifa) == -1) + return 0; + for (i = 0, a = ifa; a != NULL; a = a->ifa_next, i++) + continue; + new = malloc((i + 1) * sizeof(char *)); + if (new == NULL) { + freeifaddrs(ifa); + return 0; + } + for (i = 0, a = ifa; a != NULL; a = a->ifa_next) + if (addname(new, &i, a->ifa_name) < 0) + break; + freeifaddrs(ifa); + *list = new; + return i; #else struct ifconf ifc; struct ifreq ifrs[ 64 ], *ifr, *nextifr;