[net.sources] fix to readnews bug fix

kdmoen (02/21/83)

My apologies! There was a small bug in the fix to readnews that I posted
previously.  Here it is again...

Here is a fix to readnews, to fix the disappearing article bug.
[If you read an article posted to multiple newsgroups, you can't
 get back to it by typing '-' or its article number]

This replaces the seenbefore() routine starting at line 358 in rfuncs.c:

/*
 * Given an article ID, return TRUE if we have already seen that article ID
 * in another newsgroup.  This should only be called for articles
 * with commas in the newsgroup name, and prevents the same article, which
 * was submitted to multiple newsgroups, from being shown to the same
 * person more than once.  Bug: if the user quits after seeing the first
 * copy, he'll see it again next time in the other newsgroup.
/* DM modified to remember newsgroup of originally seen article,
 * DM in order to alleviate the disappearing article bug
 */
#define NART	100	/* max # articles on multiple newsgroups */
#define IDSIZE	14	/* max size of an article ID */
seenbefore(artid)
char *artid;
{
	static int nbef = 0;
	static struct {
		char	hb_id[IDSIZE];
		char	hb_ng[NGLN];	/* NGLN is in defs.h */
	} histbuf[NART];
	register int i;

	for (i=0; i<nbef; i++)
		if (strcmp(histbuf[i].hb_id, artid) == 0
		    && strncmp(histbuf[i].hb_ng, groupdir, NGLN) != 0)
			return TRUE;
	if (strlen(artid) >= IDSIZE) {
		fprintf(stderr, "Article id '%s' too long\n", artid);
		return FALSE;
	}
	if (nbef >= NART-1) {
		fprintf(stderr, "Too many multiple newsgroup articles\n");
		return FALSE;
	}
	strcpy(histbuf[nbef].hb_id, artid);
	strncpy(histbuf[nbef++].hb_ng, groupdir, NGLN);
	return FALSE;
}