[EMAIL PROTECTED] wrote:
'man patch' has some good info, but I guess what I'm really wanting to
know is where to get information on the format of patch files so that i
can understand better how to read them.  I don't like the idea of just
'patch myfile' without knowing exactly whats getting changed, and the
whole "+ lines add stuff and -lines remove stuff" is not explanitory
enough, as there seems to be more information in those files than just
that.  I could be wrong, thats why I'm asking for clarification.

Actually, it's not much more than that.

A patch is generated by diff, a tool to show only the differences of two files. The most common diff format is the unified diff, generated with:

$ diff -u file1 file2

The output is then quite simple:

--- driver/xscreensaver.c.orig    2005-08-07 17:36:17.815261536 +0200
+++ driver/xscreensaver.c    2005-08-07 17:37:08.644534312 +0200

This shows which files got diff'ed: In our case, I copied the original one to xscreensaver.c.orig and modified xscreensaver.c. But thats not interesting. All the patch command needs to know is that this patch applies to the file xscreensaver.c in the directory driver. You could also diff whole directories. In the output of the diff command, theres one such header for each file that has changed.

@@ -1641,10 +1641,12 @@

This marks the part, where the two files differ: in file1, the part starts at line 1641 and is 10 lines long. in file 2 the part starts at the same offset (1641) but is 12 lines long. You can see that I've added two lines in the second file.

       if (hint.res_class) XFree (hint.res_class);
     }

+/*
   fprintf (stderr, "%s: %d: unrecognised ClientMessage \"%s\" received\n",
            blurb(), screen, (str ? str : "(null)"));
   fprintf (stderr, "%s: %d: for window 0x%lx (%s)\n",
            blurb(), screen, (unsigned long) w, wdesc);
+*/
   if (str) XFree (str);
 }

The rest of the patch shows the actual difference, where added lines are marked with a '+', and removed lines are marked with a '-'.

In the above example, I simply commented out the part that spits out the useless error message.

Christoph
--
echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" [EMAIL PROTECTED]


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to