1 /* $Header: /src/pub/tcsh/ed.init.c,v 3.48 2002/07/06 22:28:13 christos Exp $ */
3 * ed.init.c: Editor initializations
6 * Copyright (c) 1980, 1991 The Regents of the University of California.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTS_ION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 RCSID("$Id: ed.init.c,v 3.48 2002/07/06 22:28:13 christos Exp $")
41 /* ed.init.c -- init routines for the line editor */
42 /* #define DEBUG_TTY */
44 int Tty_raw_mode = 0; /* Last tty change was to raw mode */
45 int MacroLvl = -1; /* pointer to current macro nesting level; */
47 static int Tty_quote_mode = 0; /* Last tty change was to quote mode */
48 static unsigned char vdisable; /* The value of _POSIX_VDISABLE from
51 int Tty_eight_bit = -1; /* does the tty handle eight bits */
53 extern bool GotTermCaps;
55 static ttydata_t extty, edtty, tstty;
59 #define SHTTY (insource ? OLDSTD : SHIN)
61 #define uc unsigned char
62 static unsigned char ttychars[NN_IO][C_NCC] = {
64 (uc)CINTR, (uc)CQUIT, (uc)CERASE, (uc)CKILL,
65 (uc)CEOF, (uc)CEOL, (uc)CEOL2, (uc)CSWTCH,
66 (uc)CDSWTCH, (uc)CERASE2, (uc)CSTART, (uc)CSTOP,
67 (uc)CWERASE, (uc)CSUSP, (uc)CDSUSP, (uc)CREPRINT,
68 (uc)CDISCARD, (uc)CLNEXT, (uc)CSTATUS, (uc)CPAGE,
69 (uc)CPGOFF, (uc)CKILL2, (uc)CBRK, (uc)CMIN,
73 CINTR, CQUIT, CERASE, CKILL,
74 _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
75 _POSIX_VDISABLE, CERASE2, CSTART, CSTOP,
76 _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
77 CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
78 _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1,
94 check_window_size(force)
102 /* don't want to confuse things here */
104 omask = sigblock(sigmask(SIG_WINDOW)) & ~sigmask(SIG_WINDOW);
106 (void) sighold(SIG_WINDOW);
109 * From: bret@shark.agps.lanl.gov (Bret Thaeler) Avoid sunview bug, where a
110 * partially hidden window gets a SIG_WINDOW every time the text is
113 if (GetSize(&lins, &cols) || force) {
119 ChangeSize(lins, cols);
123 ChangeSize(lins, cols);
126 (void) sigsetmask(omask); /* can change it again */
128 (void) sigrelse(SIG_WINDOW);
139 /* If we were called as a signal handler, restore it. */
141 sigset(snum, window_change);
142 #endif /* UNRELSIGS */
149 #endif /* SIG_WINDOW */
152 ed_set_tty_eight_bit()
154 if (tty_getty(SHTTY, &extty) == -1) {
156 xprintf("ed_set_tty_eight_bit: tty_getty: %s\n", strerror(errno));
157 #endif /* DEBUG_TTY */
160 Tty_eight_bit = tty_geteightbit(&extty);
168 static int havesetup = 0;
169 struct varent *imode;
171 if (havesetup) /* if we have never been called */
174 #if defined(POSIX) && defined(_PC_VDISABLE) && !defined(BSD4_4) && \
175 !defined(WINNT_NATIVE)
179 if ((pcret = fpathconf(SHTTY, _PC_VDISABLE)) == -1L)
180 vdisable = (unsigned char) _POSIX_VDISABLE;
182 vdisable = (unsigned char) pcret;
183 if (vdisable != (unsigned char) _POSIX_VDISABLE && rst != 0)
184 for (rst = 0; rst < C_NCC; rst++) {
185 if (ttychars[ED_IO][rst] == (unsigned char) _POSIX_VDISABLE)
186 ttychars[ED_IO][rst] = vdisable;
187 if (ttychars[EX_IO][rst] == (unsigned char) _POSIX_VDISABLE)
188 ttychars[EX_IO][rst] = vdisable;
191 #else /* ! POSIX || !_PC_VDISABLE || BSD4_4 || WINNT_NATIVE */
192 vdisable = (unsigned char) _POSIX_VDISABLE;
193 #endif /* POSIX && _PC_VDISABLE && !BSD4_4 && !WINNT_NATIVE */
195 if ((imode = adrof(STRinputmode)) != NULL && imode->vec != NULL) {
196 if (!Strcmp(*(imode->vec), STRinsert))
197 inputmode = MODE_INSERT;
198 else if (!Strcmp(*(imode->vec), STRoverwrite))
199 inputmode = MODE_REPLACE;
202 inputmode = MODE_INSERT;
206 SetKillRing(getn(varval(STRkillring)));
209 if (tty_getty(SHTTY, &extty) == -1) {
211 xprintf("ed_Setup: tty_getty: %s\n", strerror(errno));
212 # endif /* DEBUG_TTY */
216 tstty = edtty = extty;
218 T_Speed = tty_getspeed(&extty);
219 T_Tabs = tty_gettabs(&extty);
220 Tty_eight_bit = tty_geteightbit(&extty);
222 # if defined(POSIX) || defined(TERMIO)
223 extty.d_t.c_iflag &= ~ttylist[EX_IO][M_INPUT].t_clrmask;
224 extty.d_t.c_iflag |= ttylist[EX_IO][M_INPUT].t_setmask;
226 extty.d_t.c_oflag &= ~ttylist[EX_IO][M_OUTPUT].t_clrmask;
227 extty.d_t.c_oflag |= ttylist[EX_IO][M_OUTPUT].t_setmask;
229 extty.d_t.c_cflag &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
230 extty.d_t.c_cflag |= ttylist[EX_IO][M_CONTROL].t_setmask;
232 extty.d_t.c_lflag &= ~ttylist[EX_IO][M_LINED].t_clrmask;
233 extty.d_t.c_lflag |= ttylist[EX_IO][M_LINED].t_setmask;
235 # if defined(IRIX3_3) && SYSVREL < 4
236 extty.d_t.c_line = NTTYDISC;
237 # endif /* IRIX3_3 && SYSVREL < 4 */
239 # else /* GSTTY */ /* V7, Berkeley style tty */
241 if (T_Tabs) { /* order of &= and |= is important to XTABS */
242 extty.d_t.sg_flags &= ~(ttylist[EX_IO][M_CONTROL].t_clrmask|XTABS);
243 extty.d_t.sg_flags |= ttylist[EX_IO][M_CONTROL].t_setmask;
246 extty.d_t.sg_flags &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
247 extty.d_t.sg_flags |= (ttylist[EX_IO][M_CONTROL].t_setmask|XTABS);
250 extty.d_lb &= ~ttylist[EX_IO][M_LOCAL].t_clrmask;
251 extty.d_lb |= ttylist[EX_IO][M_LOCAL].t_setmask;
255 * Reset the tty chars to reasonable defaults
256 * If they are disabled, then enable them.
259 if (tty_cooked_mode(&tstty)) {
260 tty_getchar(&tstty, ttychars[TS_IO]);
262 * Don't affect CMIN and CTIME for the editor mode
264 for (rst = 0; rst < C_NCC - 2; rst++)
265 if (ttychars[TS_IO][rst] != vdisable &&
266 ttychars[ED_IO][rst] != vdisable)
267 ttychars[ED_IO][rst] = ttychars[TS_IO][rst];
268 for (rst = 0; rst < C_NCC; rst++)
269 if (ttychars[TS_IO][rst] != vdisable &&
270 ttychars[EX_IO][rst] != vdisable)
271 ttychars[EX_IO][rst] = ttychars[TS_IO][rst];
273 tty_setchar(&extty, ttychars[EX_IO]);
274 if (tty_setty(SHTTY, &extty) == -1) {
276 xprintf("ed_Setup: tty_setty: %s\n", strerror(errno));
277 # endif /* DEBUG_TTY */
282 tty_setchar(&extty, ttychars[EX_IO]);
285 (void) sigset(SIG_WINDOW, window_change); /* for window systems */
287 #else /* WINNT_NATIVE */
290 xprintf("rst received in ed_Setup() %d\n", rst);
292 #endif /* WINNT_NATIVE */
300 ResetInLine(1); /* reset the input pointers */
301 GettingInput = 0; /* just in case */
303 /* XXX This code was here before the kill ring:
304 LastKill = KillBuf; / * no kill buffer * /
305 If there was any reason for that other than to make sure LastKill
306 was initialized, the code below should go in here instead - but
307 it doesn't seem reasonable to lose the entire kill ring (which is
308 "self-initializing") just because you set $term or whatever, so
309 presumably this whole '#ifdef notdef' should just be taken out. */
311 { /* no kill ring - why? */
313 for (i = 0; i < KillRingMax; i++) {
314 if (KillRing[i].buf != NULL)
315 xfree((ptr_t) KillRing[i].buf);
316 KillRing[i].buf = NULL;
319 YankPos = KillPos = 0;
325 CheckMaps(); /* do a little error checking on key maps */
328 if (ed_Setup(0) == -1)
332 * if we have been called before but GotTermCaps isn't set, our TERM has
333 * changed, so get new termcaps and try again
337 GetTermCaps(); /* does the obvious, but gets term type each
341 # if defined(TERMIO) || defined(POSIX)
342 edtty.d_t.c_iflag &= ~ttylist[ED_IO][M_INPUT].t_clrmask;
343 edtty.d_t.c_iflag |= ttylist[ED_IO][M_INPUT].t_setmask;
345 edtty.d_t.c_oflag &= ~ttylist[ED_IO][M_OUTPUT].t_clrmask;
346 edtty.d_t.c_oflag |= ttylist[ED_IO][M_OUTPUT].t_setmask;
348 edtty.d_t.c_cflag &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
349 edtty.d_t.c_cflag |= ttylist[ED_IO][M_CONTROL].t_setmask;
351 edtty.d_t.c_lflag &= ~ttylist[ED_IO][M_LINED].t_clrmask;
352 edtty.d_t.c_lflag |= ttylist[ED_IO][M_LINED].t_setmask;
355 # if defined(IRIX3_3) && SYSVREL < 4
356 edtty.d_t.c_line = NTTYDISC;
357 # endif /* IRIX3_3 && SYSVREL < 4 */
361 if (T_Tabs) { /* order of &= and |= is important to XTABS */
362 edtty.d_t.sg_flags &= ~(ttylist[ED_IO][M_CONTROL].t_clrmask | XTABS);
363 edtty.d_t.sg_flags |= ttylist[ED_IO][M_CONTROL].t_setmask;
366 edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
367 edtty.d_t.sg_flags |= (ttylist[ED_IO][M_CONTROL].t_setmask | XTABS);
370 edtty.d_lb &= ~ttylist[ED_IO][M_LOCAL].t_clrmask;
371 edtty.d_lb |= ttylist[ED_IO][M_LOCAL].t_setmask;
372 # endif /* POSIX || TERMIO */
374 tty_setchar(&edtty, ttychars[ED_IO]);
375 #endif /* WINNT_NATIVE */
379 * Check and re-init the line. set the terminal into 1 char at a time mode.
389 #else /* !WINNT_NATIVE */
391 tty_setdisc(SHTTY, ED_IO);
394 if (tty_getty(SHTTY, &tstty) == -1) {
396 xprintf("Rawmode: tty_getty: %s\n", strerror(errno));
397 # endif /* DEBUG_TTY */
402 * We always keep up with the eight bit setting and the speed of the
403 * tty. But only we only believe changes that are made to cooked mode!
405 # if defined(POSIX) || defined(TERMIO)
406 Tty_eight_bit = tty_geteightbit(&tstty);
407 T_Speed = tty_getspeed(&tstty);
411 * Fix from: Steven (Steve) B. Green <xrsbg@charney.gsfc.nasa.gov>
412 * Speed was not being set up correctly under POSIX.
414 if (tty_getspeed(&extty) != T_Speed || tty_getspeed(&edtty) != T_Speed) {
415 (void) cfsetispeed(&extty.d_t, T_Speed);
416 (void) cfsetospeed(&extty.d_t, T_Speed);
417 (void) cfsetispeed(&edtty.d_t, T_Speed);
418 (void) cfsetospeed(&edtty.d_t, T_Speed);
423 T_Speed = tty_getspeed(&tstty);
424 Tty_eight_bit = tty_geteightbit(&tstty);
426 if (extty.d_t.sg_ispeed != tstty.d_t.sg_ispeed) {
427 extty.d_t.sg_ispeed = tstty.d_t.sg_ispeed;
428 edtty.d_t.sg_ispeed = tstty.d_t.sg_ispeed;
431 if (extty.d_t.sg_ospeed != tstty.d_t.sg_ospeed) {
432 extty.d_t.sg_ospeed = tstty.d_t.sg_ospeed;
433 edtty.d_t.sg_ospeed = tstty.d_t.sg_ospeed;
435 # endif /* POSIX || TERMIO */
437 if (tty_cooked_mode(&tstty)) {
439 * re-test for some things here (like maybe the user typed
442 if (tty_gettabs(&tstty) == 0)
447 # if defined(POSIX) || defined(TERMIO)
448 extty.d_t.c_cflag = tstty.d_t.c_cflag;
449 extty.d_t.c_cflag &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
450 extty.d_t.c_cflag |= ttylist[EX_IO][M_CONTROL].t_setmask;
452 edtty.d_t.c_cflag = tstty.d_t.c_cflag;
453 edtty.d_t.c_cflag &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
454 edtty.d_t.c_cflag |= ttylist[ED_IO][M_CONTROL].t_setmask;
456 extty.d_t.c_lflag = tstty.d_t.c_lflag;
457 extty.d_t.c_lflag &= ~ttylist[EX_IO][M_LINED].t_clrmask;
458 extty.d_t.c_lflag |= ttylist[EX_IO][M_LINED].t_setmask;
460 edtty.d_t.c_lflag = tstty.d_t.c_lflag;
461 edtty.d_t.c_lflag &= ~ttylist[ED_IO][M_LINED].t_clrmask;
462 edtty.d_t.c_lflag |= ttylist[ED_IO][M_LINED].t_setmask;
464 extty.d_t.c_iflag = tstty.d_t.c_iflag;
465 extty.d_t.c_iflag &= ~ttylist[EX_IO][M_INPUT].t_clrmask;
466 extty.d_t.c_iflag |= ttylist[EX_IO][M_INPUT].t_setmask;
468 edtty.d_t.c_iflag = tstty.d_t.c_iflag;
469 edtty.d_t.c_iflag &= ~ttylist[ED_IO][M_INPUT].t_clrmask;
470 edtty.d_t.c_iflag |= ttylist[ED_IO][M_INPUT].t_setmask;
472 extty.d_t.c_oflag = tstty.d_t.c_oflag;
473 extty.d_t.c_oflag &= ~ttylist[EX_IO][M_OUTPUT].t_clrmask;
474 extty.d_t.c_oflag |= ttylist[EX_IO][M_OUTPUT].t_setmask;
476 edtty.d_t.c_oflag = tstty.d_t.c_oflag;
477 edtty.d_t.c_oflag &= ~ttylist[ED_IO][M_OUTPUT].t_clrmask;
478 edtty.d_t.c_oflag |= ttylist[ED_IO][M_OUTPUT].t_setmask;
482 extty.d_t.sg_flags = tstty.d_t.sg_flags;
484 extty.d_t.sg_flags &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
485 extty.d_t.sg_flags |= ttylist[EX_IO][M_CONTROL].t_setmask;
487 if (T_Tabs) /* order of &= and |= is important to XTABS */
488 extty.d_t.sg_flags &= ~XTABS;
490 extty.d_t.sg_flags |= XTABS;
492 extty.d_lb = tstty.d_lb;
493 extty.d_lb &= ~ttylist[EX_IO][M_LOCAL].t_clrmask;
494 extty.d_lb |= ttylist[EX_IO][M_LOCAL].t_setmask;
496 edtty.d_t.sg_flags = extty.d_t.sg_flags;
497 if (T_Tabs) { /* order of &= and |= is important to XTABS */
498 edtty.d_t.sg_flags &=
499 ~(ttylist[ED_IO][M_CONTROL].t_clrmask|XTABS);
500 edtty.d_t.sg_flags |= ttylist[ED_IO][M_CONTROL].t_setmask;
503 edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
504 edtty.d_t.sg_flags |=
505 (ttylist[ED_IO][M_CONTROL].t_setmask|XTABS);
508 edtty.d_lb = tstty.d_lb;
509 edtty.d_lb &= ~ttylist[ED_IO][M_LOCAL].t_clrmask;
510 edtty.d_lb |= ttylist[ED_IO][M_LOCAL].t_setmask;
512 # endif /* TERMIO || POSIX */
518 tty_getchar(&tstty, ttychars[TS_IO]);
520 * Check if the user made any changes.
521 * If he did, then propagate the changes to the
522 * edit and execute data structures.
524 for (i = 0; i < C_NCC; i++)
525 if (ttychars[TS_IO][i] != ttychars[EX_IO][i])
528 if (i != C_NCC || didsetty) {
531 * Propagate changes only to the unprotected chars
532 * that have been modified just now.
534 for (i = 0; i < C_NCC; i++) {
535 if (!((ttylist[ED_IO][M_CHAR].t_setmask & C_SH(i))) &&
536 (ttychars[TS_IO][i] != ttychars[EX_IO][i]))
537 ttychars[ED_IO][i] = ttychars[TS_IO][i];
538 if (ttylist[ED_IO][M_CHAR].t_clrmask & C_SH(i))
539 ttychars[ED_IO][i] = vdisable;
541 tty_setchar(&edtty, ttychars[ED_IO]);
543 for (i = 0; i < C_NCC; i++) {
544 if (!((ttylist[EX_IO][M_CHAR].t_setmask & C_SH(i))) &&
545 (ttychars[TS_IO][i] != ttychars[EX_IO][i]))
546 ttychars[EX_IO][i] = ttychars[TS_IO][i];
547 if (ttylist[EX_IO][M_CHAR].t_clrmask & C_SH(i))
548 ttychars[EX_IO][i] = vdisable;
550 tty_setchar(&extty, ttychars[EX_IO]);
555 if (tty_setty(SHTTY, &edtty) == -1) {
557 xprintf("Rawmode: tty_setty: %s\n", strerror(errno));
558 # endif /* DEBUG_TTY */
561 #endif /* WINNT_NATIVE */
563 flush(); /* flush any buffered output */
569 { /* set tty in normal setup */
573 signalfun_t orig_intr;
576 tty_setdisc(SHTTY, EX_IO);
582 /* hold this for reseting tty */
584 orig_intr = (signalfun_t) signal(SIGINT, SIG_IGN);
588 * sigset doesn't return the previous handler if the signal is held,
589 * it will return SIG_HOLD instead. So instead of restoring the
590 * the signal we would end up installing a blocked SIGINT with a
591 * SIG_IGN signal handler. This is what happened when Cookedmode
592 * was called from sched_run, disabling interrupt for the rest
595 * This is what we do:
596 * - if the signal is blocked, keep it that way
597 * - else set it to SIG_IGN
599 * Casper Dik (casper@fwi.uva.nl)
601 orig_intr = (signalfun_t) sigset(SIGINT, SIG_HOLD);
602 if (orig_intr != SIG_HOLD)
603 (void) sigset(SIGINT, SIG_IGN); /* returns SIG_HOLD */
604 # else /* !SIG_HOLD */
606 * No SIG_HOLD; probably no reliable signals as well.
608 orig_intr = (signalfun_t) sigset(SIGINT, SIG_IGN);
609 # endif /* SIG_HOLD */
610 # endif /* BSDSIGS */
611 if (tty_setty(SHTTY, &extty) == -1) {
613 xprintf("Cookedmode: tty_setty: %s\n", strerror(errno));
614 # endif /* DEBUG_TTY */
618 (void) signal(SIGINT, orig_intr); /* take these again */
620 (void) sigset(SIGINT, orig_intr); /* take these again */
621 # endif /* BSDSIGS */
622 #endif /* WINNT_NATIVE */
632 Cursor = InputBuf; /* reset cursor */
634 InputLim = &InputBuf[INBUFSIZE - 2];
637 CurrentKeyMap = CcKeyMap;
642 LastCmd = F_UNASSIGNED; /* previous command executed */
644 MacroLvl = -1; /* no currently active macros */
647 static Char *Input_Line = NULL;
655 * *Everyone* else has an int, but SunOS wants long!
656 * This breaks where int != long (alpha)
662 xfree((ptr_t) Input_Line);
668 #if defined(FIONREAD) && !defined(OREO)
669 (void) ioctl(SHIN, FIONREAD, (ioctl_t) &chrs);
673 chrs = read(SHIN, buf, (size_t) min(chrs, BUFSIZE - 1));
676 Input_Line = Strsave(str2short(buf));
677 PushMacro(Input_Line);
680 /* need to print errno message in case file is migrated */
682 stderror(ERR_SYSTEM, progname, strerror(errno));
685 #endif /* FIONREAD && !OREO */
690 * Bugfix (in Swedish) by:
692 * SICS, PO Box 1263, S-163 13 SPANGA, SWEDEN
693 * {mcvax,munnari,cernvax,diku,inria,prlb2,penet,ukc,unido}!enea!sics.se!jw
694 * Internet: jw@sics.se
696 * (via Hans J Albertsson (thanks))
707 #if defined(TERMIO) || defined(POSIX)
708 qutty.d_t.c_iflag &= ~ttylist[QU_IO][M_INPUT].t_clrmask;
709 qutty.d_t.c_iflag |= ttylist[QU_IO][M_INPUT].t_setmask;
711 qutty.d_t.c_oflag &= ~ttylist[QU_IO][M_OUTPUT].t_clrmask;
712 qutty.d_t.c_oflag |= ttylist[QU_IO][M_OUTPUT].t_setmask;
714 qutty.d_t.c_cflag &= ~ttylist[QU_IO][M_CONTROL].t_clrmask;
715 qutty.d_t.c_cflag |= ttylist[QU_IO][M_CONTROL].t_setmask;
717 qutty.d_t.c_lflag &= ~ttylist[QU_IO][M_LINED].t_clrmask;
718 qutty.d_t.c_lflag |= ttylist[QU_IO][M_LINED].t_setmask;
720 qutty.d_t.sg_flags &= ~ttylist[QU_IO][M_CONTROL].t_clrmask;
721 qutty.d_t.sg_flags |= ttylist[QU_IO][M_CONTROL].t_setmask;
722 qutty.d_lb &= ~ttylist[QU_IO][M_LOCAL].t_clrmask;
723 qutty.d_lb |= ttylist[QU_IO][M_LOCAL].t_setmask;
725 #endif /* TERMIO || POSIX */
726 if (tty_setty(SHTTY, &qutty) == -1) {
728 xprintf("QuoteModeOn: tty_setty: %s\n", strerror(errno));
729 #endif /* DEBUG_TTY */
732 #endif /* !WINNT_NATIVE */
743 if (tty_setty(SHTTY, &edtty) == -1) {
745 xprintf("QuoteModeOff: tty_setty: %s\n", strerror(errno));
746 #endif /* DEBUG_TTY */