projects
/
finddup.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1621d18
)
Enforce the display of files from DIR1 before those from DIR2.
author
Francois Fleuret
<francois@fleuret.org>
Thu, 11 Mar 2010 06:58:44 +0000
(07:58 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Thu, 11 Mar 2010 06:58:44 +0000
(07:58 +0100)
finddup.c
patch
|
blob
|
history
diff --git
a/finddup.c
b/finddup.c
index
a8847f5
..
562cf5c
100644
(file)
--- a/
finddup.c
+++ b/
finddup.c
@@
-112,7
+112,7
@@
struct file_with_size {
size_t size;
ino_t inode;
struct file_with_size *next;
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) {
};
void file_list_delete(struct file_with_size *head) {
@@
-237,6
+237,7
@@
struct file_with_size *scan_directory(struct file_with_size *tail,
tmp->size = sb.st_size;
tmp->inode = sb.st_ino;
tmp->group_id = -1;
tmp->size = sb.st_size;
tmp->inode = sb.st_ino;
tmp->group_id = -1;
+ tmp->dir_id = -1;
tail = tmp;
}
}
tail = tmp;
}
}
@@
-276,7
+277,13
@@
int compare_nodes(const void *x1, const void *x2) {
} else if((*f1)->group_id > (*f2)->group_id) {
return 1;
} else {
} 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;
+ }
}
}
}
}
@@
-409,11
+416,13
@@
void start(const char *dirname1, const char *dirname2) {
node1->group_id = node2->group_id;
} else {
node1->group_id = k;
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;
k++;
}
}
if(node2->group_id < 0) {
node2->group_id = node1->group_id;
+ node2->dir_id = 2;
}
}
}
}
}
}