Print stat info. Return zero upon success, nonzero upon failure. */
| 1499 | |
| 1500 | /* Print stat info. Return zero upon success, nonzero upon failure. */ |
| 1501 | static bool |
| 1502 | print_stat (char *pformat, size_t prefix_len, char mod, char m, |
| 1503 | MAYBE_UNUSED int fd, char const *filename, void const *data) |
| 1504 | { |
| 1505 | struct print_args *parg = (struct print_args *) data; |
| 1506 | struct stat *statbuf = parg->st; |
| 1507 | struct timespec btime = parg->btime; |
| 1508 | struct passwd *pw_ent; |
| 1509 | struct group *gw_ent; |
| 1510 | bool fail = false; |
| 1511 | |
| 1512 | switch (m) |
| 1513 | { |
| 1514 | case 'n': |
| 1515 | out_string (pformat, prefix_len, filename); |
| 1516 | break; |
| 1517 | case 'N': |
| 1518 | out_string (pformat, prefix_len, quoteN (filename)); |
| 1519 | if (S_ISLNK (statbuf->st_mode)) |
| 1520 | { |
| 1521 | char *linkname = areadlink_with_size (filename, statbuf->st_size); |
| 1522 | if (linkname == NULL) |
| 1523 | { |
| 1524 | error (0, errno, _("cannot read symbolic link %s"), |
| 1525 | quoteaf (filename)); |
| 1526 | return true; |
| 1527 | } |
| 1528 | printf (" -> "); |
| 1529 | out_string (pformat, prefix_len, quoteN (linkname)); |
| 1530 | free (linkname); |
| 1531 | } |
| 1532 | break; |
| 1533 | case 'd': |
| 1534 | if (mod == 'H') |
| 1535 | out_uint (pformat, prefix_len, major (statbuf->st_dev)); |
| 1536 | else if (mod == 'L') |
| 1537 | out_uint (pformat, prefix_len, minor (statbuf->st_dev)); |
| 1538 | else |
| 1539 | out_uint (pformat, prefix_len, statbuf->st_dev); |
| 1540 | break; |
| 1541 | case 'D': |
| 1542 | out_uint_x (pformat, prefix_len, statbuf->st_dev); |
| 1543 | break; |
| 1544 | case 'i': |
| 1545 | out_uint (pformat, prefix_len, statbuf->st_ino); |
| 1546 | break; |
| 1547 | case 'a': |
| 1548 | out_uint_o (pformat, prefix_len, statbuf->st_mode & CHMOD_MODE_BITS); |
| 1549 | break; |
| 1550 | case 'A': |
| 1551 | out_string (pformat, prefix_len, human_access (statbuf)); |
| 1552 | break; |
| 1553 | case 'f': |
| 1554 | out_uint_x (pformat, prefix_len, statbuf->st_mode); |
| 1555 | break; |
| 1556 | case 'F': |
| 1557 | out_string (pformat, prefix_len, file_type (statbuf)); |
| 1558 | break; |
nothing calls this directly
no test coverage detected