Re: interface listing code

From: Alex Kirhenshtein <alk_at_DOMAIN_REMOVED>
Date: Mon, 17 May 2004 13:45:42 +0300

Linux alk 2.6.5-gentoo-r1 #1 Mon Apr 19 15:18:06 EEST 2004 i686 Intel(R)
Pentium(R) 4 CPU 2.66GHz GenuineIntel GNU/Linux
- OK

FreeBSD santa.undernet.lv 4.9-RELEASE-p1 FreeBSD 4.9-RELEASE-p1 #0: Tue
Feb 3 18:53:06 GMT 2004
root_at_santa.undernet.lv:/usr/src/sys/compile/GENERIC i386
- OK

OpenBSD hyperion.undernet.lv 3.4 GENERIC#18 i386
- OK

On Sat, 2004-05-15 at 13:27, Victor Kirhenshtein wrote:
> Kto-nibud’ mozet proverit’ etot kod na raznih UNIX’ah?
>
>
>
> #include <stdio.h>
>
> #include <unistd.h>
>
> #include <sys/ioctl.h>
>
> #include <fcntl.h>
>
> #include <stdlib.h>
>
> #include <string.h>
>
> #include <sys/socket.h>
>
> #include <netinet/in.h>
>
> #include <arpa/inet.h>
>
> #include <net/if.h>
>
>
>
> int main(int argc, char *argv[])
>
> {
>
> struct if_nameindex *p;
>
> int i;
>
>
>
> p = if_nameindex();
>
> if (p != NULL)
>
> {
>
> for(i = 0; p[i].if_index != 0; i++)
>
> printf("%d %s\n", p[i].if_index, p[i].if_name);
>
> if_freenameindex(p);
>
> }
>
> else
>
> {
>
> perror("if_nameindex");
>
> }
>
> return 0;
>
> }
>
>
>
>
Received on Mon May 17 2004 - 13:45:42 EEST

This archive was generated by hypermail 2.2.0 : Mon Aug 01 2005 - 00:43:15 EEST