9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Michael Forney <mforney@mforney.org>
To: 9front@9front.org
Subject: [9front] [PATCH] rc: make `flag f [+-]` clear status on success
Date: Sun, 30 Oct 2022 04:34:44 +0000	[thread overview]
Message-ID: <AFBE5AB0C7B1923FE94D4C10DBC9E7D6@mforney.org> (raw)


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;
 			}
 		}

             reply	other threads:[~2022-10-30  4:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30  4:34 Michael Forney [this message]
2022-10-31 19:49 ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AFBE5AB0C7B1923FE94D4C10DBC9E7D6@mforney.org \
    --to=mforney@mforney.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).