- for (i=0;i<flist->count;i++) {
- clean_fname(flist->files[i].name);
- }
-
- qsort(flist->files,flist->count,
- sizeof(flist->files[0]),
- (int (*)())file_compare);
-
- for (i=1;i<flist->count;i++) {
- if (flist->files[i].name &&
- strcmp(flist->files[i].name,flist->files[i-1].name) == 0) {
- if (verbose > 1 && !am_server)
- fprintf(FERROR,"removing duplicate name %s from file list %d\n",
- flist->files[i-1].name,i-1);
- free(flist->files[i-1].name);
- bzero((char *)&flist->files[i-1],sizeof(flist->files[i-1]));
- }
- }
+ qsort(flist->files,flist->count,
+ sizeof(flist->files[0]),
+ (int (*)())file_compare);
+
+ for (i=1;i<flist->count;i++) {
+ if (flist->files[i]->basename &&
+ strcmp(f_name(flist->files[i]),
+ f_name(flist->files[i-1])) == 0) {
+ if (verbose > 1 && !am_server)
+ fprintf(FERROR,"removing duplicate name %s from file list %d\n",
+ f_name(flist->files[i-1]),i-1);
+ free_file(flist->files[i]);
+ flist->files[i] = NULL;
+ }
+ }
+}
+
+
+/*
+ * return the full filename of a flist entry
+ */
+char *f_name(struct file_struct *f)
+{
+ static char names[10][MAXPATHLEN];
+ static int n;
+ char *p = names[n];
+
+ if (!f) return NULL;
+
+ n = (n+1)%10;
+
+ if (f->dirname) {
+ sprintf(p, "%s/%s", f->dirname, f->basename);
+ } else {
+ strcpy(p, f->basename);
+ }
+
+ return p;