+extern int copy_unsafe_links;
+extern int protocol_version;
+extern int sanitize_paths;
+
+extern int read_batch;
+extern int write_batch;
+
+extern struct exclude_struct **exclude_list;
+extern struct exclude_struct **server_exclude_list;
+extern struct exclude_struct **local_exclude_list;
+
+int io_error;
+
+static struct file_struct null_file;
+
+static void clean_flist(struct file_list *flist, int strip_root, int no_dups);
+
+
+static int show_filelist_p(void)
+{
+ return verbose && (recurse || files_from) && !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 struct string_area *string_area_new(int size)
+{
+ struct string_area *a;
+
+ if (size <= 0)
+ size = ARENA_SIZE;
+ a = new(struct string_area);
+ if (!a)
+ out_of_memory("string_area_new");
+ a->current = a->base = new_array(char, size);
+ if (!a->current)
+ out_of_memory("string_area_new buffer");
+ a->end = a->base + size;
+ a->next = NULL;
+
+ return a;
+}
+
+static void string_area_free(struct string_area *a)
+{
+ struct string_area *next;
+
+ for (; a; a = next) {
+ next = a->next;
+ free(a->base);
+ }
+}
+
+static char *string_area_malloc(struct string_area **ap, int size)
+{
+ char *p;
+ struct string_area *a;
+
+ /* does the request fit into the current space? */
+ a = *ap;
+ if (a->current + size >= a->end) {
+ /* no; get space, move new string_area to front of the list */
+ a = string_area_new(size > ARENA_SIZE ? size : ARENA_SIZE);
+ a->next = *ap;
+ *ap = a;
+ }
+
+ /* have space; do the "allocation." */
+ p = a->current;
+ a->current += size;
+ return p;
+}
+
+static char *string_area_strdup(struct string_area **ap, const char *src)
+{
+ char *dest = string_area_malloc(ap, strlen(src) + 1);
+ return strcpy(dest, src);
+}
+
+static void list_file_entry(struct file_struct *f)
+{
+ char perms[11];
+
+ if (!f->basename)
+ /* this can happen if duplicate names were removed */
+ return;
+
+ permstring(perms, f->mode);
+
+ if (preserve_links && S_ISLNK(f->mode)) {
+ rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
+ perms,
+ (double) f->length, timestring(f->modtime),
+ f_name(f), f->link);
+ } else {
+ rprintf(FINFO, "%s %11.0f %s %s\n",
+ perms,
+ (double) f->length, timestring(f->modtime),
+ f_name(f));
+ }
+}