[comp.mail.elm] Bugfix for ELM

daemon@hplabsc.UUCP (05/08/87)

There is a bug in the new patched elm in the file  input_utils.c
The cause stems from use of the tolower macro in want_to.  Certain
brain damaged implementations of ctype.h  define tolower as a macro
that must *only* be called with upper case letters.  BSD 4.2 is one  of
them.  Here is how  I fixed it:
21,33d20
< /*
< 	Make up for  Brain Damaged BSD tolower macro
< */
< 
< Tolower(c)
< {
< 	if (isupper(c)) {
< 		return tolower(c);
< 	} else {
< 		return c;
< 	}
< }
< 
46,47d32
< dprint(1, (debugfile, "\nwant-to:  default='%c', echo=%d\n",dflt,echo_answer));
< 
53c38
< 	ch = Tolower(ReadCh());
---
> 	ch = tolower(ReadCh());
59,62d43
< 
< dprint(1, (debugfile, "\nwant-to:  answer was '%c' (%x)\n", ch, ch));
< dprint(1, (debugfile,  "want-to:  returning '%c'\n", ch == '\n' || ch == '\r' ? dflt : ch));
< 


You don't need the dprint lines,  I just stuck them in  while  trying  to
figure out how unmodified, once-working  code had suddenly broken.

Hope this helps someone.
	Steve
-- 
	-Steve Baur
{ihnp4,decvax,ucbvax,hplabs}!trwrb!trwspp!spp3!baur
People without college degrees are people too.

daemon@hplabsc.UUCP (06/06/87)

The following fixes two bugs in ELM 1.5:

	1. ~r command in the Berkely emulation (editor=none) includes
	    the wrong message if message ordering on display is different
	    from order in mailbox. (editmsg.c)

	2.  Even if USE_EMBEDDED_ADDRESS is defined, the address in the 
	    From: line is not used if ELM thinks the >From line is valid.
	    (return_addr.c)

The diffs are to 1.5 (I found 1.5b to be considerably slower and these
problems exist there too).


*** editmsg.ol
--- editmsg.c
***************
*** 376,377
  	register int lines = 0, add_prefix=0;
  

--- 376,378 -----
  	register int lines = 0, add_prefix=0;
+ 	int	mindex;
  
***************
*** 379,381
  
! 	sprintf(local_buffer, "%s %s", readmsg, ++buffer);
  

--- 380,383 -----
  
! 	mindex = atoi(++buffer);
! 	sprintf(local_buffer, "%s %d", readmsg, header_table[mindex-1].index_number);
  
*** return_addr.ol
--- return_addr.c
***************
*** 262,263
  	get_address_from("From:", buf, hold_return);
        }

--- 262,264 -----
  	get_address_from("From:", buf, hold_return);
+ 	buffer[0] = '\0';		/* Embedded address to overwrite */
        }