[PATCH] new scp option: specify remote command

Devin Bayer devin at freeshell.org
Sat Nov 5 08:05:32 WST 2005


This option allows me to use a remote command besides scp.
Against version 0.46.  Thanks, Devin Bayer

--- scp.c.orig	2005-11-04 15:57:24.000000000 -0800
+++ scp.c	2005-11-04 15:55:52.000000000 -0800
@@ -120,6 +120,9 @@ int showprogress = 1;
 /* This is the program to execute for the secured connection. ("ssh" or -S) */
 char *ssh_program = _PATH_SSH_PROGRAM;
 
+/* This is the program to execute on the remote end. ("scp" or -w) */
+char *scp_program = "scp";
+
 /* This is used to store the pid of ssh_program */
 pid_t do_cmd_pid = -1;
 
@@ -288,6 +291,9 @@ main(int argc, char **argv)
 		case 'S':
 			ssh_program = xstrdup(optarg);
 			break;
+		case 'w':
+			scp_program = xstrdup(optarg);
+			break;
 		case 'v':
 			addargs(&args, "-v");
 			verbose_mode = 1;
@@ -350,7 +356,8 @@ main(int argc, char **argv)
 	remin = remout = -1;
 	do_cmd_pid = -1;
 	/* Command to be executed on remote system using "ssh". */
-	(void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s",
+	(void) snprintf(cmd, sizeof cmd, "%s%s%s%s%s",
+	    scp_program,
 	    verbose_mode ? " -v" : "",
 	    iamrecursive ? " -r" : "", pflag ? " -p" : "",
 	    targetshouldbedirectory ? " -d" : "");
@@ -1053,8 +1060,8 @@ usage(void)
 {
 	(void) fprintf(stderr,
 	    "usage: scp [-pqrvBC1246] [-F config] [-S program] [-P port]\n"
-	    "           [-c cipher] [-i identity] [-l limit] [-o option]\n"
-	    "           [[user@]host1:]file1 [...] [[user@]host2:]file2\n");
+	    "           [-c cipher] [-i identity] [-w remote prog] [-o option]\n"
+	    "           [-l limit] [[user@]host1:]file1... [[user@]host2:]file2\n");
 	exit(1);
 }
 



More information about the Dropbear mailing list