From: Jonathan Magid (jem@sunSITE.unc.edu)
Date: 11/30/92


From: jem@sunSITE.unc.edu (Jonathan Magid)
Subject: Re: What are these 'diff' beasts?
Date: 1 Dec 1992 02:42:42 GMT

In article <1992Dec1.011950.25641@msuinfo.cl.msu.edu> major@pacific.cps.msu.edu (Ronald Major) writes:
>Hi all,
> What do I do with diff files besides look at them?
> I don't mind making a few changes to files by hand,
> but when the diff is over 100k and affects dozens
> of files, I get lazy real fast.
> Is there a way to automate the process of combining
> diffs and target files?

eek. Patching by hand is *not* something one wants to do.

the files produced by diff, are roughly scripts for the line
editor ed(1). That is, they are a series of instructions on
how to turn the old file into the new file.

Use Larry Wall's wonderfully useful program, patch(1) to do
this feat. patch reads the standard input for instructions,
so

$ patch < foo.patch

should do what you wish.

Patch (like any self-respecting Unix utility) has many tons
of useful switches, but the most important imho, is the -p
switch, which strips off leading slashes in the file names
that the diff refers to.

i.e.

patch -p2 < foo.patch

would remove the first and second slash in the file name refered to
in the diff (and anything before it). In other words,

/usr/src/foo.c

would become merely src/foo.c

This is a Good and Useful Thing, if you have put your
source files in a different place than the person who
released the patch took their diff from.

for more info, rtfm.

jem.

-- 
Jonathan Magid     jem@sunSITE.unc.edu       sunSITE Administrator
Virtual pizza Delivery (tm)::faxed in 30 cycles or less or you get it
========================================FREE!!!=======================