🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #943

SNEWS 1.30 bug with long lines

#943
From: Chris Croughton
Date: Wed, 05 Jun 1996 00:00
42 lines
2208 bytes
There's a bug with lines which are exactly 80 characters long (or rather
scr_cols long), in that when quoted they don't put a newline on the end.
The bug is in article.c, function load_article.c, where a newline is
added if it's not present after wrapping and then it is truncated at
scr_cols, losing the newline again.  This doesn't show on the screen,
because cput_with_highlight wraps anyway, but in the quoted text it runs
lines together.

The corrected version now reads:

                    lnbuf[i] = '\x00';
                }

                lnbuf[/*LINELENGTH*/scr_cols/* + 1*/] = '\x00';
                if (lnbuf[strlen(lnbuf) - 1] != '\n')
                    strcat(lnbuf, "\n");

                /* is it the first line - if so int the TEXT structure */
                if (ct == 0) {

The line

                lnbuf[/*LINELENGTH*/scr_cols/* + 1*/] = '\x00';

used to be later, after the if statement, which was causing the problem.

(Search for /*LINELENGTH*/ in article.c, it's not hard to find but if
you've made other changes the line number doesn't help much - in the
1.30 source it's around line 187 moved from about line 214.)

If you want to test it, the middle line here causes the problem:

0000000000111111111122222222223333333333444444444455555555556666666666777777777
00000000001111111111222222222233333333334444444444555555555566666666667777777777
000000000011111111112222222222333333333344444444445555555555666666666677777777778

I hope that helps...

.-------------------------------.-------------------------------------.
|    chris@keris.demon.co.uk    |  FIAWOL (Filking Is A Way Of Life)  |
`-------------------------------^-------------------------------------'
Technical Details
Message-ID: <Snews.960605.114812.chris.5839@keris.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bb05,a79887f371b3e408,start
X-Google-Attributes: gid10bb05,public
From: Chris Croughton <chris@keris.demon.co.uk>
Subject: SNEWS 1.30 bug with long lines
Date: 1996/06/05
Message-ID: <Snews.960605.114812.chris.5839@keris.demon.co.uk>
X-Deja-AN: 158670072
x-mail2news-path: keris.demon.co.uk
x-nntp-posting-host: keris.demon.co.uk
organization: Keristor Systems
newsgroups: demon.ip.developers