| 1645 | } |
| 1646 | |
| 1647 | int |
| 1648 | main (int argc, char **argv) |
| 1649 | { |
| 1650 | int i; |
| 1651 | struct pending *thispend; |
| 1652 | int n_files; |
| 1653 | |
| 1654 | initialize_main (&argc, &argv); |
| 1655 | set_program_name (argv[0]); |
| 1656 | setlocale (LC_ALL, ""); |
| 1657 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 1658 | textdomain (PACKAGE); |
| 1659 | |
| 1660 | initialize_exit_failure (LS_FAILURE); |
| 1661 | atexit (close_stdout); |
| 1662 | |
| 1663 | static_assert (countof (color_indicator) == countof (indicator_name)); |
| 1664 | |
| 1665 | exit_status = EXIT_SUCCESS; |
| 1666 | print_dir_name = true; |
| 1667 | pending_dirs = NULL; |
| 1668 | |
| 1669 | current_time.tv_sec = TYPE_MINIMUM (time_t); |
| 1670 | current_time.tv_nsec = -1; |
| 1671 | |
| 1672 | i = decode_switches (argc, argv); |
| 1673 | |
| 1674 | if (print_with_color) |
| 1675 | parse_ls_color (); |
| 1676 | |
| 1677 | /* Test print_with_color again, because the call to parse_ls_color |
| 1678 | may have just reset it -- e.g., if LS_COLORS is invalid. */ |
| 1679 | |
| 1680 | if (print_with_color) |
| 1681 | { |
| 1682 | /* Don't use TAB characters in output. Some terminal |
| 1683 | emulators can't handle the combination of tabs and |
| 1684 | color codes on the same line. */ |
| 1685 | tabsize = 0; |
| 1686 | } |
| 1687 | |
| 1688 | if (directories_first) |
| 1689 | check_symlink_mode = true; |
| 1690 | else if (print_with_color) |
| 1691 | { |
| 1692 | /* Avoid following symbolic links when possible. */ |
| 1693 | if (is_colored (C_ORPHAN) |
| 1694 | || (is_colored (C_EXEC) && color_symlink_as_referent) |
| 1695 | || (is_colored (C_MISSING) && format == long_format)) |
| 1696 | check_symlink_mode = true; |
| 1697 | } |
| 1698 | |
| 1699 | if (dereference == DEREF_UNDEFINED) |
| 1700 | dereference = ((immediate_dirs |
| 1701 | || indicator_style == classify |
| 1702 | || format == long_format) |
| 1703 | ? DEREF_NEVER |
| 1704 | : DEREF_COMMAND_LINE_SYMLINK_TO_DIR); |
nothing calls this directly
no test coverage detected