| 3185 | } |
| 3186 | |
| 3187 | static void output_flist(struct file_list *flist) |
| 3188 | { |
| 3189 | char uidbuf[16], gidbuf[16], depthbuf[16]; |
| 3190 | struct file_struct *file; |
| 3191 | const char *root, *dir, *slash, *name, *trail; |
| 3192 | const char *who = who_am_i(); |
| 3193 | int i; |
| 3194 | |
| 3195 | rprintf(FINFO, "[%s] flist start=%d, used=%d, low=%d, high=%d\n", |
| 3196 | who, flist->ndx_start, flist->used, flist->low, flist->high); |
| 3197 | for (i = 0; i < flist->used; i++) { |
| 3198 | file = flist->files[i]; |
| 3199 | if ((am_root || am_sender) && uid_ndx) { |
| 3200 | snprintf(uidbuf, sizeof uidbuf, " uid=%u", |
| 3201 | F_OWNER(file)); |
| 3202 | } else |
| 3203 | *uidbuf = '\0'; |
| 3204 | if (gid_ndx) { |
| 3205 | static const char parens[] = "(\0)\0\0\0"; |
| 3206 | const char *pp = parens + (file->flags & FLAG_SKIP_GROUP ? 0 : 3); |
| 3207 | snprintf(gidbuf, sizeof gidbuf, " gid=%s%u%s", |
| 3208 | pp, F_GROUP(file), pp + 2); |
| 3209 | } else |
| 3210 | *gidbuf = '\0'; |
| 3211 | if (!am_sender) |
| 3212 | snprintf(depthbuf, sizeof depthbuf, "%d", F_DEPTH(file)); |
| 3213 | if (F_IS_ACTIVE(file)) { |
| 3214 | root = am_sender ? NS(F_PATHNAME(file)) : depthbuf; |
| 3215 | if ((dir = file->dirname) == NULL) |
| 3216 | dir = slash = ""; |
| 3217 | else |
| 3218 | slash = "/"; |
| 3219 | name = file->basename; |
| 3220 | trail = S_ISDIR(file->mode) ? "/" : ""; |
| 3221 | } else |
| 3222 | root = dir = slash = name = trail = ""; |
| 3223 | rprintf(FINFO, |
| 3224 | "[%s] i=%d %s %s%s%s%s mode=0%o len=%s%s%s flags=%x\n", |
| 3225 | who, i + flist->ndx_start, |
| 3226 | root, dir, slash, name, trail, |
| 3227 | (int)file->mode, comma_num(F_LENGTH(file)), |
| 3228 | uidbuf, gidbuf, file->flags); |
| 3229 | } |
| 3230 | } |
| 3231 | |
| 3232 | enum fnc_state { s_DIR, s_SLASH, s_BASE, s_TRAILING }; |
| 3233 | enum fnc_type { t_PATH, t_ITEM }; |
no test coverage detected