From: Francois Fleuret Date: Sun, 11 Dec 2011 10:29:17 +0000 (+0100) Subject: Fixed a bug with -q in the first group. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=4803c0f2255642de3b6a9724e00f569c881b02f7;p=finddup.git Fixed a bug with -q in the first group. --- diff --git a/finddup.c b/finddup.c index 13d0f66..124eaad 100644 --- a/finddup.c +++ b/finddup.c @@ -384,7 +384,7 @@ void write_groups_in_files(int nb, struct file_node **nodes) { char filename[PATH_MAX + 1]; for(n = 0; n < nb; n++) { - first_of_group = 0; + first_of_group = (n == 0); if(nodes[n]->group_id != current_group) { if(file) { fclose(file); } sprintf(filename, "%s%06d", result_file_prefix, nodes[n]->group_id); @@ -443,7 +443,7 @@ void print_result(struct file_node *list1, struct file_node *list2) { write_groups_in_files(nb, nodes); } else { for(n = 0; n < nb; n++) { - first_of_group = 0; + first_of_group = (n == 0); if(n > 0 && nodes[n]->group_id != nodes[n-1]->group_id) { if(!show_groups) { printf("\n");