ref: c7e25f71b4b4705e2dde15ceb497e4091b121c7e
parent: 64eaf7ba5bafbb3995cfb6f986dfd9a735f8ff81
author: Michael Forney <mforney@mforney.org>
date: Sun Oct 30 00:34:44 EDT 2022
rc: make `flag f [+-]` clear status on success 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.
--- 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;
}
}