continue; if (tuser && !okname(tuser))
toremote(targ, argc, argv)	char *targ, *argv[];	int argc;{	int i, len;	char *bp, *host, *src, *suser, *thost, *tuser;	*targ++ = 0;	if (*targ == 0)		targ = ".";	if ((thost = strrchr(argv[argc - 1], '@'))) {		/* user@host */		*thost++ = 0;		tuser = argv[argc - 1];		if (*tuser == '\0')			tuser = NULL;		else if (!okname(tuser))			exit(1);	} else {		thost = argv[argc - 1];		tuser = NULL;	}	for (i = 0; i < argc - 1; i++) {		src = colon(argv[i]);		if (src) {	/* remote to remote */			static char *ssh_options =			    "-x -o'ClearAllForwardings yes'";			*src++ = 0;			if (*src == 0)				src = ".";			host = strrchr(argv[i], '@');			len = strlen(ssh_program) + strlen(argv[i]) +			    strlen(src) + (tuser ? strlen(tuser) : 0) +			    strlen(thost) + strlen(targ) +			    strlen(ssh_options) + CMDNEEDS + 20;			bp = xmalloc(len);			if (host) {				*host++ = 0;				host = cleanhostname(host);				suser = argv[i];				if (*suser == '\0')					suser = pwd->pw_name;				else if (!okname(suser))					continue;				snprintf(bp, len,				    "%s%s %s -n "				    "-l %s %s %s %s '%s%s%s:%s'",				    ssh_program, verbose_mode ? " -v" : "",				    ssh_options, suser, host, cmd, src,				    tuser ? tuser : "", tuser ? "@" : "",				    thost, targ);			} else {				host = cleanhostname(argv[i]);				snprintf(bp, len,				    "exec %s%s %s -n %s "				    "%s %s '%s%s%s:%s'",				    ssh_program, verbose_mode ? " -v" : "",				    ssh_options, host, cmd, src,				    tuser ? tuser : "", tuser ? "@" : "",				    thost, targ);			}			if (verbose_mode)				fprintf(stderr, "Executing: %s\n", bp);			(void) system(bp);			(void) xfree(bp);		} else {	/* local to remote */			if (remin == -1) {				len = strlen(targ) + CMDNEEDS + 20;				bp = xmalloc(len);				(void) snprintf(bp, len, "%s -t %s", cmd, targ);				host = cleanhostname(thost);				if (do_cmd(host, tuser, bp, &remin,				    &remout, argc) < 0)					exit(1);				if (response() < 0)					exit(1);				(void) xfree(bp);			}			source(1, argv + i);		}	}}