--- scp.c.orig 2010-05-11 08:11:25.000000000 -0700 +++ scp.c 2010-05-11 09:03:28.000000000 -0700 @@ -340,7 +340,7 @@ addargs(&args, "-%c%s", ch, optarg); break; case 'P': - addargs(&args, "-p%s", optarg); + pflag = 1; break; case 'B': addargs(&args, "-oBatchmode yes"); @@ -352,7 +352,7 @@ limit_rate = speed * 1024; break; case 'p': - pflag = 1; + addargs(&args, "-p%s", optarg); break; case 'r': iamrecursive = 1; @@ -492,6 +492,7 @@ toremote(char *targ, int argc, char **argv) { char *bp, *host, *src, *suser, *thost, *tuser, *arg; + struct stat stb; arglist alist; int i; @@ -560,6 +561,11 @@ if (remin == -1) { xasprintf(&bp, "%s -t %s", cmd, targ); host = cleanhostname(thost); + + if (stat(argv[i], &stb) < 0) { + fprintf(stderr, "%s: %s\n", argv[i], strerror(errno)); + continue; + } if (do_cmd(host, tuser, bp, &remin, &remout) < 0) exit(1); @@ -586,15 +592,7 @@ for (i = 0; i < argc - 1; i++) { if (!(src = colon(argv[i]))) { /* Local to local. */ freeargs(&alist); - addargs(&alist, "%s", _PATH_CP); - if (iamrecursive) - addargs(&alist, "-r"); - if (pflag) - addargs(&alist, "-p"); - addargs(&alist, "%s", argv[i]); - addargs(&alist, "%s", argv[argc-1]); - if (do_local_cmd(&alist)) - ++errs; + fprintf(stderr, "Cowardly refusing to make a local copy of '%s'.\n", argv[i]); continue; } *src++ = 0; @@ -1172,8 +1170,8 @@ usage(void) { (void) fprintf(stderr, - "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" - " [-l limit] [-o ssh_option] [-P port] [-S program]\n" + "usage: scp [-1246BCPqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" + " [-l limit] [-o ssh_option] [-p port] [-S program]\n" " [[user@]host1:]file1 ... [[user@]host2:]file2\n"); exit(1); }