Mercurial > hg > toybox
comparison toys/posix/patch.c @ 1101:ccf4193167c3 draft
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.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 31 Oct 2013 09:36:55 -0500 |
parents | c2663b7eca78 |
children | 468444e5c7c5 |
comparison
equal
deleted
inserted
replaced
1100:b50e00c9df4b | 1101:ccf4193167c3 |
---|---|
199 for (;;) { | 199 for (;;) { |
200 if (!plist || lcmp(check->data, plist->data+1)) { | 200 if (!plist || lcmp(check->data, plist->data+1)) { |
201 // Match failed. Write out first line of buffered data and | 201 // Match failed. Write out first line of buffered data and |
202 // recheck remaining buffered data for a new match. | 202 // recheck remaining buffered data for a new match. |
203 | 203 |
204 if (PATCH_DEBUG) fprintf(stderr, "NOT: %s\n", plist->data); | 204 if (PATCH_DEBUG) { |
205 int bug = 0; | |
206 | |
207 while (plist->data[bug] == check->data[bug]) bug++; | |
208 fprintf(stderr, "NOT(%d:%d!=%d): %s\n", bug, plist->data[bug], | |
209 check->data[bug], plist->data); | |
210 } | |
205 | 211 |
206 TT.state = 3; | 212 TT.state = 3; |
207 do_line(check = dlist_pop(&buf)); | 213 do_line(check = dlist_pop(&buf)); |
208 plist = TT.current_hunk; | 214 plist = TT.current_hunk; |
209 | 215 |