| 744 | } |
| 745 | |
| 746 | static copy_dir_t copy_selection(file_info_t*dir_list, WINDOW *window, disk_t *disk, const partition_t *partition, dir_data_t *dir_data, unsigned int *copy_ok, unsigned int *copy_bad) |
| 747 | { |
| 748 | const unsigned int current_directory_namelength=strlen(dir_data->current_directory); |
| 749 | struct td_list_head *tmpw=NULL; |
| 750 | td_list_for_each(tmpw, &dir_list->list) |
| 751 | { |
| 752 | copy_dir_t copy_stopped=CD_FINISHED; |
| 753 | file_info_t *tmp=td_list_entry(tmpw, file_info_t, list); |
| 754 | if((tmp->status&FILE_STATUS_MARKED)!=0 && |
| 755 | current_directory_namelength + 1 + strlen(tmp->name) < |
| 756 | sizeof(dir_data->current_directory)-1) |
| 757 | { |
| 758 | tmp->status&=~FILE_STATUS_MARKED; |
| 759 | if(strcmp(dir_data->current_directory,"/")) |
| 760 | strcat(dir_data->current_directory,"/"); |
| 761 | if(strcmp(tmp->name,".")!=0) |
| 762 | strcat(dir_data->current_directory,tmp->name); |
| 763 | if(LINUX_S_ISDIR(tmp->st_mode)!=0) |
| 764 | { |
| 765 | copy_stopped=copy_dir(window, disk, partition, dir_data, tmp, copy_ok, copy_bad); |
| 766 | if(copy_stopped!=CD_FINISHED) |
| 767 | { |
| 768 | dir_data->current_directory[current_directory_namelength]='\0'; |
| 769 | return copy_stopped; |
| 770 | } |
| 771 | } |
| 772 | else if(LINUX_S_ISREG(tmp->st_mode)!=0) |
| 773 | { |
| 774 | copy_file_t res; |
| 775 | copy_progress(window, *copy_ok, *copy_bad); |
| 776 | res=dir_data->copy_file(disk, partition, dir_data, tmp); |
| 777 | if(res==CP_NOSPACE) |
| 778 | copy_stopped=CD_NOSPACE; |
| 779 | if(res == CP_OK) |
| 780 | (*copy_ok)++; |
| 781 | else |
| 782 | (*copy_bad)++; |
| 783 | } |
| 784 | } |
| 785 | dir_data->current_directory[current_directory_namelength]='\0'; |
| 786 | if(copy_stopped!=CD_FINISHED) |
| 787 | return copy_stopped; |
| 788 | } |
| 789 | return CD_FINISHED; |
| 790 | } |
| 791 | #endif |
no test coverage detected