X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=finddup.c;h=6f6af386fa619052b7bbf05988f7ea7ec21fd72f;hb=6555f271e8457b46ed5f46032511ad9e8ea98a5a;hp=13d0f668bcbb11ed2cf9bd2b05e4c01585f25e10;hpb=c255c34c53dfe5dddd7d12f9694c24eaf8e2b2df;p=finddup.git diff --git a/finddup.c b/finddup.c index 13d0f66..6f6af38 100644 --- a/finddup.c +++ b/finddup.c @@ -23,9 +23,9 @@ * */ -#define VERSION_NUMBER "1.2" +#define VERSION_NUMBER "1.2.1" -#define _BSD_SOURCE +#define _DEFAULT_SOURCE #include #include @@ -56,8 +56,8 @@ int ignore_dotfiles = 0; /* 1 means ignore files and directories int ignore_empty_files = 0; /* 1 means ignore empty files */ -int show_realpaths = 0; /* 1 means ignore files and directories - starting with a dot */ +int show_realpaths = 0; /* 1 show the canonical absolute pathname for + printed files */ int show_progress = 0; /* 1 means show a progress bar when we are in a tty */ @@ -333,11 +333,11 @@ int compare_nodes(const void *x1, const void *x2) { void exec_command(int nb, struct file_node **nodes) { char **args; - int max_group_size = 0, group_size, m, n, status; + int max_group_size = 0, group_size = 0, m, n, status; pid_t pid; for(n = 0; n < nb; n++) { - if(n == 0 || nodes[n]->group_id != nodes[n-1]->group_id) { + if(nodes[n]->group_id != nodes[n-1]->group_id) { group_size = 0; } group_size++; @@ -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"); @@ -511,7 +511,7 @@ void start(const char *dirname1, const char *dirname2) { struct progress_state progress_state; int not_in, found; int nb_groups, nb_nodes; - int list1_length, previous_progress; + int list1_length; char *buffer1 = safe_malloc(sizeof(char) * READ_BUFFER_SIZE); char *buffer2 = safe_malloc(sizeof(char) * READ_BUFFER_SIZE); @@ -541,7 +541,6 @@ void start(const char *dirname1, const char *dirname2) { } nb_groups = 0; - previous_progress = -1; nb_nodes = 0; progress_state.bar_width = -1;