free(cp);
put(int argc, char *argv[]){	int fd;	int n;	char *cp, *targ;	if (argc < 2) {		strlcpy(line, "send ", sizeof line);		printf("(file) ");		fgets(&line[strlen(line)], LBUFLEN-strlen(line), stdin);		if (makeargv())			return;		argc = margc;		argv = margv;	}	if (argc < 2) {		putusage(argv[0]);		return;	}	targ = argv[argc - 1];	if (strchr(argv[argc - 1], ':')) {		char *cp;		struct hostent *hp;		for (n = 1; n < argc - 1; n++)			if (strchr(argv[n], ':')) {				putusage(argv[0]);				return;			}		cp = argv[argc - 1];		targ = strchr(cp, ':');		*targ++ = 0;		hp = gethostbyname(cp);		if (hp == NULL) {			warnx("%s: %s", cp, hstrerror(h_errno));			return;		}		bcopy(hp->h_addr, (caddr_t)&peeraddr.sin_addr, hp->h_length);		peeraddr.sin_family = hp->h_addrtype;		connected = 1;		port = sp->s_port;		strlcpy(hostname, hp->h_name, sizeof hostname);	}	if (!connected) {		printf("No target machine specified.\n");		return;	}	if (argc < 4) {		cp = argc == 2 ? tail(targ) : argv[1];		fd = open(cp, O_RDONLY);		if (fd < 0) {			warn("open: %s", cp);			return;		}		if (verbose)			printf("putting %s to %s:%s [%s]\n",			    cp, hostname, targ, mode);		peeraddr.sin_port = port;		sendfile(fd, targ, mode);		return;	}	/* this assumes the target is a directory */	/* on a remote unix system.  hmmmm.  */	for (n = 1; n < argc - 1; n++) {		if (asprintf(&cp, "%s/%s", targ, tail(argv[n])) == -1)			err(1, "asprintf");		fd = open(argv[n], O_RDONLY);		if (fd < 0) {			warn("open: %s", argv[n]);			continue;		}		if (verbose)			printf("putting %s to %s:%s [%s]\n",			    argv[n], hostname, cp, mode);		peeraddr.sin_port = port;		sendfile(fd, cp, mode);		free(cp);	}}