char namebuf[2048];
char *filename;
static void toremote(int argc, char *argv[]){    char *src, *targ, *host, *user;    char *cmd;    int i;    targ = argv[argc - 1];    /* Separate host from filename */    host = targ;    targ = colon(targ);    if (targ == NULL)	bump("targ == NULL in toremote()");    *targ++ = '\0';    if (*targ == '\0')	targ = ".";    /* Substitute "." for emtpy target */    /* Separate host and username */    user = host;    host = strrchr(host, '@');    if (host == NULL) {	host = user;	user = NULL;    } else {	*host++ = '\0';	if (*user == '\0')	    user = NULL;    }    if (argc == 2) {	/* Find out if the source filespec covers multiple files	   if so, we should set the targetshouldbedirectory flag */	HANDLE fh;	WIN32_FIND_DATA fdat;	if (colon(argv[0]) != NULL)	    bump("%s: Remote to remote not supported", argv[0]);	fh = FindFirstFile(argv[0], &fdat);	if (fh == INVALID_HANDLE_VALUE)	    bump("%s: No such file or directory\n", argv[0]);	if (FindNextFile(fh, &fdat))	    targetshouldbedirectory = 1;	FindClose(fh);    }    cmd = smalloc(strlen(targ) + 100);    sprintf(cmd, "scp%s%s%s%s -t %s",	    verbose ? " -v" : "",	    recursive ? " -r" : "",	    preserve ? " -p" : "",	    targetshouldbedirectory ? " -d" : "", targ);    do_cmd(host, user, cmd);    sfree(cmd);    (void) response();    for (i = 0; i < argc - 1; i++) {	HANDLE dir;	WIN32_FIND_DATA fdat;	src = argv[i];	if (colon(src) != NULL) {	    tell_user(stderr, "%s: Remote to remote not supported\n", src);	    errs++;	    continue;	}	dir = FindFirstFile(src, &fdat);	if (dir == INVALID_HANDLE_VALUE) {	    run_err("%s: No such file or directory", src);	    continue;	}	do {	    char *last;	    char namebuf[2048];	    /*	     * Ensure that . and .. are never matched by wildcards,	     * but only by deliberate action.	     */	    if (!strcmp(fdat.cFileName, ".") ||		!strcmp(fdat.cFileName, "..")) {		/*		 * Find*File has returned a special dir. We require		 * that _either_ `src' ends in a backslash followed		 * by that string, _or_ `src' is precisely that		 * string.		 */		int len = strlen(src), dlen = strlen(fdat.cFileName);		if (len == dlen && !strcmp(src, fdat.cFileName)) {		    /* ok */ ;		} else if (len > dlen + 1 && src[len - dlen - 1] == '\\' &&			   !strcmp(src + len - dlen, fdat.cFileName)) {		    /* ok */ ;		} else		    continue;	       /* ignore this one */	    }	    if (strlen(src) + strlen(fdat.cFileName) >= sizeof(namebuf)) {		tell_user(stderr, "%s: Name too long", src);		continue;	    }	    strcpy(namebuf, src);	    if ((last = strrchr(namebuf, '/')) == NULL)		last = namebuf;	    else		last++;	    if (strrchr(last, '\\') != NULL)		last = strrchr(last, '\\') + 1;	    if (last == namebuf && strrchr(namebuf, ':') != NULL)		last = strchr(namebuf, ':') + 1;	    strcpy(last, fdat.cFileName);	    source(namebuf);	} while (FindNextFile(dir, &fdat));	FindClose(dir);    }}