Patch Kit, Version 2.0 Copyright (c) 1986, Larry Wall You may copy the patch kit in whole or in part as long as you don't try to make money off it, or pretend that you wrote it. NEW FEATURES IN THIS RELEASE (Correct) support for 4.3bsd-style context diffs. Files can be created from scratch. You can specify a fuzz-factor for context matching. You can force patch to ask no questions. You can specify how much of the leading pathname to strip off filenames. Uses a Configure script for greater portability. You are now asked if you want to apply a reversed patch. No limit (apart from memory) on the size of hunks. Features added by Tim Russell (russell@zeus.unl.edu) Added support for VMS from earlier version to patchlevel 9. Added parsing support for "patch Archive-Name: cdiff-v2 After receiving Bob Larson's sources for the PD context diff program, I decided to accept his challenge to rewrite the documentation. In the process, I also ported it to TURBOC version 1.5. It probably will also compile in TURBOC 1.0, but since getting the update I dispensed with the previous version and did not try it. The code has been reorganized to strip it of the documentation that was built into it; that has been moved to the file cdiff.mem. Thus, the following shar file includes cdiff.c, cdiff.1 (man source), cdiff.mem (the previously built-in documentation), cdiff.doc (cdiff.1 passed through nroff -man for those who do not have nroff available), the original README, and a new TC-READ.ME. Follow the notes in TC-READ.ME or it will run even slower! Of course, no warranties whatsoever go with this. I merely hacked the code minimally. I didn't write it. --- Comp.sources.misc: Volume 2, Issue 59 Submitted-By: Archive-Name: pd-cdiff-patch Neil Dixon uncovered a flaw in the logic of the cdiff program that was distributed early in January, and which was redistributed with changes to make it compilable in Turbo C. I've tested his patch both on the Unix SysVr2 version and on the PC, and have not found any errors. Conversely, the earlier version when compiled in MSC 4.0 (but, for some reason, not when compiled in TC 1.5) would sporadically come up with "read" errors. Since it now works in MSC as well as TC, I've included the appropriate ifdefs for both compilers, and have incorporated Neil's patch. (This was for clarity. The line numbers in his patch did not correspond precisely to the line numbers in the distributed code.) Both the patch as sent to me and the revised code are contained below. As before, I did not write this code. I merely ported it, and of course make no warranties whatsoever. --- Ok, I guess that I will add my two cents worth. Here is yet another repost of the public domain diff program. I have integrated some changes into the i/o portion of the code, providing some significant speedups. These changes were made after spending two evenings playging around with the profiler, attempting various fixes to make this beast a little faster. I completed this prior to the latest release of the code (the version listed immediately above). I have attempted to merge the changes provided by Mike above, but, since I do not have any other machines close by, I could not test them. The changes which I made are in the following areas: * modified the fgetss() and fputss() routines. These were the primary areas of intense activity on the system. From the source that I could see, these changes should be portable. After timing this on my 3b1, the changes make this diff run at about the same speed as the system diff for the files that I was using (amazing isn't it?). * Moved the defines from within the source code to within the Makefile. * Ran the code through indent. Sorry about that, but it was the only way that I could make sure that I got all the other patches integrated properly. * Cleaned up some of the comments and added a few of my own. * Made a few tweaks to make lint happier. * Modified the Makefile to allow use of shared libraries. Included instructions for all the defines in the system as well. Mark H. Colburn (mark@jhereg.mn.org) Fixed to support VMS C 3.0 by Tim Russell (russell@zeus.unl.edu). 12/10/89 mark@infopiz.uucp (uunet!lupine!infopiz!mark) For he VMS environment, the command line interface for diff has been augmented to be more similar to the native DIFFERENCE utility. Default parts of file specs are taken from the other file name, and allowance is made for diffing file versions by simply specifying a single file/version implying comparison with the previous version. Examples: $ diff uucico.c [-.v11] $ diff uucico.c dua0: $ diff uucico.c Note, the last case properly uses ;-1 as the old file and ;0 as the new. For the VMS environment, Patch has been modified to behave more like a VMS utility; it now creates a new version of the patched file leaving the original version unmodified. On VMS, if you were patching a file on another device than your default login device, the patch would seemingly be applied (from the messages), but there would be no changes made and no errors reported. This has been fixed. diff has been fixed so that the 'new file name' need not be shorter than the 'old file name'. All patches are now done "in memory" (i.e. Plan A) where before this would have only been the case if the files being patched were STREAM_LF files. Plan B patches pass through the file several times reading and rereading from disk. Also, both diff and patch have been given some significant performance improvements by using larger I/O buffers, and both have also been augmented with argproc, to allow simple command line redirection which these utilities work quite well with. -- Mark Pizzolato