johanw@ttds.UUCP (10/05/84)
Index: rn/bits.c (rn is a news reading program)
Description:
rn handles postings to multiple newsgroups for news version 10.2
but not for news version 10.1. The reason for this is that the
format of the 'Xref:' line is different for news 10.1 and news 10.2
The patch 'inews.c.2.pat' yields:
Xref: sitename newsgroup:number newsgroup:number...
whereas the patch 'inews.c.1.pat' yields:
Xref: sitename number number...
where number is an article-number.
The last format was apparently used in an older version of rn.
The current version only supports the first format.
Fix:
The right thing to do is to change inews so it generates
Xref lines according to the first format. I did not do this for
some reason (it seemed easier to change rn). Instead rn was changed
so that it accepts either format, depending on an #define.
Add the line
#define NEWS10_1
to config.h
Change chase_xrefs() in bits.c to:
int
chase_xrefs(artnum,markread)
ART_NUM artnum;
int markread;
{
#ifdef ASYNC_PARSE
if (parse_maybe(artnum)) /* make sure we have right header */
return -1;
#endif
if (
#ifdef DEBUGGING
debug & DEB_FEED_XREF ||
#endif
htype[XREF_LINE].ht_minpos >= 0) {
/* are there article# xrefs? */
char *xref_buf, *curxref;
#ifdef NEWS10_1
char *ng_buf, *cur_ng;
#endif
register char *xartnum;
register ART_NUM x;
char tmpbuf[128];
#ifdef NEWS10_1
char ngTmpBuf[128];
#endif
#ifdef DEBUGGING
if (htype[XREF_LINE].ht_minpos >= 0) {
#endif
xref_buf = fetchlines(artnum,XREF_LINE);
/* get xrefs list */
#ifdef NEWS10_1
cur_ng = ng_buf = fetchlines(artnum,NGS_LINE);
#endif
#ifdef DEBUGGING
} else {
xref_buf = safemalloc((MEM_SIZE)100);
printf("Give Xref: ");
gets(xref_buf);
}
#endif
#ifdef DEBUGGING
if (debug & DEB_XREF_MARKER)
printf("Xref: %s\n",xref_buf);
#endif
curxref = cpytill(tmpbuf,xref_buf,' ');
if (strEQ(tmpbuf,sitename))
curxref++;
else {
#ifdef DEBUGGING
if (debug)
printf("Xref not from this system--ignoring\n");
#endif
goto wild_goose;
}
while (*curxref) {
/* for each newsgroup */
curxref = cpytill(tmpbuf,curxref,' ');
#ifdef NEWS10_1
cur_ng = cpytill(ngTmpBuf,cur_ng,',');
if (strNE(ngTmpBuf,ngname)) {/* not the current newsgroup? */
x = atol(tmpbuf);
if (x)
if (markread) {
if (addartnum(x,ngTmpBuf))
goto wild_goose;
}
#ifdef MCHASE
else
subartnum(x,ngTmpBuf);
#endif
}
while (*curxref && isspace(*curxref))
curxref++;
if(*cur_ng == ',')
cur_ng++;
}
wild_goose:
free(xref_buf);
free(ng_buf);
#else
xartnum = index(tmpbuf,':');
if (!xartnum) /* probably an old-style Xref */
break;
*xartnum++ = '\0';
if (strNE(tmpbuf,ngname)) {/* not the current newsgroup? */
x = atol(xartnum);
if (x)
if (markread) {
if (addartnum(x,tmpbuf))
goto wild_goose;
}
#ifdef MCHASE
else
subartnum(x,tmpbuf);
#endif
}
while (*curxref && isspace(*curxref))
curxref++;
}
wild_goose:
free(xref_buf);
#endif
}
return 0;
}
END OF FIX
This is probably full of bugs...
mcvax!enea!ttds!johanw Johan Widenlwall@sdcrdcf.UUCP (Larry Wall) (10/08/84)
In article <641@ttds.UUCP> johanw@ttds.UUCP (Johan Wide'n) writes: >Index: rn/bits.c (rn is a news reading program) > >Description: > rn handles postings to multiple newsgroups for news version 10.2 > but not for news version 10.1. The reason for this is that the > format of the 'Xref:' line is different for news 10.1 and news 10.2 > >Fix: > The right thing to do is to change inews so it generates > Xref lines according to the first format. I did not do this for > some reason (it seemed easier to change rn). Instead rn was changed > so that it accepts either format, depending on an #define. The correct inews patch for 2.10.1 systems can be found in <1357@sdcrdcf.UUCP> (bug #5) in either net.new.b or net.sources.bugs. It's actually simpler than the bogus 2.10.1 inews.c patch, since inews no longer has to carefully cross-match the Xref line with the Newsgroups line. What happened was I had modified the 2.10.1 inews, but forgot to run the diff before posting the kit, so I got a old version of the patch into the kit. Sorry 'bout that. The reason the Xref format changed was to support newsgroup aliasing of 2.10.2. Newsgroup aliasing means that the list of newsgroups actually posted to on a machine may bear little relation to the list of newsgroups on the Newsgroups line. Originally I wanted to save a bit of disk storage by running the Xref line in parallel with the Newsgroups line, but that was not to be. I console myself with the fact that the new Xref format simplifies both the inews patch and rn, and is more robust to boot. Happy Hacking, Larry Wall {allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall