aboutsummaryrefslogtreecommitdiff
path: root/editors/patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/patch.c')
-rw-r--r--editors/patch.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/editors/patch.c b/editors/patch.c
index aebb5073e..f90d6854d 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -138,9 +138,9 @@ static void do_line(void *data)
138{ 138{
139 struct double_list *dlist = data; 139 struct double_list *dlist = data;
140 140
141 if (TT.state>1 && *dlist->data != TT.state) 141 if (TT.state > 1 && *dlist->data != TT.state)
142 fdprintf(TT.state == 2 ? 2 : TT.fileout, 142 fdprintf(TT.state == 2 ? 2 : TT.fileout,
143 "%s\n", dlist->data+(TT.state>3 ? 1 : 0)); 143 "%s\n", dlist->data + (TT.state > 3 ? 1 : 0));
144 144
145 if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data); 145 if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data);
146 146
@@ -221,7 +221,7 @@ static int apply_one_hunk(void)
221 221
222 // Match EOF if there aren't as many ending context lines as beginning 222 // Match EOF if there aren't as many ending context lines as beginning
223 for (plist = TT.current_hunk; plist; plist = plist->next) { 223 for (plist = TT.current_hunk; plist; plist = plist->next) {
224 if (plist->data[0]==' ') matcheof++; 224 if (plist->data[0] == ' ') matcheof++;
225 else matcheof = 0; 225 else matcheof = 0;
226 if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data); 226 if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data);
227 } 227 }
@@ -433,15 +433,15 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
433 433
434 // Are we assembling a hunk? 434 // Are we assembling a hunk?
435 if (state >= 2) { 435 if (state >= 2) {
436 if (*patchline==' ' || *patchline=='+' || *patchline=='-') { 436 if (*patchline == ' ' || *patchline == '+' || *patchline == '-') {
437 dlist_add(&TT.current_hunk, patchline); 437 dlist_add(&TT.current_hunk, patchline);
438 438
439 if (*patchline != '+') oldlen--; 439 if (*patchline != '+') oldlen--;
440 if (*patchline != '-') newlen--; 440 if (*patchline != '-') newlen--;
441 441
442 // Context line? 442 // Context line?
443 if (*patchline==' ' && state==2) TT.context++; 443 if (*patchline == ' ' && state == 2) TT.context++;
444 else state=3; 444 else state = 3;
445 445
446 // If we've consumed all expected hunk lines, apply the hunk. 446 // If we've consumed all expected hunk lines, apply the hunk.
447 447
@@ -469,9 +469,9 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
469 free(*name); 469 free(*name);
470 // Trim date from end of filename (if any). We don't care. 470 // Trim date from end of filename (if any). We don't care.
471 for (s = patchline+4; *s && *s!='\t'; s++) 471 for (s = patchline+4; *s && *s!='\t'; s++)
472 if (*s=='\\' && s[1]) s++; 472 if (*s == '\\' && s[1]) s++;
473 i = atoi(s); 473 i = atoi(s);
474 if (i>1900 && i<=1970) 474 if (i > 1900 && i <= 1970)
475 *name = xstrdup("/dev/null"); 475 *name = xstrdup("/dev/null");
476 else { 476 else {
477 *s = 0; 477 *s = 0;