Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!osu-cis!tut!paul From: paul@tut.UUCP Newsgroups: comp.sources.bugs Subject: Re: tcsh (4.2) bug (sort of) Message-ID: <2035@tut.cis.ohio-state.edu> Date: Fri, 20-Nov-87 17:36:34 EST Article-I.D.: tut.2035 Posted: Fri Nov 20 17:36:34 1987 Date-Received: Sun, 22-Nov-87 07:20:36 EST References: <891@csun.UUCP> Organization: The Ohio State University Dept of Computer and Information Science Lines: 331 Keywords: tcsh stty -tabs yech! (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! * 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" */ ! 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; }