Someone
public text v1 · immutable#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <stdio.h>
#include <errno.h>
int
main() {
struct ifaddrs *ifa;
struct ifaddrs *p;
if (getifaddrs(&ifa) != 0) {
fprintf(stderr, "error %d\n", errno);
return 1;
}
p = ifa;
while (p != NULL) {
printf("%s\n", p->ifa_name);
p = p->ifa_next;
}
freeifaddrs(ifa);
return 0;
}