aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-10-31 09:36:55 -0500
committerRob Landley <rob@landley.net>2013-10-31 09:36:55 -0500
commit6f6ccc189d4574e257687d982d24d1e35934d77d (patch)
tree9c86fbecf07902e0ee37b0472d5ef363d0e7d55d /toys/posix
parent2baa73fb0d3999d541b2122b853b56e2bfdea56b (diff)
downloadtoybox-6f6ccc189d4574e257687d982d24d1e35934d77d.tar.gz
Make the patch -x option (only enabled with CONFIG_DEBUG) provide more information about why a patch didn't apply. (Offset of first nonmatching character at each line during seek phase.)
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/patch.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/toys/posix/patch.c b/toys/posix/patch.c
index 7fb6add3..ae24ff94 100644
--- a/toys/posix/patch.c
+++ b/toys/posix/patch.c
@@ -201,7 +201,13 @@ static int apply_one_hunk(void)
// Match failed. Write out first line of buffered data and
// recheck remaining buffered data for a new match.
- if (PATCH_DEBUG) fprintf(stderr, "NOT: %s\n", plist->data);
+ if (PATCH_DEBUG) {
+ int bug = 0;
+
+ while (plist->data[bug] == check->data[bug]) bug++;
+ fprintf(stderr, "NOT(%d:%d!=%d): %s\n", bug, plist->data[bug],
+ check->data[bug], plist->data);
+ }
TT.state = 3;
do_line(check = dlist_pop(&buf));