summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-01-24 04:36:00 +0000
committerMartin Pool <mbp@samba.org>2002-01-24 04:36:00 +0000
commit5ad0e46f080cf071a3fbd77d764ae7fc33adaf16 (patch)
treead7aba58fdbb50e6f6428ac194efec49aa122cd4
parent1b5814e33876c8f2637ec23e8b33556541b938f9 (diff)
downloadrsync-5ad0e46f080cf071a3fbd77d764ae7fc33adaf16.tar.gz
Show command used to start connection child.
-rw-r--r--NEWS3
-rw-r--r--util.c24
2 files changed, 27 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index d371b340..ed02f404 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ rsync 2.5.2 (???)
ENHANCEMENTS:
+ * With -v, rsync now shows the command used to initiate an ssh/rsh
+ connection.
+
* --statistics now shows memory heap usage on platforms that
support mallinfo().
diff --git a/util.c b/util.c
index 63073bd7..f3c126bc 100644
--- a/util.c
+++ b/util.c
@@ -84,6 +84,26 @@ int fd_pair(int fd[2])
}
+void print_child_argv(char **cmd)
+{
+ rprintf(FINFO, RSYNC_NAME ": open connection using ");
+ for (; *cmd; cmd++) {
+ /* Look for characters that ought to be quoted. This
+ * is not a great quoting algorithm, but it's
+ * sufficient for a log message. */
+ if (strspn(*cmd, "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ ",.-_=+@/") != strlen(*cmd)) {
+ rprintf(FINFO, "\"%s\" ", *cmd);
+ } else {
+ rprintf(FINFO, "%s ", *cmd);
+ }
+ }
+ rprintf(FINFO, "\n");
+}
+
+
/* this is derived from CVS code
note that in the child STDIN is set to blocking and STDOUT
@@ -100,6 +120,10 @@ pid_t piped_child(char **command, int *f_in, int *f_out)
int to_child_pipe[2];
int from_child_pipe[2];
extern int blocking_io;
+
+ if (verbose > 0) {
+ print_child_argv(command);
+ }
if (fd_pair(to_child_pipe) < 0 || fd_pair(from_child_pipe) < 0) {
rprintf(FERROR, "pipe: %s\n", strerror(errno));