Dec 072017
Patch version 12. Useful for maintaining changes in software. With DIFF and PATCH, you have a rudimentary source control system. Turbo C source.
File PATCH12.ZIP from The Programmer’s Corner in
Category C Source Code
Patch version 12. Useful for maintaining changes in software. With DIFF and PATCH, you have a rudimentary source control system. Turbo C source.
File Name File Size Zip Size Zip Type
COMMON.H 4551 1710 deflated
CONFIG.H 1044 501 deflated
CONFIGUR.E 32444 10077 deflated
CONFIG_H.SH 4755 1802 deflated
EXTERN.H 320 181 deflated
GETSWITC.C 290 205 deflated
INP.C 9209 3131 deflated
INP.H 491 303 deflated
INTERN.H 295 179 deflated
MAKEFILE 903 347 deflated
MAKEFILE.SH 2420 1141 deflated
MALLOC.C 12729 4362 deflated
MANIFEST 1303 494 deflated
PATCH.C 23345 7125 deflated
PATCH.EXE 53286 24272 deflated
PATCH.HDR 2239 1119 deflated
PATCH.MAN 13334 4980 deflated
PATCHLEV.H 23 23 stored
PCH.C 30106 7847 deflated
PCH.H 816 386 deflated
PIPES.C 1566 572 deflated
POPEN.C 10579 2929 deflated
POPEN.H 69 52 deflated
POPENTST.MAK 303 150 deflated
README 8972 3907 deflated
TCPATCH1.DIF 17366 4519 deflated
TCPATCH2.DIF 24399 6313 deflated
TCPATCH3.DIF 22636 6576 deflated
TCPATCH4.DIF 1869 863 deflated
TCPATCH5.DIF 4395 1608 deflated
TCPATCH6.DIF 6842 2208 deflated
TCPATLEV.H 24 24 stored
UTIL.C 11636 3624 deflated
UTIL.H 2046 637 deflated
VERSION.C 517 301 deflated
VERSION.H 194 140 deflated

Download File PATCH12.ZIP Here

Contents of the README file

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,, 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
care of.

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.

3) make

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] (Larry Wall),
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.


(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.


From: [email protected] (Mike Ward)
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


From: [email protected] (Mike Ward)
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


Path: uwvax!!rutgers!usc!samsung!!bunyip!brolga!aas
From: [email protected] (Alex Sergejew)
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]

[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:

In pch.c:
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).

In util.c:
177: possibly incorrect assignment ....
the message is misleading (see the Turbo C User Manual).


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)


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).


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.
For example:
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 -> ...

 December 7, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>