Add an empty line between groups when the group IDs are not shown.
[finddup.git] / finddup.c
index 40ce3f7..a8847f5 100644 (file)
--- a/finddup.c
+++ b/finddup.c
@@ -160,7 +160,7 @@ int same_content(struct file_with_size *f1, struct file_with_size *f2) {
           close(fd2);
           return 1;
         } else {
-          if(strncmp(buffer1, buffer2, s1)) {
+          if(memcmp(buffer1, buffer2, s1)) {
             close(fd1);
             close(fd2);
             return 0;
@@ -317,6 +317,9 @@ void print_result(struct file_with_size *list1, struct file_with_size *list2) {
   qsort(nodes, nb, sizeof(struct file_with_size *), compare_nodes);
 
   for(n = 0; n < nb; n++) {
+    if(!show_groups && n > 0 && nodes[n]->group_id != nodes[n-1]->group_id) {
+      printf("\n");
+    }
     print_file(nodes[n]);
   }