shithub: rc

Download patch

ref: 69041639483e16392e3013491fcb382efd2b9374
parent: 024840612b2fca4f1d5251d002b43ed642230a26
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Nov 1 06:18:14 EDT 2022

rc: make `flag f [+-]` clear status on success (mforney@mforney.org)

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/simple.c
+++ b/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;
 			}
 		}