Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC840302); site ttds.UUCP
Path: utzoo!linus!decvax!ittvax!qumix!amd!noao!hao!seismo!mcvax!enea!ttds!johanw
From: johanw@ttds.UUCP
Newsgroups: net.news.b
Subject: rn: Articles posted to multiple newsgroups shown more than once
Message-ID: <641@ttds.UUCP>
Date: Fri, 5-Oct-84 03:00:12 EDT
Article-I.D.: ttds.641
Posted: Fri Oct  5 03:00:12 1984
Date-Received: Sun, 7-Oct-84 21:20:24 EDT
Reply-To: johanw@ttds.UUCP (Johan Wide'n)
Organization: The Royal Inst. of Techn., Stockholm
Lines: 142

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 Widen