9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] rc: make `flag f [+-]` clear status on success
@ 2022-10-30  4:34 Michael Forney
  2022-10-31 19:49 ` cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Forney @ 2022-10-30  4:34 UTC (permalink / raw)
  To: 9front


Otherwise, the old status will be retained, which may be non-empty if
it follows an if command whose branch wasn't taken.  This is
problematic for scripts using -e.
---
diff 2e1ac96d3f6ff85ccac1681631d09d60953cf8a6 d07ea0f0bffab3999e873ea035e08904749ba581
--- a/sys/src/cmd/rc/simple.c
+++ b/sys/src/cmd/rc/simple.c
@@ -445,10 +445,12 @@
 		if(strlen(letter)==1){
 			if(strcmp(val, "+")==0){
 				flag[(unsigned char)letter[0]] = flagset;
+				setstatus("");
 				break;
 			}
 			if(strcmp(val, "-")==0){
 				flag[(unsigned char)letter[0]] = 0;
+				setstatus("");
 				break;
 			}
 		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-31 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-30  4:34 [9front] [PATCH] rc: make `flag f [+-]` clear status on success Michael Forney
2022-10-31 19:49 ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).