Matthew Nuzum wrote: > > Can anyone point to clear instructions on how to use diff, especially in > understanding and using the output?
The only form of diff I use is -u. This is called a unified diff. Here is an example of it's output, explained. For this I used the -ruN options (recursive, unified, new-files as diffs). Sometimes the -b option is useful to ignore blankspace diffs. > diff -ruN dist-2.4.12+patches/Documentation/Configure.help >cvs-2.4.12+patches/Documentation/Configure.help the command line - when diffing multiple files, diff puts this in. > --- dist-2.4.12+patches/Documentation/Configure.help Mon Oct 15 10:20:16 2001 > +++ cvs-2.4.12+patches/Documentation/Configure.help Mon Oct 15 10:34:55 2001 The --- line shows the name of the old file. The +++ line shows the name of the new file. All lines that start with a - have been removed. All lines that start with a + have been added. In non-unified diffs, sometimes you'll see other line-markers. > @@ -14952,9 +15177,10 @@ This is the hunk-header. It says that the hunk starts at line 14952 and lasts 9 lines in the original file. It also says that the new hunk starts at line 15177 in teh new file, and contains 10 lines. A net gain of one line. > CONFIG_NVRAM > If you say Y here and create a character special file /dev/nvram > with major number 10 and minor number 144 using mknod ("man mknod"), This is context. By default diff uses 3 lines of context (a cmdline opt can change that). This helps patch find where to put a diff when teh line numbers don't match exactly. Always three lines at the top of a hunk and three lines at the bottom. Thus, no hunk is less than 7 lines (6 context, at least one change). > - you get read and write access to the 50 bytes of non-volatile memory > + you get read and write access to the extra bytes of non-volatile memory This shows that the line changed, the old form is removed and the new form is inserted at the same place > in the real time clock (RTC), which is contained in every PC and an unchanged line, but less than 3 lines, so no need for a new hunk. > - most Ataris. > + most Ataris. The actual number of bytes varies, depending on the > + nvram in the system, but is usually 114. This shows that one line was removed and two inserted. Here is our net gain of one line. > > This memory is conventionally called "CMOS RAM" on PCs and "NVRAM" > on Ataris. /dev/nvram may be used to view settings there, or to 3 lines of context at the end. So we have 3 context, 1 change, 1 unchanged, 1 change, 1 new, and 3 context = 10 lines. > diff -ruN dist-2.4.12+patches/drivers/char/nvram.c >cvs-2.4.12+patches/drivers/char/nvram.c > --- dist-2.4.12+patches/drivers/char/nvram.c Mon Oct 15 10:21:41 2001 > +++ cvs-2.4.12+patches/drivers/char/nvram.c Mon Oct 15 10:21:41 2001 Another file. > @@ -10,8 +10,9 @@ > * "NVRAM" (NV stands for non-volatile). > * > * The data are supplied as a (seekable) character device, /dev/nvram. The > - * size of this file is 50, the number of freely available bytes in the memory > - * (i.e., not used by the RTC itself). > + * size of this file is dependant on the controller. The usual size is 50, > + * the number of freely available bytes in the memory (i.e., not used by the > + * RTC itself). > * > * Checksums over the NVRAM contents are managed by this driver. In case of a > * bad checksum, reads and writes return -EIO. The checksum can be initialized I'll leave the interpretation to you. Any file can have multiple hunks, each starting with @@ Clear now? Maybe a bit :) -- Tim Hockin Systems Software Engineer Sun Microsystems, Cobalt Server Appliances [EMAIL PROTECTED] _______________________________________________ cobalt-developers mailing list [EMAIL PROTECTED] http://list.cobalt.com/mailman/listinfo/cobalt-developers