This is the original plan for this program. Note that the thing with hard links has not been implemented. Right now the link structure is not broken. All links are updated at the same time including links outside the target zone. patchtree [-d] [-c[n]] [-u[n]] originals target ... - Map all filenames in originals. - For each file in the targets: - Scan the file top to bottom, compute crc. If the file is a binary then skip it. - If the file has been seen before as a link, then link it to the patch created. If no patch was created then try to make a patch for this file and relink the previous files. - For each file in the originals with the same name: - Produce a diff from the original to the target. - If the diff is < sum of input files then accept it. - Remove diff, try next file. - If a diff was created then: - Remove the target, but remember attributes. - Install the diff in place of the target with the crc's of the original and the target in a piece of magic text at the front of the file. - Give the diff the same attributes as the file it replaces. patchtree originals target ... - Map all filenames in originals. - For each file in the targets: - Skip it if it doesn't start with the required magic junk. - For each file in the originals with the same name: - Accept the file if the crc is as expected. - If no file is found the complain and continue with the next. Leave the patch where it is, so the user may correct the problem and restart. - Patch a copy of the original. Check the crc to make sure that the patch worked (it should). - If a correctly patched file was created then replace the patch with the new file copying attributes. Copy it *over* the patch to make sure that links are also updated.