Lines 200-205
int sorted = 0;
Link Here
|
200 |
/* save destination file name for deleting on error */ |
200 |
/* save destination file name for deleting on error */ |
201 |
char *destination_file = NULL; |
201 |
char *destination_file = NULL; |
202 |
|
202 |
|
|
|
203 |
/* append suffix for already existing entires */ |
204 |
char *append_suffix = NULL; |
205 |
|
203 |
/* structure to used to pass in a pointer or an integer |
206 |
/* structure to used to pass in a pointer or an integer |
204 |
* to duplicate buffer read helper functions. |
207 |
* to duplicate buffer read helper functions. |
205 |
*/ |
208 |
*/ |
Lines 1331-1337
int encomp_opendir(char *pathname, struc
Link Here
|
1331 |
if(n == dir->count) |
1334 |
if(n == dir->count) |
1332 |
break; |
1335 |
break; |
1333 |
ERROR("Source directory entry %s already used! - trying ", dir_name); |
1336 |
ERROR("Source directory entry %s already used! - trying ", dir_name); |
1334 |
sprintf(dir_name, "%s_%d", basename, pass++); |
1337 |
if(append_suffix) { |
|
|
1338 |
if(pass == 1) |
1339 |
sprintf(dir_name, "%s%s", basename, append_suffix); |
1340 |
else |
1341 |
sprintf(dir_name, "%s%s_%d", basename, append_suffix, pass-1); |
1342 |
pass++; |
1343 |
} |
1344 |
else |
1345 |
sprintf(dir_name, "%s_%d", basename, pass++); |
1335 |
ERROR("%s\n", dir_name); |
1346 |
ERROR("%s\n", dir_name); |
1336 |
} |
1347 |
} |
1337 |
add_dir_entry(dir_name, source_path[i], NULL, dir); |
1348 |
add_dir_entry(dir_name, source_path[i], NULL, dir); |
Lines 1729-1734
int main(int argc, char *argv[])
Link Here
|
1729 |
|
1740 |
|
1730 |
else if(strcmp(argv[i], "-keep-as-directory") == 0) |
1741 |
else if(strcmp(argv[i], "-keep-as-directory") == 0) |
1731 |
keep_as_directory = TRUE; |
1742 |
keep_as_directory = TRUE; |
|
|
1743 |
|
1744 |
else if(strcmp(argv[i], "-append-suffix") == 0) { |
1745 |
if(++i == argc) { |
1746 |
ERROR("%s: -append-suffix: missing name\n", argv[0]); |
1747 |
exit(1); |
1748 |
} |
1749 |
append_suffix = argv[i]; |
1750 |
} |
1732 |
|
1751 |
|
1733 |
else if(strcmp(argv[i], "-root-becomes") == 0) { |
1752 |
else if(strcmp(argv[i], "-root-becomes") == 0) { |
1734 |
if(++i == argc) { |
1753 |
if(++i == argc) { |
Lines 1757-1762
printOptions:
Link Here
|
1757 |
ERROR("-keep-as-directory\tif one source directory is specified, create a root\n"); |
1776 |
ERROR("-keep-as-directory\tif one source directory is specified, create a root\n"); |
1758 |
ERROR("\t\t\tdirectory containing that directory, rather than the\n"); |
1777 |
ERROR("\t\t\tdirectory containing that directory, rather than the\n"); |
1759 |
ERROR("\t\t\tcontents of the directory\n"); |
1778 |
ERROR("\t\t\tcontents of the directory\n"); |
|
|
1779 |
ERROR("-append-suffix <name>\twhen appending, source files/directories having the\n"); |
1780 |
ERROR("\t\t\tsame name as the destination filesystem will be appended that suffix.\n"); |
1760 |
ERROR("-root-becomes <name>\twhen appending source files/directories, make the\n"); |
1781 |
ERROR("-root-becomes <name>\twhen appending source files/directories, make the\n"); |
1761 |
ERROR("\t\t\toriginal root become a subdirectory in the new root\n"); |
1782 |
ERROR("\t\t\toriginal root become a subdirectory in the new root\n"); |
1762 |
ERROR("\t\t\tcalled <name>, rather than adding the new source items\n"); |
1783 |
ERROR("\t\t\tcalled <name>, rather than adding the new source items\n"); |
Lines 1842-1848
printOptions:
Link Here
|
1842 |
fclose(fd); |
1863 |
fclose(fd); |
1843 |
} else if(strcmp(argv[i], "-e") == 0) |
1864 |
} else if(strcmp(argv[i], "-e") == 0) |
1844 |
break; |
1865 |
break; |
1845 |
else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-sort") == 0) |
1866 |
else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-sort") == 0 || strcmp(argv[i], "-append-suffix") == 0) |
1846 |
i++; |
1867 |
i++; |
1847 |
|
1868 |
|
1848 |
if(i != argc) { |
1869 |
if(i != argc) { |
Lines 1860-1866
printOptions:
Link Here
|
1860 |
sorted ++; |
1881 |
sorted ++; |
1861 |
} else if(strcmp(argv[i], "-e") == 0) |
1882 |
} else if(strcmp(argv[i], "-e") == 0) |
1862 |
break; |
1883 |
break; |
1863 |
else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-ef") == 0) |
1884 |
else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-root-becomes") == 0 || strcmp(argv[i], "-ef") == 0 || strcmp(argv[i], "-append-suffix") == 0) |
1864 |
i++; |
1885 |
i++; |
1865 |
|
1886 |
|
1866 |
if(delete) { |
1887 |
if(delete) { |