Article View: news.software.nn
Article #3261Re: Lines header?
From: Bill Wohler
Date: Thu, 22 Oct 1992 14:34
Date: Thu, 22 Oct 1992 14:34
104 lines
4092 bytes
4092 bytes
mdm@kataan.apple.com (Michael McDaniel) writes:
>My posts do not seem to contain the "Lines:" header so all of my
>articles show up as being of length "?".
bad time to get sick...
while some parts of this discussion are revealing new things, some
aren't. here's the old stuff from the faq--please don't discuss it
again.
Subject: How come nn doesn't show the Lines count?
From: Using nn-21
Karl Kleinpaste writes:
C News sites can turn on Lines: header creation (we do here), but
the default has it turned off. I wish more would turn it on, as
several newsreaders put it to use, and it's the most easily
available metric of article size when showing the user a menu of
available articles.
Henry Spencer replies:
We're unenthusiastic about Lines:, which is why it's off by default
and little-documented. *The* most easily available metric of
article size is not line count -- which is often slightly wrong, by
the way -- but byte count, which is available without even parsing
the headers.
You can tell C News to add Lines: headers to articles *posted*
locally, but C News has no provision for adding headers to traffic
coming in from other sites. [Specifically, search for the string
"uncomment" in inews, and uncomment those lines. --bw]
But Paul Eggert and Luc Rooijakkers provide a solution:
Remember, these are *unofficial* patches so back them out before
patching in the next release of nn. You do not have to strip the
two leading spaces before these patches. In fact you can run "patch
-s -N < this-entire-faq", within the newsreader even!
===================================================================
RCS file: news.c,v
retrieving revision 1.1
diff -c2 -r1.1 news.c
*** news.c 1990/10/23 21:37:38 1.1
--- news.c 1992/06/19 23:17:05
***************
*** 231,235 ****
char *parse_header();
struct stat statb;
! int retry;
FILE *f;
#ifdef NNTP
--- 231,235 ----
char *parse_header();
struct stat statb;
! int c, retry;
FILE *f;
#ifdef NNTP
***************
*** 300,309 ****
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);
--- 300,328 ----
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 {
+ #ifdef NNTP
+ if (use_nntp && lazy) {
+ off_t fpos = ftell(f);
+ fclose(f);
+ f = nntp_get_article(art->a_number, 2);
+ if (f == NULL) return NULL;
+ lazy = 0;
+ fseek(f, fpos, 0);
+ }
+ #endif
+ 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);
Bill Wohler <wohler@sap-ag.de> <sapwdf!wohler>
Heidelberg Red Barons Ultimate Frisbee Team
Technical Details
Message-ID:
<4044@sapwdf.UUCP>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!sparky!uunet!mcsun!Germany.EU.net!sapwdf!wohlerReferences:
<1992Oct17.204328.20406@gallant.apple.com>Show Full Headers
Complete Article Headers
Message-ID: <4044@sapwdf.UUCP> Subject: Re: Lines header? Date: Thu, 22 Oct 1992 14:34:14 +0000 From: wohler@sapwdf.UUCP (Bill Wohler) References: <1992Oct17.204328.20406@gallant.apple.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!sparky!uunet!mcsun!Germany.EU.net!sapwdf!wohler Newsgroups: news.software.nn Reply-To: Bill Wohler <wohler@sap-ag.de> Organization: SAP AG, Walldorf, Germany Lines: 104