- int max_group_size = 0, group_size, m, n, status;
+ int max_group_size = 0, group_size = 0, m, n, status;
if(nodes[n]->group_id != current_group) {
if(file) { fclose(file); }
sprintf(filename, "%s%06d", result_file_prefix, nodes[n]->group_id);
file = fopen(filename, "w");
current_group = nodes[n]->group_id;
printf("Writing %s.\n" , filename);
if(nodes[n]->group_id != current_group) {
if(file) { fclose(file); }
sprintf(filename, "%s%06d", result_file_prefix, nodes[n]->group_id);
file = fopen(filename, "w");
current_group = nodes[n]->group_id;
printf("Writing %s.\n" , filename);
void print_result(struct file_node *list1, struct file_node *list2) {
struct file_node *node1, *node2;
struct file_node **nodes;
void print_result(struct file_node *list1, struct file_node *list2) {
struct file_node *node1, *node2;
struct file_node **nodes;
write_groups_in_files(nb, nodes);
} else {
for(n = 0; n < nb; n++) {
write_groups_in_files(nb, nodes);
} else {
for(n = 0; n < nb; n++) {
- if(!show_groups && n > 0 && nodes[n]->group_id != nodes[n-1]->group_id) {
- printf("\n");
+ first_of_group = (n == 0);
+ if(n > 0 && nodes[n]->group_id != nodes[n-1]->group_id) {
+ if(!show_groups) {
+ printf("\n");
+ }
+ first_of_group = 1;
+ }
+ if(!trim_first || !first_of_group) {
+ write_one_entry_to_file(stdout, nodes[n]);
char *buffer1 = safe_malloc(sizeof(char) * READ_BUFFER_SIZE);
char *buffer2 = safe_malloc(sizeof(char) * READ_BUFFER_SIZE);
char *buffer1 = safe_malloc(sizeof(char) * READ_BUFFER_SIZE);
char *buffer2 = safe_malloc(sizeof(char) * READ_BUFFER_SIZE);
fprintf(out, " those in DIR1\n");
fprintf(out, " -g, --no-group-ids do not show the file groups\n");
fprintf(out, " -t, --time-sort sort according to modification time in each group\n");
fprintf(out, " those in DIR1\n");
fprintf(out, " -g, --no-group-ids do not show the file groups\n");
fprintf(out, " -t, --time-sort sort according to modification time in each group\n");
fprintf(out, " -p, --show-progress show progress\n");
fprintf(out, " -r, --real-paths show the real file paths\n");
fprintf(out, " -i, --same-inodes-are-different\n");
fprintf(out, " -p, --show-progress show progress\n");
fprintf(out, " -r, --real-paths show the real file paths\n");
fprintf(out, " -i, --same-inodes-are-different\n");
fprintf(out, " -f <string>, --result-prefix <string>\n");
fprintf(out, " for each group of identical files, write one\n");
fprintf(out, " result file whose name is the given prefix string\n");
fprintf(out, " -f <string>, --result-prefix <string>\n");
fprintf(out, " for each group of identical files, write one\n");
fprintf(out, " result file whose name is the given prefix string\n");
- fprintf(out, " followed the group number, and containing one\n");
- fprintf(out, " filename per line\n");
+ fprintf(out, " followed by the group number, and containing\n");
+ fprintf(out, " one filename per line\n");
{ "hide-matchings", no_argument, 0, 'c' },
{ "no-group-ids", no_argument, 0, 'g' },
{ "time-sort", no_argument, 0, 't' },
{ "hide-matchings", no_argument, 0, 'c' },
{ "no-group-ids", no_argument, 0, 'g' },
{ "time-sort", no_argument, 0, 't' },
{ "ignore-dots", no_argument, 0, 'd' },
{ "ignore-empty", no_argument, 0, '0' },
{ "show-progress", no_argument, 0, 'p' },
{ "ignore-dots", no_argument, 0, 'd' },
{ "ignore-empty", no_argument, 0, '0' },
{ "show-progress", no_argument, 0, 'p' },
- while ((c = getopt_long(argc, argv, "vhircgtd0pme:f:",
+ while ((c = getopt_long(argc, argv, "vhircgtqd0pme:f:",