host[(sizeof host) - 1] = 0; strncpy(host, *args++, (sizeof host) - 1);
safe_strncpy(host, *args++, (sizeof host));
static int arp_set(char **args){    char host[128];    struct arpreq req;    struct sockaddr sa;    int flags;    memset((char *) &req, 0, sizeof(req));    /* Resolve the host name. */    if (*args == NULL) {	fprintf(stderr, _("arp: need host name\n"));	return (-1);    }    host[(sizeof host) - 1] = 0;    strncpy(host, *args++, (sizeof host) - 1);    if (ap->input(0, host, &sa) < 0) {	ap->herror(host);	return (-1);    }    /* If a host has more than one address, use the correct one! */    memcpy((char *) &req.arp_pa, (char *) &sa, sizeof(struct sockaddr));    /* Fetch the hardware address. */    if (*args == NULL) {	fprintf(stderr, _("arp: need hardware address\n"));	return (-1);    }    if (opt_D) {	if (arp_getdevhw(*args++, &req.arp_ha, hw_set ? hw : NULL) < 0)	    return (-1);    } else {	if (hw->input(*args++, &req.arp_ha) < 0) {	    fprintf(stderr, _("arp: invalid hardware address\n"));	    return (-1);	}    }    /* Check out any modifiers. */    flags = ATF_PERM | ATF_COM;    while (*args != NULL) {	if (!strcmp(*args, "temp")) {	    flags &= ~ATF_PERM;	    args++;	    continue;	}	if (!strcmp(*args, "pub")) {	    flags |= ATF_PUBL;	    args++;	    continue;	}	if (!strcmp(*args, "priv")) {	    flags &= ~ATF_PUBL;	    args++;	    continue;	}	if (!strcmp(*args, "trail")) {	    flags |= ATF_USETRAILERS;	    args++;	    continue;	}	if (!strcmp(*args, "dontpub")) {#ifdef HAVE_ATF_DONTPUB	    flags |= ATF_DONTPUB;#else	    ENOSUPP("arp", "ATF_DONTPUB");#endif	    args++;	    continue;	}	if (!strcmp(*args, "auto")) {#ifdef HAVE_ATF_MAGIC	    flags |= ATF_MAGIC;#else	    ENOSUPP("arp", "ATF_MAGIC");#endif	    args++;	    continue;	}	if (!strcmp(*args, "dev")) {	    if (*++args == NULL)		usage();	    strncpy(device, *args, sizeof(device) - 1);	    device[sizeof(device) - 1] = '\0';	    args++;	    continue;	}	if (!strcmp(*args, "netmask")) {	    if (*++args == NULL)		usage();	    if (strcmp(*args, "255.255.255.255") != 0) {		strcpy(host, *args);		if (ap->input(0, host, &sa) < 0) {		    ap->herror(host);		    return (-1);		}		memcpy((char *) &req.arp_netmask, (char *) &sa,		       sizeof(struct sockaddr));		flags |= ATF_NETMASK;	    }	    args++;	    continue;	}	usage();    }    /* Fill in the remainder of the request. */    req.arp_flags = flags;    strcpy(req.arp_dev, device);    /* Call the kernel. */    if (opt_v)	fprintf(stderr, "arp: SIOCSARP()\n");    if (ioctl(sockfd, SIOCSARP, &req) < 0) {	if (errno != EINVAL) {	    perror("SIOCSARP");	    return (-1);	}    }    return (0);}