shithub: patch

Download patch

ref: e08f7ebb67ac129e475e57f95e69617eb523846f
parent: 40e9de2fef1b833b6dbea8ad18f0afd24b12b9f1
author: qwx <qwx@sciops.net>
date: Wed Jan 15 20:56:42 EST 2025

add patch-multi: (status pending) alter behavior of multipatch handling

apply each in succession instead of assuming them all independent

--- /dev/null
+++ b/patch-multi
@@ -1,0 +1,33 @@
+diff d5938c597328adb8abb8785b4ac820ca0f094b6b uncommitted
+--- a/sys/src/cmd/patch.c
++++ b/sys/src/cmd/patch.c
+@@ -503,6 +503,8 @@
+ 		free(c->new);
+ 	}
+ 	free(changed);
++	changed = nil;
++	nchanged = 0;
+ }
+ 
+ void
+@@ -723,8 +725,9 @@
+ 		}
+ 		freepatch(p);
+ 		Bterm(f);
++		finish(ok);
+ 	}else{
+-		for(i = 0; i < argc; i++){
++		for(i = 0; ok && i < argc; i++){
+ 			if((f = Bopen(argv[i], OREAD)) == nil)
+ 				sysfatal("open %s: %r", argv[i]);
+ 			if((p = parse(f, argv[i])) == nil)
+@@ -735,8 +738,8 @@
+ 			}
+ 			freepatch(p);
+ 			Bterm(f);
++			finish(ok);
+ 		}
+ 	}
+-	finish(ok);
+ 	exits(nil);
+ }