From: David Dykstra Date: Thu, 7 Feb 2002 16:36:12 +0000 (+0000) Subject: Remove the "rsync:" prefixes on FINFO messages. Return the "building file X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/1bbd10fe070d8b07a8c4991e17d1fc04295fe42e Remove the "rsync:" prefixes on FINFO messages. Return the "building file list ... done" to the way it was in 2.5.1 and before when not using -P. Apply the file list progress messages when receiving files in addition to sending files. --- diff --git a/clientserver.c b/clientserver.c index 4c44d26e..87e79908 100644 --- a/clientserver.c +++ b/clientserver.c @@ -79,6 +79,8 @@ int start_socket_client(char *host, char *path, int argc, char *argv[]) if (!user) user = getenv("USER"); if (!user) user = getenv("LOGNAME"); + if (verbose >= 2) { + } fd = open_socket_out_wrapped (host, rsync_port, bind_address, default_af_hint); if (fd == -1) { diff --git a/flist.c b/flist.c index 96ed47f2..9c35d364 100644 --- a/flist.c +++ b/flist.c @@ -34,6 +34,7 @@ extern struct stats stats; extern int verbose; +extern int do_progress; extern int am_server; extern int always_checksum; @@ -69,29 +70,32 @@ static struct file_struct null_file; static void clean_flist(struct file_list *flist, int strip_root); -static int show_build_progress_p(void) +static int show_filelist_p(void) { - extern int do_progress; + return verbose && recurse && !am_server; +} - return do_progress && verbose && recurse && !am_server; +static void start_filelist_progress(char *kind) +{ + rprintf(FINFO, "%s ... ", kind); + if ((verbose > 1) || do_progress) + rprintf(FINFO, "\n"); + rflush(FINFO); } -/** - * True if we're local, etc, and should emit progress emssages. - **/ -static void emit_build_progress(const struct file_list *flist) +static void emit_filelist_progress(const struct file_list *flist) { rprintf(FINFO, " %d files...\r", flist->count); } -static void finish_build_progress(const struct file_list *flist) +static void finish_filelist_progress(const struct file_list *flist) { - if (verbose && recurse && !am_server) { - /* This overwrites the progress line, if any. */ - rprintf(FINFO, RSYNC_NAME ": %d files to consider.\n", - flist->count); - } + if (do_progress) { + /* This overwrites the progress line */ + rprintf(FINFO, "%d files to consider\n", flist->count); + } else + rprintf(FINFO, "done\n"); } @@ -292,7 +296,7 @@ static void flist_expand(struct file_list *flist) new_ptr = realloc(flist->files, new_bytes); if (verbose >= 2) { - rprintf(FINFO, RSYNC_NAME ": expand file_list to %.0f bytes, did%s move\n", + rprintf(FINFO, "expand file_list to %.0f bytes, did%s move\n", (double) new_bytes, (new_ptr == flist->files) ? " not" : ""); } @@ -736,8 +740,8 @@ void send_file_name(int f, struct file_list *flist, char *fname, if (!file) return; - if (show_build_progress_p() & !(flist->count % 100)) - emit_build_progress(flist); + if (do_progress && show_filelist_p() && ((flist->count % 100) == 0)) + emit_filelist_progress(flist); flist_expand(flist); @@ -836,12 +840,8 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) struct file_list *flist; int64 start_write; - if (verbose && recurse && !am_server && f != -1) { - rprintf(FINFO, RSYNC_NAME ": building file list...\n"); - if (verbose > 1) - rprintf(FINFO, "\n"); - rflush(FINFO); - } + if (show_filelist_p() && f != -1) + start_filelist_progress("building file list"); start_write = stats.total_written; @@ -963,7 +963,8 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) send_file_entry(NULL, f, 0); } - finish_build_progress(flist); + if (show_filelist_p()) + finish_filelist_progress(flist); clean_flist(flist, 0); @@ -1001,10 +1002,8 @@ struct file_list *recv_file_list(int f) int64 start_read; extern int list_only; - if (verbose && recurse && !am_server) { - rprintf(FINFO, "receiving file list ... "); - rflush(FINFO); - } + if (show_filelist_p()) + start_filelist_progress("receiving file list"); start_read = stats.total_read; @@ -1033,6 +1032,9 @@ struct file_list *recv_file_list(int f) flist->count++; + if (do_progress && show_filelist_p() && ((flist->count % 100) == 0)) + emit_filelist_progress(flist); + if (verbose > 2) rprintf(FINFO, "recv_file_name(%s)\n", f_name(flist->files[i])); @@ -1044,8 +1046,8 @@ struct file_list *recv_file_list(int f) clean_flist(flist, relative_paths); - if (verbose && recurse && !am_server) { - rprintf(FINFO, "done\n"); + if (show_filelist_p()) { + finish_filelist_progress(flist); } /* now recv the uid/gid list. This was introduced in protocol version 15 */ diff --git a/generator.c b/generator.c index 303b18e7..80f6f135 100644 --- a/generator.c +++ b/generator.c @@ -219,8 +219,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out) if (only_existing && statret == -1 && errno == ENOENT) { /* we only want to update existing files */ - if (verbose > 1) rprintf(FINFO, RSYNC_NAME - ": not creating new file \"%s\"\n",fname); + if (verbose > 1) rprintf(FINFO, "not creating new file \"%s\"\n",fname); return; } @@ -273,7 +272,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out) if (safe_symlinks && unsafe_symlink(file->link, fname)) { if (verbose) { - rprintf(FINFO,RSYNC_NAME ": ignoring unsafe symlink \"%s\" -> \"%s\"\n", + rprintf(FINFO,"ignoring unsafe symlink \"%s\" -> \"%s\"\n", fname,file->link); } return; @@ -301,8 +300,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out) } else { set_perms(fname,file,NULL,0); if (verbose) { - rprintf(FINFO,RSYNC_NAME": %s -> %s\n", - fname,file->link); + rprintf(FINFO,"%s -> %s\n", fname,file->link); } } #endif @@ -334,14 +332,12 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out) if (preserve_hard_links && check_hard_link(file)) { if (verbose > 1) - rprintf(FINFO, RSYNC_NAME - ": \"%s\" is a hard link\n",f_name(file)); + rprintf(FINFO, "\"%s\" is a hard link\n",f_name(file)); return; } if (!S_ISREG(file->mode)) { - rprintf(FINFO, RSYNC_NAME - ": skipping non-regular file \"%s\"\n",fname); + rprintf(FINFO, "skipping non-regular file \"%s\"\n",fname); return; } diff --git a/util.c b/util.c index 5eebe378..8ba34744 100644 --- a/util.c +++ b/util.c @@ -86,7 +86,7 @@ int fd_pair(int fd[2]) void print_child_argv(char **cmd) { - rprintf(FINFO, RSYNC_NAME ": open connection using "); + rprintf(FINFO, "opening connection using "); for (; *cmd; cmd++) { /* Look for characters that ought to be quoted. This * is not a great quoting algorithm, but it's