- unsigned char flags;
- static time_t last_time;
- static mode_t last_mode;
- static dev_t last_rdev;
- static uid_t last_uid;
- static gid_t last_gid;
- static char lastname[MAXPATHLEN];
- char *fname;
- int l1,l2;
-
- if (f == -1) return;
+ if (flist->count >= flist->malloced) {
+ void *new_ptr;
+
+ if (flist->malloced < 1000)
+ flist->malloced += 1000;
+ else
+ flist->malloced *= 2;
+
+ if (flist->files) {
+ new_ptr = realloc_array(flist->files,
+ struct file_struct *,
+ flist->malloced);
+ } else {
+ new_ptr = new_array(struct file_struct *,
+ flist->malloced);
+ }
+
+ if (verbose >= 2) {
+ rprintf(FINFO, "expand file_list to %.0f bytes, did%s move\n",
+ (double)sizeof(flist->files[0])
+ * flist->malloced,
+ (new_ptr == flist->files) ? " not" : "");
+ }
+
+ flist->files = (struct file_struct **) new_ptr;
+
+ if (!flist->files)
+ out_of_memory("flist_expand");
+ }
+}
+
+/* These vars are used by both send_file_entry() and receive_file_entry()
+ * (but just one at a time). They have been placed outside these functions
+ * so that we can reset the values when the batch-processing wants to make
+ * extra use of these functions (which needs to start from a known state). */
+static time_t modtime;
+static mode_t mode;
+static DEV64_T rdev; /* just high bytes in p28 onward */
+static uid_t uid;
+static gid_t gid;
+static DEV64_T dev;
+static char lastname[MAXPATHLEN];
+
+void reset_file_entry_vars(void)
+{
+ modtime = 0;
+ mode = 0;
+ rdev = 0;
+ uid = 0;
+ gid = 0;
+ dev = 0;
+ *lastname = '\0';
+}
+
+void send_file_entry(struct file_struct *file, int f, unsigned short base_flags)
+{
+ unsigned short flags;
+ char *fname, fbuf[MAXPATHLEN];
+ int l1, l2;
+
+ if (f == -1)
+ return;