MCPcopy Create free account
hub / github.com/coreutils/coreutils / print_long_format

Function print_long_format

src/ls.c:4236–4440  ·  view source on GitHub ↗

Print information about F in long format. */

Source from the content-addressed store, hash-verified

4234
4235/* Print information about F in long format. */
4236static void
4237print_long_format (const struct fileinfo *f)
4238{
4239 char modebuf[12];
4240 char buf
4241 [LONGEST_HUMAN_READABLE + 1 /* inode */
4242 + LONGEST_HUMAN_READABLE + 1 /* size in blocks */
4243 + sizeof (modebuf) - 1 + 1 /* mode string */
4244 + INT_BUFSIZE_BOUND (uintmax_t) /* st_nlink */
4245 + LONGEST_HUMAN_READABLE + 2 /* major device number */
4246 + LONGEST_HUMAN_READABLE + 1 /* minor device number */
4247 + TIME_STAMP_LEN_MAXIMUM + 1 /* max length of time/date */
4248 ];
4249 ptrdiff_t s;
4250 char *p;
4251 struct timespec when_timespec;
4252 struct tm when_local;
4253 bool btime_ok = true;
4254
4255 /* Compute the mode string, except remove the trailing space if no
4256 file in this directory has an ACL or security context. */
4257 if (f->stat_ok)
4258 filemodestring (&f->stat, modebuf);
4259 else
4260 {
4261 modebuf[0] = filetype_letter[f->filetype];
4262 memset (modebuf + 1, '?', 10);
4263 modebuf[11] = '\0';
4264 }
4265 if (! any_has_acl)
4266 modebuf[10] = '\0';
4267 else if (f->acl_type == ACL_T_LSM_CONTEXT_ONLY)
4268 modebuf[10] = '.';
4269 else if (f->acl_type == ACL_T_YES)
4270 modebuf[10] = '+';
4271 else if (f->acl_type == ACL_T_UNKNOWN)
4272 modebuf[10] = '?';
4273
4274 switch (time_type)
4275 {
4276 case time_ctime:
4277 when_timespec = get_stat_ctime (&f->stat);
4278 break;
4279 case time_mtime:
4280 when_timespec = get_stat_mtime (&f->stat);
4281 break;
4282 case time_atime:
4283 when_timespec = get_stat_atime (&f->stat);
4284 break;
4285 case time_btime:
4286 when_timespec = get_stat_btime (&f->stat);
4287 if (when_timespec.tv_sec == -1 && when_timespec.tv_nsec == -1)
4288 btime_ok = false;
4289 break;
4290 case time_numtypes: default:
4291 unreachable ();
4292 }
4293

Callers 1

print_current_filesFunction · 0.85

Calls 14

get_stat_btimeFunction · 0.85
format_inodeFunction · 0.85
dired_indentFunction · 0.85
dired_outbufFunction · 0.85
format_userFunction · 0.85
format_groupFunction · 0.85
format_user_or_groupFunction · 0.85
align_nstrftimeFunction · 0.85
long_time_expected_widthFunction · 0.85
timetostrFunction · 0.85
print_name_with_quotingFunction · 0.85
dired_outstringFunction · 0.85

Tested by

no test coverage detected