arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw)
static int arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw)
arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw){  struct ifreq ifr;  struct hwtype *xhw;  strcpy(ifr.ifr_name, ifname);  if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) {      fprintf(stderr,"arp: cant get HW-Address for `%s': %s.\n", ifname, strerror(errno));      return(-1);  }  if (hw && (ifr.ifr_hwaddr.sa_family!=hw->type)) {      fprintf(stderr,"arp: protocol type missmatch.\n");      return(-1);  }  memcpy((char *)sa, (char *)&(ifr.ifr_hwaddr), sizeof(struct sockaddr));  if (opt_v) {      if (!(xhw = get_hwntype(ifr.ifr_hwaddr.sa_family)) || (xhw->sprint==0)) {        xhw = get_hwntype(-1);      }      fprintf(stderr, "arp: device `%s' has HW address %s `%s'.\n",ifname, xhw->name, xhw->sprint(&ifr.ifr_hwaddr));  }  return(0);}