🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #63128

[slrn] Bugfix: Soft linebreak on last line

#63128
From: Thomas Schultz
Date: Sun, 09 Jul 2000 00:00
51 lines
2212 bytes
Hello,

Quoted-Printable messages can contain "soft" linebreaks (indicated by
"=" at the end of the line). In slrn, this is handled by the function
merge_if_soft_linebreak() in mime.c. However, the code does not handle
the situation correctly if the _last_ line ends with a soft linebreak
(which may sound absurd, but is actually possible) and prints the "="
character. The fix for this is so trivial that I hope it can still go
into the next version of slrn. Here is the patch:

diff -ur slrn-0.9.6.2.orig/src/mime.c slrn-0.9.6.2/src/mime.c
--- slrn-0.9.6.2.orig/src/mime.c	Sun Dec 19 22:51:32 1999
+++ slrn-0.9.6.2/src/mime.c	Sun Jul  9 15:45:12 2000
@@ -478,11 +478,11 @@
 static int merge_if_soft_linebreak (Slrn_Article_Line_Type *curr_line)
 {
    Slrn_Article_Line_Type *next_line;
+   unsigned int len;
 
    while ((next_line = curr_line->next) != NULL)
      {
 	char *b = curr_line->buf;
-	unsigned int len;
 
 	len = strlen (b);
 	if (len == 0) return 0;
@@ -508,6 +508,12 @@
 	SLFREE (next_line->buf);
 	SLFREE (next_line);
      }
+   
+   /* In case the last line ends with a soft linebreak: */
+   len = strlen(curr_line->buf);
+   if (len && (curr_line->buf[len-1] == '='))
+     curr_line->buf[len-1] = '\0';
+   
    return 0;
 }
 
@@ -532,8 +538,7 @@
 	
 	b = line->buf;
 	len = strlen (b);
-	if (len && (b[len - 1] == '=') 
-	    && (line->next != NULL))
+	if (len && (b[len - 1] == '='))
 	  {
 	     (void) merge_if_soft_linebreak (line);
 	     b = line->buf;

Technical Details
Message-ID: <slrn8mh2jc.13g.tststs@starflower.tststs.ddns.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <slrn8mh2jc.13g.tststs@starflower.tststs.ddns.org>
Subject: [slrn] Bugfix: Soft linebreak on last line
Date: Sun, 09 Jul 2000 00:00:00 +0000
From: tststs@gmx.de (Thomas Schultz)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!not-for-mail
X-Deja-AN: 644248726
X-Server-Date: 9 Jul 2000 14:19:37 GMT
X-Complaints-To: abuse@cityweb.de
Organization: Pinguin online.
User-Agent: slrn/0.9.6.2+ (Linux)
NNTP-Posting-Date: 9 Jul 2000 14:22:31 GMT
Newsgroups: news.software.readers