[comp.sources.bugs] tcsh

aeusesef@csun.UUCP (sean fagan) (11/12/87)

A problem with tcsh that I just noticed (due to several factors) is that I
can't keep `stty -tabs.'  While I realize that this is covered in the
documentation, I still don't like it.  Has anyone come up with any patches
to fix this?
Also, could someone send me the other patches that have been posted (if any;
I seem to remember them, but managed to miss them).
Thank you for your support.
Sean.

 -----

 Sean Eric Fagan          Office of Computing/Communications Resources
 (213) 852 5742           Suite 2600
 1GTLSEF@CALSTATE.BITNET  5670 Wilshire Boulevard
                          Los Angeles, CA 90036
{litvax, rdlvax, psivax, hplabs, ihnp4}!csun!aeusesef

paul@tut.UUCP (11/21/87)

(speaking of allways having bugs... 8-)

In article <891@csun.UUCP> aeusesef@csun.UUCP (sean fagan) writes:
< A problem with tcsh that I just noticed (due to several factors) is that I
< can't keep `stty -tabs.' ... Has anyone come up with any patches
< to fix this?

Actually, that really is a bug.  I didn't notice it until I logged
into our Pyramid on a really horrible terminal known as a Teleray
1061, which had a screwed up termcap.  The following diff contains a
few bugfixes to the original ed.init.c, including -tabs...

		 -- Paul Placeway
		    ...!cbosgd!osu-cis!tut!paul
		    paul@ohio-state.arpa, paul@cis.ohio-state.edu

*** ed.init.c.post	Fri Nov 20 17:29:45 1987
--- ed.init.c	Tue Nov 10 23:24:45 1987
***************
*** 37,42
  ed_Init()
  {
      static int havesetup = 0;
      ResetInLine();		/* reset the input pointers */
      LastKill = KillBuf;		/* no kill buffer */
  

--- 37,46 -----
  ed_Init()
  {
      static int havesetup = 0;
+ #ifdef sun
+     int ldisc = NTTYDISC;
+ #endif
+ 
      ResetInLine();		/* reset the input pointers */
      LastKill = KillBuf;		/* no kill buffer */
  
***************
*** 90,95
  #  endif
  # endif OREO
  #else SVID
  	ioctl(SHIN, TIOCGETP, &nb);	/* normal setup */
  	xb = nb;			/* new setup */
  	ioctl(SHIN, TIOCGETC, &ntc);

--- 94,103 -----
  #  endif
  # endif OREO
  #else SVID
+ # ifdef sun
+ 	ioctl(SHIN, TIOCSETD, &ldisc); /* try this to see if it helps */
+ # endif /* sun */
+ 
  	ioctl(SHIN, TIOCGETP, &nb);	/* normal setup */
  	xb = nb;			/* new setup */
  	ioctl(SHIN, TIOCGETC, &ntc);
***************
*** 190,196
      }
  
      xb.sg_erase = '\177';	/* del prev. char == DEL */
!     xb.sg_kill = CTRL(w);	/* special case of del region */
  
      xtc.t_intrc = CTRL(c);	/* SIGINTR */
      xtc.t_quitc = CTRL(\\);	/* SIGQUIT */

--- 198,205 -----
      }
  
      xb.sg_erase = '\177';	/* del prev. char == DEL */
!     xb.sg_kill = CTRL(u);	/* special case of del region */
! 				/* bugfix by Michael Boom */
  
      xtc.t_intrc = CTRL(c);	/* SIGINTR */
      xtc.t_quitc = CTRL(\\);	/* SIGQUIT */
***************
*** 199,205
      xtc.t_eofc = -1;		/* no eof char during input... */
      xtc.t_brkc = -1;		/* input delimiter (like nl) */
      
!     xlc.t_suspc = CTRL(z);	/* stop process signal	*/
      xlc.t_dsuspc = -1;		/* delayed stop process signal	*/
      xlc.t_rprntc = -1;		/* reprint line */
      xlc.t_flushc = CTRL(o);	/* flush output */

--- 208,214 -----
      xtc.t_eofc = -1;		/* no eof char during input... */
      xtc.t_brkc = -1;		/* input delimiter (like nl) */
      
!     xlc.t_suspc = -1;		/* stop process signal (was CTRL(z)) */
      xlc.t_dsuspc = -1;		/* delayed stop process signal	*/
      xlc.t_rprntc = -1;		/* reprint line */
      xlc.t_flushc = CTRL(o);	/* flush output */
***************
*** 268,275
  
      /* get and set the new local chars */
      ioctl (SHIN, TIOCGLTC, &testlc);
!     if (setkey(&testlc.t_suspc, &nlc.t_suspc))
! 	xlc.t_suspc = nlc.t_suspc;
      setkey (&testlc.t_dsuspc, &nlc.t_dsuspc);
      setkey (&testlc.t_rprntc, &nlc.t_rprntc);
      if (setkey(&testlc.t_flushc, &nlc.t_flushc))

