Article View: news.software.nn
Article #1191Re: News postings appear to have uncertain length
From: Paul Eggert
Date: Mon, 03 Dec 1990 03:33
Date: Mon, 03 Dec 1990 03:33
71 lines
2570 bytes
2570 bytes
boyce@hemel.bull.co.uk (David Boyce) writes:
>Postings from our (recently netted) site do not appear to have a length
>which makes sense when we read them using our nn, e.g.
>a Some author ? Some topic or other...
This is because C News does not output `Lines:' in the header.
I think this will be fixed in a future NN release.
If you can't wait, the following patch works for us.
===================================================================
RCS file: RCS/news.c,v
retrieving revision 1.1
diff -c -r1.1 news.c
*** 1.1 1990/10/23 21:37:38
--- news.c 1990/10/23 22:54:32
***************
*** 230,236 ****
char *digest_buffer;
char *parse_header();
struct stat statb;
! int retry;
FILE *f;
#ifdef NNTP
int lazy;
--- 230,236 ----
char *digest_buffer;
char *parse_header();
struct stat statb;
! int c, retry;
FILE *f;
#ifdef NNTP
int lazy;
***************
*** 299,310 ****
body = parse_header(f, art_hdr_field, modes, buffer1);
- news.ng_lines = news.ng_xlines ? atoi(news.ng_xlines) : -1;
if (news.ng_from == NULL) news.ng_from = news.ng_sender;
! if (modes & FILL_OFFSETS) {
art->fpos = news.ng_fpos = ftell(f);
fseek(f, (off_t)0, 2);
news.ng_lpos = ftell(f);
}
--- 299,319 ----
body = parse_header(f, art_hdr_field, modes, buffer1);
if (news.ng_from == NULL) news.ng_from = news.ng_sender;
! if (modes & FILL_OFFSETS)
art->fpos = news.ng_fpos = ftell(f);
+ if (news.ng_xlines)
+ news.ng_lines = atoi(news.ng_xlines);
+ else {
+ news.ng_lines = 0;
+ while ((c = getc(f)) != EOF)
+ if (c == '\n')
+ news.ng_lines++;
+ }
+
+ if (modes & FILL_OFFSETS) {
fseek(f, (off_t)0, 2);
news.ng_lpos = ftell(f);
}
Technical Details
Message-ID:
<1990Dec3.033332.23950@twinsun.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!usc!ucla-cs!twinsun!eggertReferences:
<1990Nov29.175114.19632@hemel.bull.co.uk>Show Full Headers
Complete Article Headers
Message-ID: <1990Dec3.033332.23950@twinsun.com> Subject: Re: News postings appear to have uncertain length Date: Mon, 03 Dec 1990 03:33:32 +0000 From: eggert@twinsun.com (Paul Eggert) References: <1990Nov29.175114.19632@hemel.bull.co.uk> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!usc!ucla-cs!twinsun!eggert Newsgroups: news.software.nn Sender: news@twinsun.com Organization: Twin Sun, Inc Lines: 71 Posted: Mon Dec 3 04:33:32 1990 Nntp-Posting-Host: ata