- static char ch[] = "*XcstpogDL";
- int keep_time;
- char *s;
-
- ch[0] = flags & SC_SENDING_FILE ? '*' : ' ';
- ch[1] = S_ISDIR(file->mode) ? 'd' : IS_DEVICE(file->mode) ? 'D'
- : S_ISLNK(file->mode) ? 'L' : 'f';
-
- if (statret < 0) {
- for (s = ch + 2; *s; ) *s++ = '+';
- goto print_it;
- }
-
- keep_time = !preserve_times ? 0
- : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode);
-
- ch[2] = !(flags & SC_CHECKSUM_CHANGED) ? '-' : 'c';
- ch[3] = !S_ISREG(file->mode) || file->length == st->st_size ? '-' : 's';
- ch[4] = flags & SC_SENDING_FILE && !keep_time ? 'T'
- : !keep_time || file->modtime == st->st_mtime ? '-' : 't';
- ch[5] = !preserve_perms || file->mode == st->st_mode ? '-' : 'p';
- ch[6] = !am_root || !preserve_uid || file->uid == st->st_uid ? '-' : 'o';
- ch[7] = preserve_gid && file->gid != GID_NONE && st->st_gid != file->gid ? 'g' : '-';
- ch[8] = IS_DEVICE(file->mode) && file->u.rdev != st->st_rdev ? 'D' : '-';
- ch[9] = flags & SC_SYMLINK_CHANGED ? 'L' : '-';
-
- if (flags & SC_NO_BASIS)
- ch[4] = ch[5] = ch[6] = ch[7] = '-';
-
- s = ch + 2;
- if (!(flags & SC_SENDING_FILE))
- while (*s == '-') s++;
- if (*s) {
- print_it:
- rprintf(FINFO, "%s %s%s%s", ch, fname,
- ch[1] == 'd' ? "/" : "",
- flags & SC_NO_NL ? "" : "\n");
+ int iflags = sflags & (SID_UPDATING | SID_REPORT_CHECKSUM);
+
+ if (statret >= 0) {
+ if (S_ISREG(file->mode) && file->length != st->st_size)
+ iflags |= ITEM_REPORT_SIZE;
+ } else
+ iflags |= ITEM_IS_NEW;
+ if (statret >= 0 && !(sflags & SID_NO_DEST_AND_NO_UPDATE)) {
+ int keep_time = !preserve_times ? 0
+ : S_ISDIR(file->mode) ? !omit_dir_times : !S_ISLNK(file->mode);
+
+ if ((iflags & ITEM_UPDATING && !keep_time)
+ || (keep_time && file->modtime != st->st_mtime))
+ iflags |= ITEM_REPORT_TIME;
+ if (preserve_perms && file->mode != st->st_mode)
+ iflags |= ITEM_REPORT_PERMS;
+ if (preserve_uid && am_root && file->uid != st->st_uid)
+ iflags |= ITEM_REPORT_OWNER;
+ if (preserve_gid && file->gid != GID_NONE && st->st_gid != file->gid)
+ iflags |= ITEM_REPORT_GROUP;
+ }
+
+ if (iflags && !read_batch) {
+ if (ndx >= 0)
+ write_int(f_out, ndx);
+ write_byte(f_out, iflags);
+ write_byte(f_out, iflags >> 8);