--- 277,287 -----
  
      /* get and set the new local chars */
      ioctl (SHIN, TIOCGLTC, &testlc);
! 
!     setkey(&testlc.t_suspc, &nlc.t_suspc);
! 
! /*  if (setkey(&testlc.t_suspc, &nlc.t_suspc))
! 	xlc.t_suspc = nlc.t_suspc; */
      setkey (&testlc.t_dsuspc, &nlc.t_dsuspc);
      setkey (&testlc.t_rprntc, &nlc.t_rprntc);
      if (setkey(&testlc.t_flushc, &nlc.t_flushc))
***************
*** 297,302
  	(testsgb.sg_flags != xb.sg_flags)) {
  
  	nb.sg_flags = testsgb.sg_flags;
  	if (T_Tabs) {		/* order of &= and |= is important to XTABS */
  	    nb.sg_flags &= ~(CBREAK | RAW | LCASE | XTABS | VTDELAY | ALLDELAY);
  	    nb.sg_flags |= (ECHO | CRMOD | ANYP);

--- 309,323 -----
  	(testsgb.sg_flags != xb.sg_flags)) {
  
  	nb.sg_flags = testsgb.sg_flags;
+ 
+ 	/* re-test for some things here (like maybe the user typed 
+ 	   "stty -tabs" */
+ 	if ((nb.sg_flags & XTABS) == XTABS) { /* check for no tabs mode */
+ 	    T_Tabs = 0;
+ 	} else {
+ 	    T_Tabs = 1;
+ 	}
+ 
  	if (T_Tabs) {		/* order of &= and |= is important to XTABS */
  	    nb.sg_flags &= ~(CBREAK | RAW | LCASE | XTABS | VTDELAY | ALLDELAY);
  	    nb.sg_flags |= (ECHO | CRMOD | ANYP);
***************
*** 333,339
      ioctl(SHIN, TIOCLGET, &testnlb);
      if ((testnlb != nlb) && (testnlb != xlb)) {
  	nlb = testnlb;
! 	nlb &= ~(LPRTERA | LLITOUT | LPASS8);
  	nlb |= (LCRTBS | LCRTERA | LCRTKIL);
  
  	xlb = testnlb;

--- 354,367 -----
      ioctl(SHIN, TIOCLGET, &testnlb);
      if ((testnlb != nlb) && (testnlb != xlb)) {
  	nlb = testnlb;
! /*
!  * Bugfix: turn off output flushing.  By:
!  * Justin Bur
!  * Universite de Montreal - IRO		uunet!utai!musocs!iros1!justin
!  * Montreal (Qc) Canada H3C 3J7		  <bur%iro.udem.cdn@ubc.csnet>
!  * Thanks!
!  */
! 	nlb &= ~(LPRTERA | LLITOUT | LPASS8 | LFLUSHO);
  	nlb |= (LCRTBS | LCRTERA | LCRTKIL);
  
  	xlb = testnlb;
***************
*** 338,344
  
  	xlb = testnlb;
  
! 	xlb &= ~(LPRTERA | LLITOUT);
  	xlb |= (LCRTBS | LCRTERA | LCRTKIL | LPASS8);
      }
  

--- 366,375 -----
  
  	xlb = testnlb;
  
! 	/* Fix for terminals WITH parity by: */
! 	/* "Hans J. Albertsson EIV" <erisun!hans@uunet.uu.net> */
! 	if ( T_HasMeta ) {
! 	    xlb &= ~(LPRTERA | LLITOUT | LFLUSHO);
  	    xlb |= (LCRTBS | LCRTERA | LCRTKIL | LPASS8);
  	} else {
  	    xlb &= ~( LPRTERA | LLITOUT | LPASS8 | LFLUSHO);
***************
*** 340,345
  
  	xlb &= ~(LPRTERA | LLITOUT);
  	xlb |= (LCRTBS | LCRTERA | LCRTKIL | LPASS8);
      }
  
      /* get and set the new local chars */

--- 371,379 -----
  	if ( T_HasMeta ) {
  	    xlb &= ~(LPRTERA | LLITOUT | LFLUSHO);
  	    xlb |= (LCRTBS | LCRTERA | LCRTKIL | LPASS8);
+ 	} else {
+ 	    xlb &= ~( LPRTERA | LLITOUT | LPASS8 | LFLUSHO);
+ 	    xlb |=  ( LCRTBS | LCRTERA | LCRTKIL );
  	}
      }
  
***************
*** 341,346
  	xlb &= ~(LPRTERA | LLITOUT);
  	xlb |= (LCRTBS | LCRTERA | LCRTKIL | LPASS8);
      }
  
      /* get and set the new local chars */
      ioctl (SHIN, TIOCGLTC, &testlc);

--- 375,381 -----
  	    xlb &= ~( LPRTERA | LLITOUT | LPASS8 | LFLUSHO);
  	    xlb |=  ( LCRTBS | LCRTERA | LCRTKIL );
  	}
+     }
  
      /* get and set the new local chars */
      ioctl (SHIN, TIOCGLTC, &testlc);
