=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sftp.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- src/usr.bin/ssh/sftp.c 2001/04/08 20:52:55 1.13 +++ src/usr.bin/ssh/sftp.c 2001/04/12 23:17:54 1.14 @@ -24,7 +24,7 @@ #include "includes.h" -RCSID("$OpenBSD: sftp.c,v 1.13 2001/04/08 20:52:55 deraadt Exp $"); +RCSID("$OpenBSD: sftp.c,v 1.14 2001/04/12 23:17:54 mouring Exp $"); /* XXX: commandline mode */ /* XXX: copy between two remote hosts (commandline) */ @@ -141,7 +141,7 @@ void usage(void) { - fprintf(stderr, "usage: sftp [-1vC] [-b batchfile] [-osshopt=value] [user@]host\n"); + fprintf(stderr, "usage: sftp [-1vC] [-b batchfile] [-osshopt=value] [user@]host[:file [file]]\n"); exit(1); } @@ -150,7 +150,8 @@ { int in, out, ch, debug_level, compress_flag; pid_t sshpid; - char *host, *userhost; + char *file1 = NULL; + char *host, *userhost, *cp, *file2; LogLevel ll; extern int optind; extern char *optarg; @@ -195,22 +196,27 @@ } } - if (optind == argc || argc > (optind + 1)) + if (optind == argc || argc > (optind + 2)) usage(); userhost = xstrdup(argv[optind]); + file2 = argv[optind+1]; + if ((cp = strchr(userhost, ':')) != NULL) { + *cp++ = '\0'; + file1 = cp; + } + if ((host = strchr(userhost, '@')) == NULL) host = userhost; else { - *host = '\0'; + *host++ = '\0'; if (!userhost[0]) { fprintf(stderr, "Missing username\n"); usage(); } make_ssh_args("-l"); make_ssh_args(userhost); - host++; } if (!*host) { @@ -249,7 +255,7 @@ connect_to_server(make_ssh_args(NULL), &in, &out, &sshpid); - interactive_loop(in, out); + interactive_loop(in, out, file1, file2); close(in); close(out);