-t n similarity threshold in bits (0..256) or percent; default: 256
-b float blur factor; add -r when changed between runs; default: 2.5
-r re-scan files already in database
- -I file use file contents as lead-in for output
+ -i text add text as lead-in to output
+ -I file add file contents as lead-in to output
-T n number of scan threads (default: 4)
-h display this help text and exit
```
* `-r` initiates a full re-scan, even for files already present in the
database.
- * `-I` allows to include a custom lead-in in the output, which is in
+ * `-i` include text as a custom lead-in in the output, which is in
particular useful to replace the default dummy versions of the `VIEW()`
and `END()` functions which are used by `imgdupe` to structure its
output.
+ * `-I` same as `-i`, but add the contents of the specified file.
+
* `-T` allows to set the number of hashing threads to use; for optimal
performance this should be equal to the number of (physical) processor
cores.
" -t n similarity threshold in bits (0..256) or percent; default: 256\n"
" -b float blur factor; add -r when changed between runs; default: 2.5\n"
" -r re-scan files already in database\n"
- " -I file use file contents as lead-in for output\n"
+ " -i text add text as lead-in to output\n"
+ " -I file add file contents as lead-in to output\n"
" -T n number of scan threads (default: 4)\n"
" -h display this help text and exit\n"
);
"END(){ echo 'Done'; }\n\n";
db = db_init();
- while ( ( c = getopt( argc, argv, "+:b:d:hI:f:m:prt:T:" ) ) != -1 ) {
+ while ( ( c = getopt( argc, argv, "+:b:d:hi:I:f:m:prt:T:x" ) ) != -1 ) {
switch (c) {
case 'b':
n = atoi(optarg);
case 'h':
usage(argv[0], EXIT_SUCCESS);
break;
+ case 'i':
+ n = printf("%s\n", optarg);
+ dprintf("written %d bytes lead-in (-i)\n", n);
+ lead_in = "";
+ break;
case 'I':
n = cat_file(optarg);
- lead_in = "";
- dprintf("written %d bytes lead-in (%s)\n", n, optarg);
+ if ( n >= 0 ) {
+ lead_in = "";
+ dprintf("written %d bytes lead-in (%s)\n", n, optarg);
+ }
+ else {
+ eprintf("ERROR: '%s': %s\n", optarg, strerror(errno));
+ ++err;
+ }
break;
case 'f':
cfg.db_outfile = optarg;
- /* fall through */
+ dprintf("loading '%s'\n", optarg);
+ n = db_read(db, optarg);
+ dprintf("read %d entries\n", n > 0 ? n : 0);
+ break;
case 'm':
dprintf("loading '%s'\n", optarg);
n = db_read(db, optarg);
- dprintf("loaded %d entries\n", n>0?n:0);
+ if ( n >= 0 )
+ dprintf("read %d entries\n", n);
+ else {
+ eprintf("ERROR: '%s': %s\n", optarg, strerror(errno));
+ ++err;
+ }
break;
case 'p':
cfg.db_prune = 1;