***************
*** 344,351
  
      /* get and set the new local chars */
      ioctl (SHIN, TIOCGLTC, &testlc);
!     if (setkey(&testlc.t_suspc, &nlc.t_suspc))
! 	xlc.t_suspc = nlc.t_suspc;
      setkey (&testlc.t_dsuspc, &nlc.t_dsuspc);
      setkey (&testlc.t_rprntc, &nlc.t_rprntc);
      if (setkey(&testlc.t_flushc, &nlc.t_flushc))

--- 379,389 -----
  
      /* get and set the new local chars */
      ioctl (SHIN, TIOCGLTC, &testlc);
!     setkey(&testlc.t_suspc, &nlc.t_suspc);
! 
! /*    if (setkey(&testlc.t_suspc, &nlc.t_suspc))
! 	xlc.t_suspc = nlc.t_suspc; */
! 
      setkey (&testlc.t_dsuspc, &nlc.t_dsuspc);
      setkey (&testlc.t_rprntc, &nlc.t_rprntc);
      if (setkey(&testlc.t_flushc, &nlc.t_flushc))
***************
*** 377,382
      ioctl(SHIN, TIOCSETC, &ntc);
      ioctl(SHIN, TIOCSLTC, &nlc);
      ioctl(SHIN, TIOCLSET, &nlb);
  
  /*NOSTRICT*/
      signal(SIGINT, orig_intr);		/* take these again */

--- 415,421 -----
      ioctl(SHIN, TIOCSETC, &ntc);
      ioctl(SHIN, TIOCSLTC, &nlc);
      ioctl(SHIN, TIOCLSET, &nlb);
+ #endif SVID
  
  /*NOSTRICT*/
      (void) signal(SIGINT, orig_intr); /* take these again */
***************
*** 379,386
      ioctl(SHIN, TIOCLSET, &nlb);
  
  /*NOSTRICT*/
!     signal(SIGINT, orig_intr);		/* take these again */
! #endif SVID
  }
  
  ResetInLine()

--- 418,424 -----
  #endif SVID
  
  /*NOSTRICT*/
!     (void) signal(SIGINT, orig_intr); /* take these again */
  }
  
  ResetInLine()
***************
*** 397,400
      Argument = 1;
      /* LastKill = KillBuf;		/* no kill buffer */
      LastCmd = F_UNASSIGNED;	/* previous command executed */
  }

--- 435,473 -----
      Argument = 1;
      /* LastKill = KillBuf;		/* no kill buffer */
      LastCmd = F_UNASSIGNED;	/* previous command executed */
+ }
+ 
+ /*
+  * Bugfix (in Swedish) by:
+  * Johan Widen
+  * SICS, PO Box 1263, S-163 13 SPANGA, SWEDEN
+  * {mcvax,munnari,cernvax,diku,inria,prlb2,penet,ukc,unido}!enea!sics.se!jw
+  * Internet: jw@sics.se
+  *
+  * (via Hans J Albertsson (thanks))
+  */
+ 
+ int
+ QuoteModeOn()
+ {
+ #ifndef SVID
+     struct sgttyb rawb;
+ 
+     rawb = xb;
+     rawb.sg_flags &= ~(CBREAK);
+     rawb.sg_flags |= RAW;
+     if(ioctl(SHIN, TIOCSETN, &rawb) < 0)
+ 	return -1;
+ #endif
+     return 0;
+ }
+ 
+ int
+ QuoteModeOff()
+ {
+ #ifndef SVID
+     if(ioctl(SHIN, TIOCSETN, &xb) < 0)
+ 	return -1;
+ #endif
+     return 0;
  }

lew@gsg.UUCP (Paul Lew) (01/14/88)

I dont know if anyone see/solve this problem but it broke my script which
was working under csh.

	--- tcsh ---			-- csh --

	1  > echo '\'			% echo '\'
	   Unmatched '.			\
	2  > echo '\\'			% echo '\\'
	   Unmatched '.			\\
	3  > echo '\A'			% echo '\A'
	   \A				\A
	4  > echo "\"			% echo "\"
	   Unmatched ".			\
	5  > echo "\\"			% echo "\\"
	   Unmatched ".			\\
	6  > echo \\			$ echo \\
	   \				\

Besides the above annoyance, if you type CTRL P to go up a line, for case
1, 2, 4, 5, the number of backslashes will be one less than what you typed.
Is this a bug?   It failed on both VAX-750 Unix 4.3 and Pyramid OSx 4.0.
-- 
----------------------------------------------------------------------
Paul Lew			{olivea,harvard,decvax}!gsg!lew	(UUCP)
General Systems Group, 5 Manor Parkway, Salem, NH 03079	(603) 893-1000