size_t size;
ino_t inode;
struct file_with_size *next;
- int group_id;
+ int group_id, dir_id;
};
void file_list_delete(struct file_with_size *head) {
tmp->size = sb.st_size;
tmp->inode = sb.st_ino;
tmp->group_id = -1;
+ tmp->dir_id = -1;
tail = tmp;
}
}
} else if((*f1)->group_id > (*f2)->group_id) {
return 1;
} else {
- return 0;
+ if((*f1)->dir_id < (*f2)->dir_id) {
+ return -1;
+ } else if((*f1)->dir_id > (*f2)->dir_id) {
+ return 1;
+ } else {
+ return 0;
+ }
}
}
node1->group_id = node2->group_id;
} else {
node1->group_id = k;
+ node1->dir_id = 1;
k++;
}
}
if(node2->group_id < 0) {
node2->group_id = node1->group_id;
+ node2->dir_id = 2;
}
}
}