+extern int copy_unsafe_links;
+extern int protocol_version;
+extern int sanitize_paths;
+extern int delete_excluded;
+extern int orig_umask;
+extern int list_only;
+
+extern struct exclude_list_struct exclude_list;
+extern struct exclude_list_struct server_exclude_list;
+extern struct exclude_list_struct local_exclude_list;
+
+int io_error;
+
+static char empty_sum[MD4_SUM_LENGTH];
+static unsigned int file_struct_len;
+static struct file_list *received_flist;
+
+static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
+static void output_flist(struct file_list *flist, const char *whose_list);
+
+void init_flist(void)
+{
+ struct file_struct f;
+
+ /* Figure out how big the file_struct is without trailing padding */
+ file_struct_len = offsetof(struct file_struct, flags) + sizeof f.flags;
+}
+
+
+static int show_filelist_p(void)
+{
+ return verbose && keep_dirs && !am_server;
+}
+
+static void start_filelist_progress(char *kind)
+{
+ rprintf(FINFO, "%s ... ", kind);
+ if (verbose > 1 || do_progress)
+ rprintf(FINFO, "\n");
+ rflush(FINFO);
+}
+
+
+static void emit_filelist_progress(const struct file_list *flist)
+{
+ rprintf(FINFO, " %d files...\r", flist->count);
+}
+
+
+static void maybe_emit_filelist_progress(const struct file_list *flist)
+{
+ if (do_progress && show_filelist_p() && (flist->count % 100) == 0)
+ emit_filelist_progress(flist);
+}
+
+
+static void finish_filelist_progress(const struct file_list *flist)
+{
+ if (do_progress) {
+ /* This overwrites the progress line */
+ rprintf(FINFO, "%d file%sto consider\n",
+ flist->count, flist->count == 1 ? " " : "s ");
+ } else
+ rprintf(FINFO, "done\n");
+}
+
+void show_flist_stats(void)
+{
+ /* Nothing yet */
+}
+
+
+static void list_file_entry(struct file_struct *f)
+{
+ char perms[11];