/* SPDX-License-Identifier: Apache-2.0 */ /* Copyright 2025 Thorsten Töpper * * dir_monitor - print specified stat() information from entries of a given * directory to stdout. Call it via watch for repeated output to a terminal. * * vim:ts=4:sw=4:expandtab */ #include #include "output.h" #include "data_management.h" #include "options.h" int main(int argc, char **argv) { struct list_head *list = NULL; int path_index = 1; if (argc > 1) { path_index = parse_arguments(argc, argv); if (path_index == argc) { list = get_data_from_directory("."); } else { list = get_data_from_directory(argv[path_index]); } } else { list = get_data_from_directory("."); } if (list == NULL) { return EXIT_FAILURE; } /* Make output code simpler, check whether there were any symlinks resolved */ if (option_resolve_symlinks) { option_resolve_symlinks = contains_resolved_symlinks(list); } if (option_format_string == NULL) { print_list(list); } else { print_list_formatted(option_format_string, list); } destroy_list(list); return EXIT_SUCCESS; }