| 1153 | } |
| 1154 | |
| 1155 | static void list_file_entry(struct file_struct *f) |
| 1156 | { |
| 1157 | char permbuf[PERMSTRING_SIZE]; |
| 1158 | const char *mtime_str = timestring(f->modtime); |
| 1159 | int size_width = human_readable ? 14 : 11; |
| 1160 | int mtime_width = 1 + strlen(mtime_str); |
| 1161 | int atime_width = atimes_ndx ? mtime_width : 0; |
| 1162 | int crtime_width = crtimes_ndx ? mtime_width : 0; |
| 1163 | |
| 1164 | if (!F_IS_ACTIVE(f)) { |
| 1165 | /* this can happen if duplicate names were removed */ |
| 1166 | return; |
| 1167 | } |
| 1168 | |
| 1169 | /* TODO: indicate '+' if the entry has an ACL. */ |
| 1170 | |
| 1171 | if (missing_args == 2 && f->mode == 0) { |
| 1172 | rprintf(FINFO, "%-*s %s\n", |
| 1173 | 10 + 1 + size_width + mtime_width + atime_width + crtime_width, "*missing", |
| 1174 | f_name(f, NULL)); |
| 1175 | } else { |
| 1176 | const char *atime_str = atimes_ndx && !S_ISDIR(f->mode) ? timestring(F_ATIME(f)) : ""; |
| 1177 | const char *crtime_str = crtimes_ndx ? timestring(F_CRTIME(f)) : ""; |
| 1178 | const char *arrow, *lnk; |
| 1179 | |
| 1180 | permstring(permbuf, f->mode); |
| 1181 | |
| 1182 | #ifdef SUPPORT_LINKS |
| 1183 | if (preserve_links && S_ISLNK(f->mode)) { |
| 1184 | arrow = " -> "; |
| 1185 | lnk = F_SYMLINK(f); |
| 1186 | } else |
| 1187 | #endif |
| 1188 | arrow = lnk = ""; |
| 1189 | |
| 1190 | rprintf(FINFO, "%s %*s %s%*s%*s %s%s%s\n", |
| 1191 | permbuf, size_width, human_num(F_LENGTH(f)), |
| 1192 | timestring(f->modtime), atime_width, atime_str, crtime_width, crtime_str, |
| 1193 | f_name(f, NULL), arrow, lnk); |
| 1194 | } |
| 1195 | } |
| 1196 | |
| 1197 | static int phase = 0; |
| 1198 | static int dflt_perms; |
no test coverage detected