diff options
| author | Thorsten Töpper <atsutane@freethoughts.de> | 2026-03-02 19:16:10 +0100 |
|---|---|---|
| committer | Thorsten Töpper <atsutane@freethoughts.de> | 2026-03-02 19:16:10 +0100 |
| commit | 2bf2617203e2dded958bdf2f0e1825b689e2f83c (patch) | |
| tree | 6477c0754afdc8f82e90cd211402a6159a938888 /src | |
| parent | b5e349ec046d40b1319357e07998b76d6df2911b (diff) | |
| download | duplicate_finder-2bf2617203e2dded958bdf2f0e1825b689e2f83c.tar.gz duplicate_finder-2bf2617203e2dded958bdf2f0e1825b689e2f83c.tar.bz2 | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/file_processor.c | 7 | ||||
| -rw-r--r-- | src/options.c | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/file_processor.c b/src/file_processor.c index c91e223..d689635 100644 --- a/src/file_processor.c +++ b/src/file_processor.c @@ -222,10 +222,11 @@ int process_file(struct df_fileinfo *info) { /* filesystem information collected check whether the DB has a corresponding value, * if so check by size and time whether it looks modified if not, skip - * TODO: option_force needs to be implemented AND memory clean up*/ + */ info_from_db.path = info->path; info_from_db.name = info->name; - if ((dbi_fill_fileinfo(&info_from_db) == 0) && + if ( ! option_force_scan && + (dbi_fill_fileinfo(&info_from_db) == 0) && (info->statbuf.st_size == info_from_db.statbuf.st_size) && (info->statbuf.st_mtim.tv_sec < info_from_db.last_seen) && (info->statbuf.st_mtim.tv_sec == info_from_db.statbuf.st_mtim.tv_sec) && @@ -385,7 +386,7 @@ int process_gdbm_content() { /* file? already processed? */ if (kv_get_type(key) == 'D' || kv_get_bool(key)) { - DBGTRC("DEBUG: Skip\n"); + DBGTRC("DEBUG: Skip directory\n"); tmpkey = key; key = kv_next_key(tmpkey); free(tmpkey); diff --git a/src/options.c b/src/options.c index 0b55df1..cb39442 100644 --- a/src/options.c +++ b/src/options.c @@ -19,6 +19,7 @@ struct option long_options[] = { { "all", no_argument, 0, 0 }, { "database", required_argument, 0 ,0 }, + { "force-scan", no_argument, 0, 0 }, { "help", no_argument, 0, 0 }, { "kv-storage", required_argument, 0, 0}, { "new-kv", no_argument, 0, 0 }, @@ -28,6 +29,7 @@ struct option long_options[] = { enum operation_modes option_mode = MODE_DEV_MESSED_UP; bool option_clean_kv = false; +bool option_force_scan = false; bool option_quiet = false; bool option_show_hidden_entries = false; bool option_show_non_duplicates = false; @@ -46,6 +48,8 @@ void usage(char *executable) { "Different per command, scan includes hidden files, analyze shows every db entry before analysis"); fprintf(stderr, " %-25s %2s %10s - %s\n", "--database", "-d", "", "fullname of the sqlite db to be used"); + fprintf(stderr, " %-25s %2s %10s - %s\n", "--force-scan", "-f", "", + "Don't skip processing files in scan mode if their DB entry matches metadata"); fprintf(stderr, " %-25s %2s %10s - %s\n", "--help", "-h", "", "Show this message and exit"); fprintf(stderr, " %-25s %2s %10s - %s\n", "--kv-storage", "-k", "", @@ -78,6 +82,11 @@ void set_option(const char *option_name, char *option_argument) { return; /* options WITHOUT arguments */ + if (strcmp("force-scan", option_name) == 0) { + option_force_scan = true; + return; + } + if (strcmp("help", option_name) == 0) { usage(exec_name); exit(EXIT_SUCCESS); @@ -123,7 +132,7 @@ int parse_arguments(int argc, char **argv) { while(1) { index = 0; - c = getopt_long(argc, argv, "ad:hk:q", long_options, &index); + c = getopt_long(argc, argv, "ad:fhk:q", long_options, &index); if (c == -1) { break; @@ -139,6 +148,9 @@ int parse_arguments(int argc, char **argv) { case 'd': option_sqlite_db_name = optarg; break; + case 'f': + option_force_scan = true; + break; case 'h': usage(exec_name); exit(EXIT_SUCCESS); |
