Subject: Re: How to apply patches in RCSDIFF format?
To: Alicia da Conceicao <>
From: Frederick Bruckman <>
List: port-i386
Date: 10/13/1999 09:51:31
On Wed, 13 Oct 1999, Alicia da Conceicao wrote:

> I am trying to apply a patch to support 3COM 3CCFEM556B 10/100
> Ether + Modem PCMICA cards, from in problem
> report #8331, to my ix86 NetBSD 1.4.1 kernel:
> Unfortunately the patch does not appear to be in the usual diff
> format.  (It looks like it was generated from rcsdiff.)  So applying
> the patch in the "/usr/src/sys/" directory using "patch < PATCHFILE"
> does not work.  Below is a sample of the patch format.

All you have to do is 'cd /usr/src/sys/dev/ic; patch < PATCH'. All
that's missing is the full path in the place where "patch" expects it.
Other than that, rcsdiff's are normal context diffs. This works
because "patch" will always look in the current directory first. It
only gets tricky when you have to patch several different files in
different directories...

>     Index: dev/ic/elink3.c
>     =================================================================
>     RCS file: /usr/src/CVSROOT/netbsd.sys/dev/ic/elink3.c,v
>     retrieving revision
>     diff -c -r1.1.1.1 elink3.c
>     *** elink3.c    1999/08/27 10:14:17
>     --- elink3.c    1999/08/31 09:06:33
>     ***************
>     *** 232,237 ****
>     --- 232,239 ----
>       void  ep_mii_sync __P((struct ep_softc *));
>       void  ep_mii_sendbits __P((struct ep_softc *, u_int32_t, int));
> Is there any option to the patch program to use this type of patch?
> Is there a way to convert the patch file into a format that can be
> used by the patch program?  (If I was to edit the patch file by hand
> with vi, what changes should I make?)

As follows...

  "*** elink3.c" becomes "*** dev/ic/elink3.c",
  "--- elink3.c" becomes "--- dev/ic/elink3.c"

and so on, for each file to patch. You can figure out the path to put
in there from the leading lines. The line numbers in each "hunk"  
help 'patch' to keep track, so those leading lines, beginning with
"Index: ...", will not be mistaken for part of the next section, but
will simply be ignored.