conslt32@ZEUS.UNL.EDU (Tim Russell) (08/04/89)
+-+-+-+ Beginning of part 4 +-+-+-+ X`009putc('\n', stderr); X`009_error(); X`125 X X X_error() X`123 X`009exit(1); X`125 X X X/* X * Like fput() except that it puts a newline at the end of the line. X */ X Xfputss(s, iop) X`009register char *s; X`009register FILE *iop; X`123 X`009fputs(s, iop); X`009putc('\n', iop); X`125 X X X/* X * Fgetss() is like fgets() except that the terminating newline X * is removed.`032 X */ X Xchar * Xfgetss(s, n, iop) X`009char *s; X`009register FILE *iop; X`123 X`009register char *cs; X X`009if (fgets(s, n, iop) == NULL) X`009`009return ((char *) NULL); X`009cs = s + strlen(s) - 1; X`009if (*cs == '\n') X`009`009*cs = '\0'; X`009return (s); X`125 $ GOSUB UNPACK_FILE $ FILE_IS = "DIFF.DOC" $ CHECKSUM_IS = 404096844 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X X X X XDIFF(1) UNIX Programmer's Manual DIFF(1) X X X XNAME X diff - Public Domain diff (context diff) program X XSYNOPSIS X diff [ -b -c -i -e ] file1 file2 X XDESCRIPTION X Diff compares two files, showing what must be changed to X make them identical. Either file1 or file2 (but not both) X may refer to directories. If that is the case, a file in the X directory whose name is the same as the other file argument X will be used. The standard input may be used for one of the X files by replacing the argument by "-". Except for the stan- X dard input, both files must be on disk devices. X XOPTIONS X -b Remove trailing whitespace (blanks and tabs) and compress X all other strings of whitespace to a single blank. X X -c Print some context -- matching lines before and after the X non-match section. Mark non-matched sections with "`124". X X -i Ignore lower/upper case distinctions. X X -e Output is in an "editor script" format which is compati- X ble with the Unix 'ed' editor. X X All information needed to compare the files is maintained in X main memory. This means that very large files (or fairly X large files with many differences) will cause the program to X abort with an "out of space" message. Main memory require- X ments (in words) are approximately: X X 2 * (length of file1 + length of file2) X + 3 * (number of changes) X X (Where "length" is the number of lines of data in each X file.) X X The algorithm reads each file twice, once to build hash X tables and once to check for fortuitous matches (two lines X that are in fact different, but which have the same hash X value). CPU time requirements include sorting the hash X tables and randomly searching memory tables for equivalence X classes. For example, on a time-shared VAX-11/780, comparing X two 1000 line files required about 30 seconds (elapsed clock X time) and about 10,000 bytes of working storage. About 90 X per-cent of the time was taken up by file I/O. X XDIAGNOSTICS X X X X X 4.2 BSD 1 X X X X X X X XDIFF(1) UNIX Programmer's Manual DIFF(1) X X X X Warning, bad option 'x' X The option is ignored. X X Usage ... X Two input files were not specified. X X Can't open input file "filename". X Can't continue. X X Out of space X The program ran out of memory while comparing the two X files. X X Can't read line nnn at xxx in file[A/B] X This indicates an I/O error when seeking to the X specific line. It should not happen. X X Spurious match, output is not optimal. X Two lines that were different yielded the same hash X value. This is harmless except that the difference X output is not the minimum set of differences between X the two files. For example, instead of the output: X lines 1 to 5 were changed to ... X the program will print X lines 1 to 3 were changed to ... X lines 4 to 5 were changed to ... X X The program uses a CRC16 hash code. X The likelihood of this error is quite small. X XAUTHOR X The diff algorithm was developed by J. W. Hunt and M. D. X McIlroy, using a central algorithm defined by H. S. Stone. X It was published in: X Hunt, J. W., and McIlroy, M. D., X An Algorithm for Differential File Comparison, X Computing Science Technical Report #41, X Bell Laboratories, Murray Hill, NJ 07974 X XBUGS X On RSX and DECUS C on VMS systems, diff may fail if the both X files are not "variable-length, implied carriage control" X format. The scopy program can be used to convert files to X this format if problems arise. X X When compiled under VAX C, diff handles STREAM_LF files X properly (in addition to the canonical variable-length X implied carriage control files). Other variations should X work, but have not been tested. X X X X X X 4.2 BSD 2 X X X X X X X XDIFF(1) UNIX Programmer's Manual DIFF(1) X X X X When compiled under VAX C, diff is quite slow for unknown X reasons which ought to be investigated. On the other hand, X it has access to effectively unlimited memory. X X Output in a form suitable for ed - the -e option - seems X rather pointless; the analogue on DEC systems is SLP (SUMSLP X on VMS). It would be simple to provide SLP-compatible out- X put. The question is, why bother - since the various DEC X file comparison utilities already produce it. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X 4.2 BSD 3 X X X $ GOSUB UNPACK_FILE $ FILE_IS = "HOW-TO-DIFF.DOC" $ CHECKSUM_IS = 1916013784 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X How to create a diff X X To create a diff to be sent to Geoff Huston, you use the DIFF program Xwith the "-C" option to create a "context diff" which will have a good chance Xof working even if someone has made a local change to their source. X X Let's walk through an example. Say I added a nifty change to NEWSPOST.C. XI want to send it to Geoff to be included in the next patchlevel of NEWS. X X So here's a directory: X X Directory PERM$2:[CONSLT32.WORK] X X NEWSPOST.C;2 NEWSPOST.C;1 X X Total of 2 files. X X To create the diff, I just use the form "DIFF -C oldfile newfile". One Ximportant thing, though, is to make the newer filename shorter than the older Xone. I just do this by specifying the version number on the old version, but Xnot on the new one. X X First, set up a foreign symbol for DIFF if you haven't: X X $ DIFF :== $disk:[directory]DIFF X X To create the diff: X X $ DEFINE/USER SYS$OUTPUT DIFF.TXT ! Filename of the diff X $ DIFF -C NEWSPOST.C;1 NEWSPOST.C X XHere's what the sample output looks like, in this case: X X--------------------------------------------------------------- X X *** newspost.c;-1 <-- Old filename V --- newspost.c <-- New one, should be short Xer X ************** <-- Start of first patch X *** 137,142 <-- Section from old file X *msg; X `123 X char mail_cmd[IO_SIZE]; X `032 X err_line(msg); `032 X if (screen_active) `123 X --- 137,143 ----- <-- Section from new file X *msg; X `123 X char mail_cmd[IO_SIZE]; X + int added_var; <-- '+' means added line X `032 X err_line(msg); `032 X if (screen_active) `123 X ************** <-- Start of second patch X *** 151,156 X smg$begin_pasteboard_update(&pid); X broad_trap(); X `125 X clear_err_line(); X `125 X #endif X --- 152,158 ----- X smg$begin_pasteboard_update(&pid); X broad_trap(); X `125 X + doit(added_var); <-- Added call to doit() X clear_err_line(); X `125 X #endif X X--------------------------------------------------------------- X XThat's about it. If you have more than one file changed, you can create Xdiffs for each and append them together - patch will do multiple files Xat once. X X Check your patch to make sure it looks right, and it's set to go! X`012 X Applying a patch X X To apply a patch, you must first extract it to a file. You shouldn't Xhave to worry about editing the header from the top, because patch will Xignore it. X X Set up a foreign symbol for patch, i.e. X X $ PATCH :== $disk:[directory]PATCH X Xthen, set your default directory to wherever the affected files are, Xand invoke PATCH: X X $ PATCH <DIFF.TXT ! DIFF.TXT is the diff X Xnotice, please, that there's no space between the '<' and the filename. X X Patch will print progress messages and (hopefully) patch your files. XOccasionally, enough of a change will have been made locally that a patch Xwill fail. If this happens, PATCH creates a filename with the name of the Xfile and "_REJ" appended to it. You'll have to use an editor to apply Xrejected patches by hand. Hopefully, patches won't be rejected often. X X Here's a sample PATCH log from the patch above: X X $ patch <diff.txt X Hmm... Looks like a context diff to me... X The text leading up to this was: X -------------------------- X `124*** newspost.c;-1 X `124--- newspost.c X -------------------------- X Patching file newspost.c using Plan B... X Hunk #1 succeeded at 137. X Hunk #2 succeeded at 152. X done X X So, it's fairly simple! This guide, though, is just an introductory Xtext. Have a look at both PATCH.DOC and DIFF.DOC, realizing that some Xof the things they talk about are Unix-only, for more information. X V---------------------------------+------------------------------------------- X- X Tim Russell, Computer Operator `124 Internet: russell@zeus.unl.edu X Campus Computing `124 Bitnet: russell@unoma1 X University of Nebraska at Omaha `124 UUCP: uunet!zeus.unl.edu!russell V---------------------------------+------------------------------------------- X- $ GOSUB UNPACK_FILE $ FILE_IS = "README." $ CHECKSUM_IS = 425221169 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XComp.sources.misc: Volume 2, Issue 1 XArchive-Name: pd-diff XSubmitted-By: blarson@skat.usc.edu (Bob Larson) X XHere's a public domain diff with the -b and -c options. (4.2bsd style Xcontex diffs.) I wasn't aware that these wern't present in all unix Xversions of diff, so I didn't think posting it was a priority. It's Xwork. (except when it runs out of memory) The one case I know of Xwhere its output is incompatable with patch does seem to be pretty Xrare. No makefile is included, the 4.2bsd diff is better on the unix Xsystem I use. If you don't know how to compile and load a single C Xprogram, this probably isn't the tool for you anyway. I'd be grateful Xto who cleans this up and documents it properly. It does Xappear to have been separate files at some point, I'm presenting it in Xa form similar to how I got it: mail headers and outdated documentation Xin comments and all. I just banged on it enough to get it doing what XI wanted. X X--- XComp.Sources.Misc: Volume 2, Issue 8 XSubmitted-By: <mike2@lcuxa.UUCP> XArchive-Name: cdiff-v2 X XAfter receiving Bob Larson's sources for the PD context diff program, XI decided to accept his challenge to rewrite the documentation. In Xthe process, I also ported it to TURBOC version 1.5. It probably will Xalso compile in TURBOC 1.0, but since getting the update I dispensed Xwith the previous version and did not try it. `032 X XThe code has been reorganized to strip it of the documentation that Xwas built into it; that has been moved to the file cdiff.mem. Thus, Xthe following shar file includes cdiff.c, cdiff.1 (man source), cdiff.mem X(the previously built-in documentation), cdiff.doc (cdiff.1 passed Xthrough nroff -man for those who do not have nroff available), the Xoriginal README, and a new TC-READ.ME. Follow the notes in TC-READ.ME Xor it will run even slower! `032 X XOf course, no warranties whatsoever go with this. I merely hacked the Xcode minimally. I didn't write it. X--- X XComp.sources.misc: Volume 2, Issue 59 XSubmitted-By: <mike2@lcuxa.UUCP> XArchive-Name: pd-cdiff-patch X XNeil Dixon uncovered a flaw in the logic of the cdiff program that Xwas distributed early in January, and which was redistributed with Xchanges to make it compilable in Turbo C. I've tested his patch Xboth on the Unix SysVr2 version and on the PC, and have not found Xany errors. Conversely, the earlier version when compiled in MSC X4.0 (but, for some reason, not when compiled in TC 1.5) would Xsporadically come up with "read" errors. Since it now works in MSC as Xwell as TC, I've included the appropriate ifdefs for both compilers, Xand have incorporated Neil's patch. (This was for clarity. The line Xnumbers in his patch did not correspond precisely to the line numbers Xin the distributed code.) Both the patch as sent to me and the Xrevised code are contained below. X XAs before, I did not write this code. I merely ported it, and of Xcourse make no warranties whatsoever. X X--- X XOk, I guess that I will add my two cents worth. Here is yet another Xrepost of the public domain diff program. `032 X VI have integrated some changes into the i/o portion of the code, providing`03 X2 Xsome significant speedups. These changes were made after spending two`032 Xevenings playging around with the profiler, attempting various fixes to Vmake this beast a little faster. I completed this prior to the latest releas Xe`032 Xof the code (the version listed immediately above). `032 X VI have attempted to merge the changes provided by Mike above, but, since I do X`032 Xnot have any other machines close by, I could not test them. X XThe changes which I made are in the following areas: X X`009* modified the fgetss() and fputss() routines. These were the primary X`009 areas of intense activity on the system. From the source that I X`009 could see, these changes should be portable. After timing this`032 X`009 on my 3b1, the changes make this diff run at about the same speed X`009 as the system diff for the files that I was using (amazing isn't it?). X X`009* Moved the defines from within the source code to within the Makefile. X X`009* Ran the code through indent. Sorry about that, but it was the only V`009 way that I could make sure that I got all the other patches integrated` X032 X`009 properly. X X`009* Cleaned up some of the comments and added a few of my own. X X`009* Made a few tweaks to make lint happier. X X`009* Modified the Makefile to allow use of shared libraries. Included X`009 instructions for all the defines in the system as well. X XMark H. Colburn (mark@jhereg.mn.org) X XFixed to support VMS C 3.0 by Tim Russell (russell@zeus.unl.edu). $ GOSUB UNPACK_FILE $ EXIT
fritz@unocss.UUCP (Tim Russell) (08/27/89)
+-+-+-+ Beginning of part 4 +-+-+-+ X`009putc('\n', stderr); X`009_error(); X`125 X X X_error() X`123 X`009exit(1); X`125 X X X/* X * Like fput() except that it puts a newline at the end of the line. X */ X Xfputss(s, iop) X`009register char *s; X`009register FILE *iop; X`123 X`009fputs(s, iop); X`009putc('\n', iop); X`125 X X X/* X * Fgetss() is like fgets() except that the terminating newline X * is removed.`032 X */ X Xchar * Xfgetss(s, n, iop) X`009char *s; X`009register FILE *iop; X`123 X`009register char *cs; X X`009if (fgets(s, n, iop) == NULL) X`009`009return ((char *) NULL); X`009cs = s + strlen(s) - 1; X`009if (*cs == '\n') X`009`009*cs = '\0'; X`009return (s); X`125 $ GOSUB UNPACK_FILE $ FILE_IS = "DIFF.DOC" $ CHECKSUM_IS = 404096844 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X X X X XDIFF(1) UNIX Programmer's Manual DIFF(1) X X X XNAME X diff - Public Domain diff (context diff) program X XSYNOPSIS X diff [ -b -c -i -e ] file1 file2 X XDESCRIPTION X Diff compares two files, showing what must be changed to X make them identical. Either file1 or file2 (but not both) X may refer to directories. If that is the case, a file in the X directory whose name is the same as the other file argument X will be used. The standard input may be used for one of the X files by replacing the argument by "-". Except for the stan- X dard input, both files must be on disk devices. X XOPTIONS X -b Remove trailing whitespace (blanks and tabs) and compress X all other strings of whitespace to a single blank. X X -c Print some context -- matching lines before and after the X non-match section. Mark non-matched sections with "`124". X X -i Ignore lower/upper case distinctions. X X -e Output is in an "editor script" format which is compati- X ble with the Unix 'ed' editor. X X All information needed to compare the files is maintained in X main memory. This means that very large files (or fairly X large files with many differences) will cause the program to X abort with an "out of space" message. Main memory require- X ments (in words) are approximately: X X 2 * (length of file1 + length of file2) X + 3 * (number of changes) X X (Where "length" is the number of lines of data in each X file.) X X The algorithm reads each file twice, once to build hash X tables and once to check for fortuitous matches (two lines X that are in fact different, but which have the same hash X value). CPU time requirements include sorting the hash X tables and randomly searching memory tables for equivalence X classes. For example, on a time-shared VAX-11/780, comparing X two 1000 line files required about 30 seconds (elapsed clock X time) and about 10,000 bytes of working storage. About 90 X per-cent of the time was taken up by file I/O. X XDIAGNOSTICS X X X X X 4.2 BSD 1 X X X X X X X XDIFF(1) UNIX Programmer's Manual DIFF(1) X X X X Warning, bad option 'x' X The option is ignored. X X Usage ... X Two input files were not specified. X X Can't open input file "filename". X Can't continue. X X Out of space X The program ran out of memory while comparing the two X files. X X Can't read line nnn at xxx in file[A/B] X This indicates an I/O error when seeking to the X specific line. It should not happen. X X Spurious match, output is not optimal. X Two lines that were different yielded the same hash X value. This is harmless except that the difference X output is not the minimum set of differences between X the two files. For example, instead of the output: X lines 1 to 5 were changed to ... X the program will print X lines 1 to 3 were changed to ... X lines 4 to 5 were changed to ... X X The program uses a CRC16 hash code. X The likelihood of this error is quite small. X XAUTHOR X The diff algorithm was developed by J. W. Hunt and M. D. X McIlroy, using a central algorithm defined by H. S. Stone. X It was published in: X Hunt, J. W., and McIlroy, M. D., X An Algorithm for Differential File Comparison, X Computing Science Technical Report #41, X Bell Laboratories, Murray Hill, NJ 07974 X XBUGS X On RSX and DECUS C on VMS systems, diff may fail if the both X files are not "variable-length, implied carriage control" X format. The scopy program can be used to convert files to X this format if problems arise. X X When compiled under VAX C, diff handles STREAM_LF files X properly (in addition to the canonical variable-length X implied carriage control files). Other variations should X work, but have not been tested. X X X X X X 4.2 BSD 2 X X X X X X X XDIFF(1) UNIX Programmer's Manual DIFF(1) X X X X When compiled under VAX C, diff is quite slow for unknown X reasons which ought to be investigated. On the other hand, X it has access to effectively unlimited memory. X X Output in a form suitable for ed - the -e option - seems X rather pointless; the analogue on DEC systems is SLP (SUMSLP X on VMS). It would be simple to provide SLP-compatible out- X put. The question is, why bother - since the various DEC X file comparison utilities already produce it. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X 4.2 BSD 3 X X X $ GOSUB UNPACK_FILE $ FILE_IS = "HOW-TO-DIFF.DOC" $ CHECKSUM_IS = 1916013784 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X How to create a diff X X To create a diff to be sent to Geoff Huston, you use the DIFF program Xwith the "-C" option to create a "context diff" which will have a good chance Xof working even if someone has made a local change to their source. X X Let's walk through an example. Say I added a nifty change to NEWSPOST.C. XI want to send it to Geoff to be included in the next patchlevel of NEWS. X X So here's a directory: X X Directory PERM$2:[CONSLT32.WORK] X X NEWSPOST.C;2 NEWSPOST.C;1 X X Total of 2 files. X X To create the diff, I just use the form "DIFF -C oldfile newfile". One Ximportant thing, though, is to make the newer filename shorter than the older Xone. I just do this by specifying the version number on the old version, but Xnot on the new one. X X First, set up a foreign symbol for DIFF if you haven't: X X $ DIFF :== $disk:[directory]DIFF X X To create the diff: X X $ DEFINE/USER SYS$OUTPUT DIFF.TXT ! Filename of the diff X $ DIFF -C NEWSPOST.C;1 NEWSPOST.C X XHere's what the sample output looks like, in this case: X X--------------------------------------------------------------- X X *** newspost.c;-1 <-- Old filename V --- newspost.c <-- New one, should be short Xer X ************** <-- Start of first patch X *** 137,142 <-- Section from old file X *msg; X `123 X char mail_cmd[IO_SIZE]; X `032 X err_line(msg); `032 X if (screen_active) `123 X --- 137,143 ----- <-- Section from new file X *msg; X `123 X char mail_cmd[IO_SIZE]; X + int added_var; <-- '+' means added line X `032 X err_line(msg); `032 X if (screen_active) `123 X ************** <-- Start of second patch X *** 151,156 X smg$begin_pasteboard_update(&pid); X broad_trap(); X `125 X clear_err_line(); X `125 X #endif X --- 152,158 ----- X smg$begin_pasteboard_update(&pid); X broad_trap(); X `125 X + doit(added_var); <-- Added call to doit() X clear_err_line(); X `125 X #endif X X--------------------------------------------------------------- X XThat's about it. If you have more than one file changed, you can create Xdiffs for each and append them together - patch will do multiple files Xat once. X X Check your patch to make sure it looks right, and it's set to go! X`012 X Applying a patch X X To apply a patch, you must first extract it to a file. You shouldn't Xhave to worry about editing the header from the top, because patch will Xignore it. X X Set up a foreign symbol for patch, i.e. X X $ PATCH :== $disk:[directory]PATCH X Xthen, set your default directory to wherever the affected files are, Xand invoke PATCH: X X $ PATCH <DIFF.TXT ! DIFF.TXT is the diff X Xnotice, please, that there's no space between the '<' and the filename. X X Patch will print progress messages and (hopefully) patch your files. XOccasionally, enough of a change will have been made locally that a patch Xwill fail. If this happens, PATCH creates a filename with the name of the Xfile and "_REJ" appended to it. You'll have to use an editor to apply Xrejected patches by hand. Hopefully, patches won't be rejected often. X X Here's a sample PATCH log from the patch above: X X $ patch <diff.txt X Hmm... Looks like a context diff to me... X The text leading up to this was: X -------------------------- X `124*** newspost.c;-1 X `124--- newspost.c X -------------------------- X Patching file newspost.c using Plan B... X Hunk #1 succeeded at 137. X Hunk #2 succeeded at 152. X done X X So, it's fairly simple! This guide, though, is just an introductory Xtext. Have a look at both PATCH.DOC and DIFF.DOC, realizing that some Xof the things they talk about are Unix-only, for more information. X V---------------------------------+------------------------------------------- X- X Tim Russell, Computer Operator `124 Internet: russell@zeus.unl.edu X Campus Computing `124 Bitnet: russell@unoma1 X University of Nebraska at Omaha `124 UUCP: uunet!zeus.unl.edu!russell V---------------------------------+------------------------------------------- X- $ GOSUB UNPACK_FILE $ FILE_IS = "README." $ CHECKSUM_IS = 425221169 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XComp.sources.misc: Volume 2, Issue 1 XArchive-Name: pd-diff XSubmitted-By: blarson@skat.usc.edu (Bob Larson) X XHere's a public domain diff with the -b and -c options. (4.2bsd style Xcontex diffs.) I wasn't aware that these wern't present in all unix Xversions of diff, so I didn't think posting it was a priority. It's Xwork. (except when it runs out of memory) The one case I know of Xwhere its output is incompatable with patch does seem to be pretty Xrare. No makefile is included, the 4.2bsd diff is better on the unix Xsystem I use. If you don't know how to compile and load a single C Xprogram, this probably isn't the tool for you anyway. I'd be grateful Xto who cleans this up and documents it properly. It does Xappear to have been separate files at some point, I'm presenting it in Xa form similar to how I got it: mail headers and outdated documentation Xin comments and all. I just banged on it enough to get it doing what XI wanted. X X--- XComp.Sources.Misc: Volume 2, Issue 8 XSubmitted-By: <mike2@lcuxa.UUCP> XArchive-Name: cdiff-v2 X XAfter receiving Bob Larson's sources for the PD context diff program, XI decided to accept his challenge to rewrite the documentation. In Xthe process, I also ported it to TURBOC version 1.5. It probably will Xalso compile in TURBOC 1.0, but since getting the update I dispensed Xwith the previous version and did not try it. `032 X XThe code has been reorganized to strip it of the documentation that Xwas built into it; that has been moved to the file cdiff.mem. Thus, Xthe following shar file includes cdiff.c, cdiff.1 (man source), cdiff.mem X(the previously built-in documentation), cdiff.doc (cdiff.1 passed Xthrough nroff -man for those who do not have nroff available), the Xoriginal README, and a new TC-READ.ME. Follow the notes in TC-READ.ME Xor it will run even slower! `032 X XOf course, no warranties whatsoever go with this. I merely hacked the Xcode minimally. I didn't write it. X--- X XComp.sources.misc: Volume 2, Issue 59 XSubmitted-By: <mike2@lcuxa.UUCP> XArchive-Name: pd-cdiff-patch X XNeil Dixon uncovered a flaw in the logic of the cdiff program that Xwas distributed early in January, and which was redistributed with Xchanges to make it compilable in Turbo C. I've tested his patch Xboth on the Unix SysVr2 version and on the PC, and have not found Xany errors. Conversely, the earlier version when compiled in MSC X4.0 (but, for some reason, not when compiled in TC 1.5) would Xsporadically come up with "read" errors. Since it now works in MSC as Xwell as TC, I've included the appropriate ifdefs for both compilers, Xand have incorporated Neil's patch. (This was for clarity. The line Xnumbers in his patch did not correspond precisely to the line numbers Xin the distributed code.) Both the patch as sent to me and the Xrevised code are contained below. X XAs before, I did not write this code. I merely ported it, and of Xcourse make no warranties whatsoever. X X--- X XOk, I guess that I will add my two cents worth. Here is yet another Xrepost of the public domain diff program. `032 X VI have integrated some changes into the i/o portion of the code, providing`03 X2 Xsome significant speedups. These changes were made after spending two`032 Xevenings playging around with the profiler, attempting various fixes to Vmake this beast a little faster. I completed this prior to the latest releas Xe`032 Xof the code (the version listed immediately above). `032 X VI have attempted to merge the changes provided by Mike above, but, since I do X`032 Xnot have any other machines close by, I could not test them. X XThe changes which I made are in the following areas: X X`009* modified the fgetss() and fputss() routines. These were the primary X`009 areas of intense activity on the system. From the source that I X`009 could see, these changes should be portable. After timing this`032 X`009 on my 3b1, the changes make this diff run at about the same speed X`009 as the system diff for the files that I was using (amazing isn't it?). X X`009* Moved the defines from within the source code to within the Makefile. X X`009* Ran the code through indent. Sorry about that, but it was the only V`009 way that I could make sure that I got all the other patches integrated` X032 X`009 properly. X X`009* Cleaned up some of the comments and added a few of my own. X X`009* Made a few tweaks to make lint happier. X X`009* Modified the Makefile to allow use of shared libraries. Included X`009 instructions for all the defines in the system as well. X XMark H. Colburn (mark@jhereg.mn.org) X XFixed to support VMS C 3.0 by Tim Russell (russell@zeus.unl.edu). $ GOSUB UNPACK_FILE $ EXIT -- ---------------------------------+-------------------------------------------- Tim Russell, Computer Operator | Internet: russell@zeus.unl.edu Campus Computing | Bitnet: russell@unoma1 University of Nebraska at Omaha | UUCP: uunet!zeus.unl.edu!russell