[17538] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: exmh bug

daemon@ATHENA.MIT.EDU (Greg Hudson)
Sat Feb 12 11:55:14 2000

Message-Id: <200002121655.LAA13773@small-gods.mit.edu>
To: "Jacob Morzinski" <jmorzins@MIT.EDU>
Cc: bugs@MIT.EDU, source-reviewers@MIT.EDU
In-Reply-To: Your message of "Sat, 12 Feb 2000 04:52:11 EST."
             <200002120952.EAA19558@quiche-lorraine.mit.edu> 
Date: Sat, 12 Feb 2000 11:55:09 -0500
From: Greg Hudson <ghudson@MIT.EDU>

[cc'd source-reviewers]

Your patch (copied below) seems reasonable, except that it should back
up sp in the final (! *sp) case or lp will get advanced past the
zero-terminator.  I'll fix that and take the patch.

*** fmt_scan.c.orig	Sun Feb  7 13:14:08 1999
--- fmt_scan.c	Sat Feb 12 04:41:54 2000
***************
*** 729,735 ****
  		*cp++ = c;
  	    while (len > wid) {
  		/* try to break at a comma; failing that, break at a
! 		 * space, failing that, just split the line.
  		 */
  		lastb = 0; sp = lp + wid;
  		while (sp > lp && (c = *--sp) != ',') {
--- 729,735 ----
  		*cp++ = c;
  	    while (len > wid) {
  		/* try to break at a comma; failing that, break at a
! 		 * space, failing that, print the whole address
  		 */
  		lastb = 0; sp = lp + wid;
  		while (sp > lp && (c = *--sp) != ',') {
***************
*** 737,744 ****
  			lastb = sp - 1;
  		}
  		if (sp == lp)
! 		    if (! (sp = lastb))
! 			sp = lp + wid - 1;
  		len -= sp - lp + 1;
  		while (cp < ep && lp <= sp)
  		    *cp++ = *lp++;
--- 737,755 ----
  			lastb = sp - 1;
  		}
  		if (sp == lp)
! 		    if (! (sp = lastb)) {	/* If no ',' or ' ', */
! 			lastb = 0; sp = lp + wid - 1;
! 			while (c = *++sp) {	/* then search forward. */
! 			    if (c == ',')
! 				break;
! 			    if (isspace(c)) {
! 				--sp;
! 				break;
! 			    }
! 			}
! 			if (! *sp)	/* If we didn't find comma or space */
! 			  break;	/* then PUTS the whole str now */
! 		    }
  		len -= sp - lp + 1;
  		while (cp < ep && lp <= sp)
  		    *cp++ = *lp++;



home help back first fref pref prev next nref lref last post