🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90735

Re: [PATCH]: SLRN: include Injection headers in new score.

#90735
From: Kaz Kylheku
Date: Thu, 07 Sep 2023 07:01
72 lines
3221 bytes
On 2023-08-28, Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> From c84453f2def8f78721d4f31166c1e75568a2fd90 Mon Sep 17 00:00:00 2001
> From: Kaz Kylheku <kaz@kylheku.com>
> Date: Mon, 28 Aug 2023 00:01:05 -0700
> Subject: [PATCH 2/2] Include Injection headers when editing scores.

This is has an issue, requiring a follow-up patch

From 51444fba3b157cebcf2296833a52be26e2e5b745 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Wed, 6 Sep 2023 20:32:04 -0700
Subject: [PATCH 3/3] bug: editscore: extra headers react to 'f'

I copy-pasted some code in coming up with the feature
whereby additional header are included in a score file
edit. If the user selects to create the score by F)rom,
these headers are wrongly being uncommented.
I think that extra headers should always be commented.

* src/editscore.c (slrn_edit_score): In the loop that
checks the list of additional headers, every header
that we select is now added to the file commented
with the % character, unconditionally. This simplifies
the code; the copy pasted (ch == 'f') and (ch != 'f')
are gone, as is the regex compilation check, and
setting of re_error.
---
 src/editscore.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/editscore.c b/src/editscore.c
index ba1d022..f0d5218 100644
--- a/src/editscore.c
+++ b/src/editscore.c
@@ -309,30 +309,12 @@ int slrn_edit_score (Slrn_Header_Type *h, char *newsgroup)
 
 	     line = slrn_safe_strmalloc (value);
 	     remove_linebreaks (line);
-	     if ((NULL == (q = SLregexp_quote_string (line, qregexp, sizeof (qregexp)))) ||
-		 (ch != 'f') ||
-#if SLANG_VERSION < 20000
-		 (0 != SLang_regexp_compile (&re))
-#else
-		 (NULL == (re = SLregexp_compile (qregexp, SLREGEXP_CASELESS)))
-#endif
-		 )
-	       {
-		  re_error |= (ch == 'f');
-		  comment = 1;
-	       }
-	     else
-	       comment = 0;
-	     fprintf (fp, "%c\t%s: %s\n",
-		      (comment ? '%' : ' '), ah_iter->name, (q ? q : line));
+	     /* Extra headers are always commented, so we don't do the regex
+	      * compilation check or react to selection letter in ch.
+	      */
+	     q = SLregexp_quote_string (line, qregexp, sizeof (qregexp));
+	     fprintf (fp, "%%\t%s: %s\n", ah_iter->name, (q ? q : line));
 	     slrn_free (line);
-#if SLANG_VERSION >= 20000
-	     if (re != NULL)
-	       {
-		  SLregexp_free (re);
-		  re = NULL;
-	       }
-#endif
 	  }
 
 	fprintf (fp, "%%EOS\n");
-- 
2.17.1
Technical Details
Message-ID: <20230906235950.123@kylheku.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <20230828125422.870@kylheku.com>

Show Full Headers
Complete Article Headers
Message-ID: <20230906235950.123@kylheku.com>
Subject: Re: [PATCH]: SLRN: include Injection headers in new score.
Date: Thu, 07 Sep 2023 07:01:26 +0000
From: Kaz Kylheku <864-117-4973@kylheku.com>
References: <20230828125422.870@kylheku.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: A noiseless patient Spider
Lines: 73
Injection-Date: Thu, 7 Sep 2023 07:01:26 -0000 (UTC)
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:jOYXjPIdxpBDsJao/L1RfKwDXzo=