ftwin 0.8.10
|
Text-based duplicate reporting functions. More...
#include "ft_report.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <apr_strings.h>
#include <apr_file_io.h>
#include "config.h"
#include "debug.h"
#include "ft_archive.h"
#include "ft_config.h"
#include "ft_file.h"
#include "human_size.h"
#include "napr_hash.h"
#include "napr_heap.h"
Go to the source code of this file.
Functions | |
int | ft_chksum_cmp (const void *chksum1, const void *chksum2) |
Comparison function for sorting checksums. | |
static apr_status_t | process_and_report_duplicates_for_file (ft_conf_t *conf, ft_fsize_t *fsize, apr_size_t i, const reporting_colors_t *colors) |
Processes a single file to find and report its duplicates. | |
apr_status_t | ft_report_duplicates (ft_conf_t *conf) |
Reports duplicate files in text format to stdout. | |
static apr_status_t | get_comparison_paths (ft_conf_t *conf, ft_file_t *file_i, ft_file_t *file_j, char **fpathi, char **fpathj) |
Gets the file paths for comparison, handling archive extraction if needed. | |
static void | cleanup_comparison_paths (ft_conf_t *conf, ft_file_t *file_i, ft_file_t *file_j, char *fpathi, char *fpathj) |
Cleans up temporary files created during archive extraction. | |
static void | format_and_print_duplicate (ft_conf_t *conf, const ft_file_t *file, const reporting_colors_t *colors) |
Formats and prints the output for a duplicate file entry. | |
Text-based duplicate reporting functions.
Definition in file ft_report.c.
int ft_chksum_cmp | ( | const void * | chksum1, |
const void * | chksum2 | ||
) |
Comparison function for sorting checksums.
chksum1 | First checksum to compare. |
chksum2 | Second checksum to compare. |
Definition at line 40 of file ft_report.c.
Referenced by ft_report_duplicates(), and ft_report_json().
apr_status_t ft_report_duplicates | ( | ft_conf_t * | conf | ) |
Reports duplicate files in text format to stdout.
conf | The configuration structure containing file information. |
Definition at line 100 of file ft_report.c.
References DEBUG_ERR, ft_chksum_cmp(), napr_hash_search(), napr_heap_extract(), and process_and_report_duplicates_for_file().
Referenced by ftwin_main().
|
static |
Gets the file paths for comparison, handling archive extraction if needed.
Definition at line 149 of file ft_report.c.
|
static |
Processes a single file to find and report its duplicates.
This helper function is called by ft_report_duplicates. It iterates through the checksum array for a given file size, compares subsequent files with the same hash, and calls compare_and_report_pair to verify and report true duplicates. This simplifies the main reporting loop by encapsulating the logic for handling a single file's potential duplicates.
Definition at line 71 of file ft_report.c.
Referenced by ft_report_duplicates().