Return an allocated format string in static storage that corresponds to whether FS and TERSE options were declared. */
| 1657 | /* Return an allocated format string in static storage that |
| 1658 | corresponds to whether FS and TERSE options were declared. */ |
| 1659 | static char * |
| 1660 | default_format (bool fs, bool terse, bool device) |
| 1661 | { |
| 1662 | char *format; |
| 1663 | if (fs) |
| 1664 | { |
| 1665 | if (terse) |
| 1666 | format = xstrdup (fmt_terse_fs); |
| 1667 | else |
| 1668 | { |
| 1669 | /* TRANSLATORS: This string uses format specifiers from |
| 1670 | 'stat --help' with --file-system, and NOT from printf. */ |
| 1671 | format = xstrdup (_(" File: \"%n\"\n" |
| 1672 | " ID: %-8i Namelen: %-7l Type: %T\n" |
| 1673 | "Block size: %-10s Fundamental block size: %S\n" |
| 1674 | "Blocks: Total: %-10b Free: %-10f Available: %a\n" |
| 1675 | "Inodes: Total: %-10c Free: %d\n")); |
| 1676 | } |
| 1677 | } |
| 1678 | else /* ! fs */ |
| 1679 | { |
| 1680 | if (terse) |
| 1681 | { |
| 1682 | if (0 < is_selinux_enabled ()) |
| 1683 | format = xstrdup (fmt_terse_selinux); |
| 1684 | else |
| 1685 | format = xstrdup (fmt_terse_regular); |
| 1686 | } |
| 1687 | else |
| 1688 | { |
| 1689 | char *temp; |
| 1690 | /* TRANSLATORS: This string uses format specifiers from |
| 1691 | 'stat --help' without --file-system, and NOT from printf. */ |
| 1692 | format = xstrdup (_("\ |
| 1693 | File: %N\n\ |
| 1694 | Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n\ |
| 1695 | ")); |
| 1696 | |
| 1697 | temp = format; |
| 1698 | if (device) |
| 1699 | { |
| 1700 | /* TRANSLATORS: This string uses format specifiers from |
| 1701 | 'stat --help' without --file-system, and NOT from printf. */ |
| 1702 | format = xasprintf ("%s%s", format, _("\ |
| 1703 | " "Device: %Hd,%Ld\tInode: %-10i Links: %-5h Device type: %Hr,%Lr\n\ |
| 1704 | ")); |
| 1705 | } |
| 1706 | else |
| 1707 | { |
| 1708 | /* TRANSLATORS: This string uses format specifiers from |
| 1709 | 'stat --help' without --file-system, and NOT from printf. */ |
| 1710 | format = xasprintf ("%s%s", format, _("\ |
| 1711 | " "Device: %Hd,%Ld\tInode: %-10i Links: %h\n\ |
| 1712 | ")); |
| 1713 | } |
| 1714 | free (temp); |
| 1715 | |
| 1716 | temp = format; |