[net.news.b] two bugs in readr.c

dmmartindale (06/16/82)

Readnews has a couple of problems.  When you reply to an article
via 'r', it parses the From line to squash down multiple berknet
addreses.  Unfortunately, it does this BEFORE trimming off the
fullname, which screws up if someone has several periods in their
fullname.  The fix involves having the path masher stop at the
first blank rather than the end of string.  Also, when you cancel
an article with 'c', it skips printing the current article entirely.
This is fine if you just cancelled the current article, but very annoying
if the article you cancelled was the previous one (via "c-").  Both fixes
described here do work, but I'm not absolutely certain that the fix
for the cancellation bug is correct since I don't fully understand
all the bits pointer twiddling that goes on in readr.  Perhaps someone
more knowledgeable can check it.

	Dave Martindale, decvax!watmath!dmmartindale

First, diff -e:

	ed readr.c
	486,490d
	481c
					if (*ptr && *ptr!=' ') {
	.
	469c
					if (*ptr && *ptr!=' ')
	.
	467c
					for (; *++ptr && *ptr!=' ' && !index(NETCHRS, *ptr); i++)
	.
	432d
	428a
					fp = NULL;
	.
	424c
				if (!cancel(ofp, hptr, i) && hptr == &h) {
	.
	w
	q

Then, a diff -c:

*** /usr/distr/news/2.7/src/readr.c	Fri Jun 11 22:03:22 1982
--- readr.c	Tue Jun 15 19:38:27 1982
***************
*** 421,427
  				break;
  			} else if (i)
  				fprintf(ofp, "Not contributor: cancelling locally only.\n");
! 			if (!cancel(ofp, hptr, i)) {
  				clear(bit);
  				saveart;
  				nextbit();

--- 421,427 -----
  				break;
  			} else if (i)
  				fprintf(ofp, "Not contributor: cancelling locally only.\n");
! 			if (!cancel(ofp, hptr, i) && hptr == &h) {
  				clear(bit);
  				saveart;
  				nextbit();
***************
*** 426,431
  				saveart;
  				nextbit();
  				obit = -1;
  				if (!cflag)
  					putc('\n', ofp);
  			}

--- 426,432 -----
  				saveart;
  				nextbit();
  				obit = -1;
+ 				fp = NULL;
  				if (!cflag)
  					putc('\n', ofp);
  			}
***************
*** 429,435
  				if (!cflag)
  					putc('\n', ofp);
  			}
- 			fp = NULL;
  			break;
  
  		/* escape to shell */

--- 430,435 -----
  				if (!cflag)
  					putc('\n', ofp);
  			}
  			break;
  
  		/* escape to shell */
***************
*** 464,470
  				 * think we should just wait for the sane world
  				 * of internet absolute addreses.
  				 */
! 				for (; *++ptr && !index(NETCHRS, *ptr); i++)
  					;
  				if (*ptr)
  					ptr++;

--- 464,470 -----
  				 * think we should just wait for the sane world
  				 * of internet absolute addreses.
  				 */
! 				for (; *++ptr && *ptr!=' ' && !index(NETCHRS, *ptr); i++)
  					;
  				if (*ptr && *ptr!=' ')
  					ptr++;
***************
*** 466,472
  				 */
  				for (; *++ptr && !index(NETCHRS, *ptr); i++)
  					;
! 				if (*ptr)
  					ptr++;
  				if (ptr[-1] != ':' && ptr[-1] != '.') {
  					if (*curberk) {

--- 466,472 -----
  				 */
  				for (; *++ptr && *ptr!=' ' && !index(NETCHRS, *ptr); i++)
  					;
! 				if (*ptr && *ptr!=' ')
  					ptr++;
  				if (ptr[-1] != ':' && ptr[-1] != '.') {
  					if (*curberk) {
***************
*** 478,484
  					strncpy(curberk, pathptr, ++i);
  					curberk[i] = '\0';
  				}
! 				if (*ptr) {
  					pathptr = ptr;
  					i = 1;
  					goto again;

--- 478,484 -----
  					strncpy(curberk, pathptr, ++i);
  					curberk[i] = '\0';
  				}
! 				if (*ptr && *ptr!=' ') {
  					pathptr = ptr;
  					i = 1;
  					goto again;
***************
*** 483,493
  					i = 1;
  					goto again;
  				}
- 				/* Strip off all but first word, to avoid
- 				 * the full name (Joe Blow). */
- 				ptr = index(rcbuf, ' ');
- 				if (ptr)
- 					*ptr = 0;
  			}
  			fprintf(ofp, "To: %s\n", rcbuf);
  			fflush(ofp);

--- 483,488 -----
  					i = 1;
  					goto again;
  				}
  			}
  			fprintf(ofp, "To: %s\n", rcbuf);
  			fflush(ofp);