[alt.sources] Important Tass patch

skrenta@blekko.commodore.com (Rich Skrenta) (04/20/91)

[I sent out a bogus patch this morning.  If you've applied it, undo it
before applying this one.  Sorry]

Tass 3.2 will croak if it sees an article and can't find a From: or Subject:
line in it.  The following patch should fix this, as well as a delete/backspace
bug.

*** art.c-	Wed Apr 17 20:01:51 1991
--- art.c	Fri Apr 19 14:12:06 1991
***************
*** 328,335 ****
  
  	buf[n - 1] = '\0';
  
! 	h->subject = "<no subject>";
! 	h->from = "<no from>";
  
  	p = buf;
  	while (1) {
--- 328,335 ----
  
  	buf[n - 1] = '\0';
  
! 	h->subject = "";
! 	h->from = "";
  
  	p = buf;
  	while (1) {
***************
*** 391,398 ****
  			iptr = (int *) arts[i].subject;
  			iptr--;
  
! 			if (*iptr < 0) {
  				fprintf(fp, " %s\n", arts[i].subject);
  				*iptr = realnum;
  			} else
  				fprintf(fp, "%%%d\n", *iptr);
--- 391,400 ----
  			iptr = (int *) arts[i].subject;
  			iptr--;
  
! 			if (arts[i].subject[0] == '\0')
  				fprintf(fp, " %s\n", arts[i].subject);
+ 			else if (*iptr < 0) {
+ 				fprintf(fp, " %s\n", arts[i].subject);
  				*iptr = realnum;
  			} else
  				fprintf(fp, "%%%d\n", *iptr);
***************
*** 400,406 ****
  			iptr = (int *) arts[i].from;
  			iptr--;
  
! 			if (*iptr < 0) {
  				fprintf(fp, " %s\n", arts[i].from);
  				*iptr = realnum;
  			} else
--- 402,410 ----
  			iptr = (int *) arts[i].from;
  			iptr--;
  
! 			if (arts[i].from[0] == '\0')
! 				fprintf(fp, " %s\n", arts[i].from);
! 			else if (*iptr < 0) {
  				fprintf(fp, " %s\n", arts[i].from);
  				*iptr = realnum;
  			} else
*** prompt.c-	Wed Apr 17 20:01:58 1991
--- prompt.c	Fri Apr 19 10:00:02 1991
***************
*** 26,36 ****
  	len = 1;
  	ch = ReadCh();
  	while (ch != '\n'&& ch != '\r') {
! 		if (ch >= '0' && ch <= '9' && len < 4) {
! 			buf[len++] = ch;
! 			buf[len] = '\0';
! 			putchar(ch);
! 		} else if (ch == 8 || ch == 127) {
  			if (len) {
  				len--;
  				buf[len] = '\0';
--- 26,32 ----
  	len = 1;
  	ch = ReadCh();
  	while (ch != '\n'&& ch != '\r') {
! 		if (ch == 8 || ch == 127) {
  			if (len) {
  				len--;
  				buf[len] = '\0';
***************
*** 50,55 ****
--- 46,55 ----
  			}
  			buf[0] = '\0';
  			len = 0;
+ 		} else if (ch >= '0' && ch <= '9' && len < 4) {
+ 			buf[len++] = ch;
+ 			buf[len] = '\0';
+ 			putchar(ch);
  		} else
  			putchar(7);
  		fflush(stdout);
***************
*** 89,99 ****
  	len = 0;
  	ch = ReadCh();
  	while (ch != '\n' && ch != '\r') {
! 		if (ch >= ' ' && len < 60) {
! 			buf[len++] = ch;
! 			buf[len] = '\0';
! 			putchar(ch);
! 		} else if (ch == 8 || ch == 127) {
  			if (len) {
  				len--;
  				buf[len] = '\0';
--- 89,95 ----
  	len = 0;
  	ch = ReadCh();
  	while (ch != '\n' && ch != '\r') {
! 		if (ch == 8 || ch == 127) {
  			if (len) {
  				len--;
  				buf[len] = '\0';
***************
*** 113,118 ****
--- 109,118 ----
  			}
  			buf[0] = '\0';
  			len = 0;
+ 		} else if (ch >= ' ' && len < 60) {
+ 			buf[len++] = ch;
+ 			buf[len] = '\0';
+ 			putchar(ch);
  		} else
  			putchar(7);
  		fflush(stdout);

--
skrenta@blekko.commodore.com