Andy Angrick wrote:
> Where can i find getHWaddr??
>
> -Andy
>
I don't know I think its a windows thing but maybe this works to
You should probably change this so it is reentrant.
----
char *gethwaddr(char *device)
{
int fd;
static char ethaddr[8];
struct ifreq ifr;
if((fd=socket(AF_INET,SOCK_DGRAM,0))<0)
return 0;
memset(&ifr,0,sizeof(ifr));
strncpy(ifr.ifr_name,device,sizeof(ifr.ifr_name));
if(ioctl(fd,SIOCGIFHWADDR,(char *)&ifr)==-1)
{
close(fd);
return 0;
}
close(fd);
memcpy(ethaddr,&ifr.ifr_hwaddr.sa_data,ETHER_ADDR_LEN);
return ethaddr;
}
--
To unsubscribe from this list, send a message to [EMAIL PROTECTED]
with the command "unsubscribe linux-embedded" in the message body.
For more information, see <http://waste.org/mail/linux-embedded>.