Patch Kit, Version 2.0
Copyright (c) 1988, 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.
Please read all the directions below before you proceed any further, and
then follow them carefully. Failure to do so may void your warranty. 🙂
After you have unpacked your kit, you should have all the files listed
1) Run Configure. This will figure out various things about your system.
Some things Configure will figure out for itself, other things it will
ask you about. It will then proceed to make config.h, config.sh, and
You might possibly have to trim # comments from the front of Configure
if your sh doesn't handle them, but all other # comments will be taken
If you don't have sh, you'll have to rip the prototype of config.h out
of Configure and generate the defines by hand.
2) Glance through config.h to make sure system dependencies are correct.
Most of them should have been taken care of by running the Configure script.
If you have any additional changes to make to the C definitions, they
can be done in the Makefile, or in config.h. Bear in mind that they may
get undone next time you run Configure.
This will attempt to make patch in the current directory.
4) make install
This will put patch into a public directory (normally /usr/local/bin).
It will also try to put the man pages in a reasonable place. It will not
nroff the man page, however.
5) Read the manual entry before running patch.
6) IMPORTANT! Help save the world! Communicate any problems and
suggested patches to me, [email protected]
so we can keep the world in sync. If you have a problem, there's
someone else out there who either has had or will have the same problem.
If possible, send in patches such that the patch program will apply them.
Context diffs are the best, then normal diffs. Don't send ed scripts--
I've probably changed my copy since the version you have.
Watch for patch patches in net.sources.bugs. Patches will generally be
in a form usable by the patch program. If you are just now bringing up
patch and aren't sure how many patches there are, write to me and I'll
send any you don't have. Your current patch level is shown in patchlevel.h.
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.
*** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 1
From: [email protected]
Date: 31 May 90
minimal patches to enable compilation under Turbo C2.0, execution under MSDOS
temp files go in directory /tmp
ed scripts disabled
*** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 2
From: [email protected]
Date: 31 May 90
improved (more descriptive) usage message
temp files go in directory specified by TMP env var (or current dir if no TMP)
ed scripts still disabled
*** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 3
From: [email protected]
Date: 15 Jul 90 11:03:51 GMT
The following are comments and patches to the patches to Larry Wall's patch
program (patchlevel 12) recently submitted by [email protected]
(Michael Ward) to allow compilation with Turbo C 2.0 and to run under MSDOS.
I have addressed a couple of recent bug reports and also re-enabled the
use of ed scripts (given a working MSDOS ed program, of which simtel20
has several that are compatible with unix V7 ed).
New files are:
popen c 10579 7-15-90 3:58p
popen h 69 3-08-88 8:08p
getswitc c 290 3-08-88 8:08p
popentst mak 303 7-15-90 3:43p
These provide the popen() functionality and were snarfed from simtel20
in `pd1:popen.arc'. The original author's name is not given.
Try `make -fpopentst' to check-out the DEMO mode (see popen.c) but
remember to delete popen.obj and getswitc.obj from this trial before
compiling the merged/patched version of patch.
Alex A Sergejew
University of Queensland Neuro-Psychiatric Institute
[email protected] (Neil Weisenfeld) reports getting a run-time
error of the form:
patch: couldn't create D:\/patchpxxxxxx
This is due to having the TMP environment variable set to "D:\"
(note that a lot of MSDOS software actually wants the trailing "\").
Patch as distributed blindly concatenates /patch?xxxxxx strings and the
"\/" juxtaposition causes strife to MSDOS. The problem does not arise using
other shells such as ms_sh or ksh. A temporary workaround is to re-set the
TMP environment variable without the trailing "\".
This has been repaired in the appended patches.
[email protected] correctly observes that:
>>In file INP.C, there is a procedure called rev_in_string() at the bottom.
>>This procedure declares a local variable "s", which is then used without
>>first being given a value. This instance of "s" should be replaced with
>>the parameter "string" instead on that one line.
This has also been repaired in the appended patches.
There are still warnings reported by Turbo C in compiling the distribution:
243: Possible use of 'fcntl_line' before definition ...
the variable concerned is not in fact used before definition and the warning
can be safely ignored.
In popen.c there appear 3 warnings of the type:
xxx: 'lineno' is assigned a value which is never used in function ...
which can also be ignored (the variable is used in DEMO mode).
177: possibly incorrect assignment ....
the message is misleading (see the Turbo C User Manual).
*** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 4
From: [email protected] (lee fisher)
Subject: re: MSDOS Patch: more patches
Date: Mon Jul 16 13:08:47 1990
In the above function uniquepipe() of popen.c, the format for the pipe
name ("pipe%05d.tmp") will generate an invalid file name for DOS. In
the DOS FAT file system, the base filename can only be 8 characters
(with a maximum file name extension of 3 characters), anything greater
than this will be silently truncated by DOS. Thus, pipe00000.tmp is 9.3,
where the DOS max is 8.3, so isn't there a problem where pipe00001 and
pipe00002 will get confused?
How about %04d instead. I would think that making the assumption that
this implementation of pipes for DOS will only have 9999 pipes at any
given point in time would be better than losing the rightmost digit
in the current implementation.
(this bug is now fixed)
*** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 5
From: [email protected] (Alex Sergejew)
Date: Fri, 20 Jul 90 23:56:13 EST
The problem is that whatever ed is doing it's not accepting the
redirected stdin from the shelled COMMAND.COM and so it stalls. When you
hit q it unstalls and also returns normally but hasn't read the ed script.
Appended find *more* patches, this time to a pipe package that *does* work
the way it ought to, along with appropriate mods to pch.c and makefile
(ie patches to my patches to your patches to etc). The pipe package here
was snarfed from an old edition of lharc and is more limited than the fancy
one I posted but it works just fine with patch (it does stdin redirection
from the invocation of the spawned COMMAND.COM - quite foolproof).
*** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 6
From: [email protected] (Mike Ward)
Date: Tue, 07 Aug 90 12:13:00 EST
The problem is that to generate a backup name the program simply appends
the suffix (or prepends the prefix). This doesn't go over too well under
I modified this procedure to know about file name/extension limits for the
append case (prepend still messed up). The code now appends only the first
char of the suffix (hopefully this will be the whole suffix), and if the
file name is still no good, it starts appending version digits/letters.
filexyz.sou -> filexyzs.ou~ -> ilexyzso.u~0 -> ilexyzso.u~1 ->
ilexyzso.u~2 -> ... -> ilexyzso.u~9 -> ilexyzso.u~A ->
ilexyzso.u~B -> ... -> ilexyzso.u~Z -> lexyzsou.~0A -> ...