+#ifdef ICONV_OPTION
+ if (ic_ndx)
+ dir_ndx = F_NDX(fp);
+ else
+#endif
+ dir_ndx = end_ndx;
+ write_ndx(f, NDX_FLIST_OFFSET - dir_ndx);
+
+ while (1) {
+ send1extra(f, file, flist);
+ if (send_dir_ndx == end_ndx)
+ break;
+ dp = F_DIRNODE_P(file);
+ send_dir_ndx = DIR_NEXT_SIBLING(dp);
+ file = dir_flist->sorted[send_dir_ndx];
+ }
+ } else {
+ int dir_ndx;
+#ifdef ICONV_OPTION
+ if (ic_ndx)
+ dir_ndx = F_NDX(file);
+ else
+#endif
+ dir_ndx = send_dir_ndx;
+ write_ndx(f, NDX_FLIST_OFFSET - dir_ndx);
+
+ send1extra(f, file, flist);
+ }
+ write_byte(f, 0);
+
+#ifdef ICONV_OPTION
+ if (!need_unsorted_flist)
+#endif
+ dir_flist->sorted = dir_flist->files;
+ add_dirs_to_tree(send_dir_ndx, start, dir_flist->count - 1);
+
+#ifdef ICONV_OPTION
+ if (need_unsorted_flist) {
+ if (inc_recurse) {
+ if (!(flist->sorted = new_array(struct file_struct *, flist->count)))
+ out_of_memory("send_extra_file_list");
+ memcpy(flist->sorted, flist->files,
+ flist->count * sizeof (struct file_struct*));
+ clean_flist(flist, 0);
+ } else
+ flist->sorted = flist->files;
+ } else
+#endif
+ {
+ flist->sorted = flist->files;
+ clean_flist(flist, 0);
+ }
+
+ file_total += flist->count;
+ future_cnt += flist->count;
+ stats.flist_size += stats.total_written - start_write;
+ stats.num_files += flist->count;
+ if (verbose > 3)
+ output_flist(flist);
+
+ dp = F_DIRNODE_P(file);
+ if (DIR_FIRST_CHILD(dp) >= 0) {
+ send_dir_ndx = DIR_FIRST_CHILD(dp);
+ send_dir_depth++;
+ } else {
+ while (DIR_NEXT_SIBLING(dp) < 0) {
+ if ((send_dir_ndx = DIR_PARENT(dp)) < 0) {
+ write_ndx(f, NDX_FLIST_EOF);
+ flist_eof = 1;
+ change_local_filter_dir(NULL, 0, 0);
+ goto finish;
+ }
+ send_dir_depth--;
+ file = dir_flist->sorted[send_dir_ndx];
+ dp = F_DIRNODE_P(file);
+ }
+ send_dir_ndx = DIR_NEXT_SIBLING(dp);
+ }