From: alan@ernest.dseg.ti.com (Alan Edmonds)
Subject: MicroEmacs 3.11 fixes for ISC 2.2 (and maybe others)
Organization: Texas Instruments, Inc. - Plano, Tx
Date: Tue, 29 Sep 1992 19:13:19 GMT
Keywords: emacs microemacs patches fixes


Awhile ago, Michal Szymanski requested experience getting MicroEmacs
3.11 working under Interactive 2.2.  I had just gotten 3.11 compiled, 
but I hadn't really tried it.  It turns out that there is a patch
file for 3.11 called 311c_dif.zip which patches 3.11 to 3.11c.  These
patches are REQUIRED for the ISC version and maybe any Unix version.
After installing the 311c patches, there were still some problems.
Michal came up with the following patches to 3.11c.  Number 2 was
also a problem with MicroEmacs 3.10.  

After receiving these patches from Michal, I asked if he was going 
to post them.  He cannot easily post so I volunteered to post them.

Many thanks to Michal.  

From: msz@sirius.astrouw.edu.pl (Michal Szymanski)

I have looked into the code and made some minor changes:

1. I have inserted disabling of the START/STOP characters recognition in
the unix.c file which ends problems with Ctrl-S

2. I have fixed a minor bug in file.c, which led to a change of
attributes (and sometimes ownership) of the file - after editing a file
got "-rw-r--r--" attributes, no matter what were the original ones.

3. One more thing I consider a *bug* (though it may be a *feature*):
The original version (in fileio.c) removes all the CR chars preceding the
NL at the end of line. It is done while reading the file. So if somebody 
uses VPIX, or DOS files and tries to edit these files under the unix, the
result is as if "dos2unix" was run on the file. 

Below, you'll find the output of diff command run on these three pairs of
files. 

regards, Michal.

=============================================================================

*** unix.c.orig	Tue Sep 22 14:14:25 1992
--- unix.c	Tue Sep 22 14:14:23 1992
***************
*** 372,378 ****
  	curterm = oldterm;
  
  	/* Set new modes */
! 	curterm.c_iflag &= ~(INLCR|ICRNL|IGNCR);
  	curterm.c_lflag &= ~(ICANON|ISIG|ECHO);
  	curterm.c_cc[VMIN] = 1;
  	curterm.c_cc[VTIME] = 0;
--- 372,378 ----
  	curterm = oldterm;
  
  	/* Set new modes */
! 	curterm.c_iflag &= ~(INLCR|ICRNL|IGNCR|IXON);
  	curterm.c_lflag &= ~(ICANON|ISIG|ECHO);
  	curterm.c_cc[VMIN] = 1;
  	curterm.c_cc[VTIME] = 0;
*** file.c.orig	Tue Sep 22 15:42:03 1992
--- file.c	Tue Sep 22 15:30:26 1992
***************
*** 11,17 ****
  #include	"eproto.h"
  #include	"edef.h"
  #include	"elang.h"
! #if	BSD | SUN | V7
  #include	<sys/types.h>
  #include	<sys/stat.h>
  #endif
--- 11,17 ----
  #include	"eproto.h"
  #include	"edef.h"
  #include	"elang.h"
! #if	BSD | SUN | V7 | USG
  #include	<sys/types.h>
  #include	<sys/stat.h>
  #endif
***************
*** 568,574 ****
  	int sflag;		/* are we safe saving? */
  	char tname[NSTRING];	/* temporary file name */
  	char buf[NSTRING];	/* message buffer */
! #if	BSD | SUN | V7 | XENIX
  	struct stat st;		/* we need info about the file permisions */
  #endif
  
--- 568,574 ----
  	int sflag;		/* are we safe saving? */
  	char tname[NSTRING];	/* temporary file name */
  	char buf[NSTRING];	/* message buffer */
! #if	BSD | SUN | V7 | XENIX | USG
  	struct stat st;		/* we need info about the file permisions */
  #endif
  
***************
*** 648,654 ****
  			strcat(buf, "s");
  
  		if (sflag) {
! #if	BSD | SUN | V7 | XENIX
  			/* get the permisions on the original file */
  			stat(fn, &st);
  #endif
--- 648,654 ----
  			strcat(buf, "s");
  
  		if (sflag) {
! #if	BSD | SUN | V7 | XENIX | USG
  			/* get the permisions on the original file */
  			stat(fn, &st);
  #endif
***************
*** 655,663 ****
  			/* erase original file */
  			/* rename temporary file to original name */
  			if (unlink(fn) == 0 && rename(tname, fn) == 0) {
! #if	BSD | SUN | V7 | XENIX
  #if	!(PC_BSD)
! 				chmod(fn, (int)st.st_uid, (int)st.st_gid);
  #endif /* !(PC_BSD) */
  				chmod(fn, (int)st.st_mode);
  #else
--- 655,663 ----
  			/* erase original file */
  			/* rename temporary file to original name */
  			if (unlink(fn) == 0 && rename(tname, fn) == 0) {
! #if	BSD | SUN | V7 | XENIX | USG
  #if	!(PC_BSD)
! 				chown(fn, (int)st.st_uid, (int)st.st_gid);
  #endif /* !(PC_BSD) */
  				chmod(fn, (int)st.st_mode);
  #else

*** fileio.c.orig	Wed Sep 23 13:43:24 1992
--- fileio.c	Wed Sep 23 13:43:24 1992
***************
*** 182,188 ****
          }
  
  	/* dump any extra line terminators at the end */
! 	while (i > 0 && (fline[i-1] == 10 || fline[i-1] == 13))
  		i--;
  
  	/* we should be ready to dump leading terminators too - ADD THIS DAN */
--- 182,188 ----
          }
  
  	/* dump any extra line terminators at the end */
! 	while (i > 0 && (fline[i-1] == 10))
  		i--;
  
  	/* we should be ready to dump leading terminators too - ADD THIS DAN */

-- 
Alan Edmonds                                     Texas Instruments, Inc.
I don't speak for TI; TI doesn't speak for me    M/S 8513
Work phone: (214)575-6427                        6620 Chase Oaks Blvd.
Email: alan@ernest.dseg.ti.com                   Plano, Texas  75023
Newsgroups: comp.unix.sysv386