forked from simonsj/fdupes-jody
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathact_printmatches.c
44 lines (35 loc) · 1.09 KB
/
act_printmatches.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Print matched file sets
* This file is part of jdupes; see jdupes.c for license information */
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include "jdupes.h"
#include "jody_win_unicode.h"
#include "act_printmatches.h"
extern void printmatches(file_t * restrict files)
{
file_t * restrict tmpfile;
int printed = 0;
int cr = 1;
LOUD(fprintf(stderr, "act_printmatches: %p\n", files));
if (ISFLAG(flags, F_PRINTNULL)) cr = 2;
while (files != NULL) {
if (ISFLAG(files->flags, F_HAS_DUPES)) {
printed = 1;
if (!ISFLAG(flags, F_OMITFIRST)) {
if (ISFLAG(flags, F_SHOWSIZE)) printf("%" PRIdMAX " byte%c each:\n", (intmax_t)files->size,
(files->size != 1) ? 's' : ' ');
fwprint(stdout, files->d_name, cr);
}
tmpfile = files->duplicates;
while (tmpfile != NULL) {
fwprint(stdout, tmpfile->d_name, cr);
tmpfile = tmpfile->duplicates;
}
if (files->next != NULL) fwprint(stdout, "", cr);
}
files = files->next;
}
if (printed == 0) fwprint(stderr, "No duplicates found.", 1);
return;
}