1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1995, by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 /* 30 * cbreak.c 31 * 32 * XCurses Library 33 * 34 * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved. 35 * 36 */ 37 38 #if M_RCSID 39 #ifndef lint 40 static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/cbreak.c 1.2 1995/06/19 16:11:50 ant Exp $"; 41 #endif 42 #endif 43 44 #include <private.h> 45 46 int 47 cbreak() 48 { 49 #ifdef M_CURSES_TRACE 50 __m_trace("cbreak(void)"); 51 #endif 52 53 cur_term->_flags &= ~__TERM_HALF_DELAY; 54 55 cur_term->_prog.c_cc[VMIN] = 1; 56 cur_term->_prog.c_cc[VTIME] = 0; 57 cur_term->_prog.c_lflag &= ~ICANON; 58 59 return __m_return_code("cbreak", __m_tty_set(&cur_term->_prog)); 60 } 61 62 int 63 nocbreak() 64 { 65 #ifdef M_CURSES_TRACE 66 __m_trace("nocbreak(void)"); 67 #endif 68 69 cur_term->_flags &= ~__TERM_HALF_DELAY; 70 71 /* On some systems VMIN and VTIME map to VEOF and VEOL, which 72 * means we have to restore them to their original settings. 73 */ 74 cur_term->_prog.c_cc[VEOF] = cur_term->_shell.c_cc[VEOF]; 75 cur_term->_prog.c_cc[VEOL] = cur_term->_shell.c_cc[VEOL]; 76 cur_term->_prog.c_lflag |= ICANON; 77 78 return __m_return_code("nocbreak", __m_tty_set(&cur_term->_prog)); 79 } 80 81 /* 82 * Set global timeout value, which overrides individual window timeout 83 * values (I think believe X/Open specified this wrong). 84 */ 85 int 86 halfdelay(tenths) 87 int tenths; 88 { 89 #ifdef M_CURSES_TRACE 90 __m_trace("halfdelay(%d)", tenths); 91 #endif 92 93 cur_term->_flags |= __TERM_HALF_DELAY; 94 95 cur_term->_prog.c_cc[VMIN] = 0; 96 cur_term->_prog.c_cc[VTIME] = tenths; 97 cur_term->_prog.c_lflag &= ~ICANON; 98 99 return __m_return_code("halfdelay", __m_tty_set(&cur_term->_prog)); 100 } 101 102 int 103 raw() 104 { 105 #ifdef M_CURSES_TRACE 106 __m_trace("raw(void)"); 107 #endif 108 109 cur_term->_flags &= ~__TERM_HALF_DELAY; 110 111 cur_term->_prog.c_cc[VMIN] = 1; 112 cur_term->_prog.c_cc[VTIME] = 0; 113 cur_term->_prog.c_lflag &= ~(ICANON | ISIG | IXON); 114 115 return __m_return_code("raw", __m_tty_set(&cur_term->_prog)); 116 } 117 118 int 119 noraw() 120 { 121 #ifdef M_CURSES_TRACE 122 __m_trace("noraw(void)"); 123 #endif 124 125 cur_term->_flags &= ~__TERM_HALF_DELAY; 126 127 /* On some systems VMIN and VTIME map to VEOF and VEOL, which 128 * means we have to restore them to their original settings. 129 */ 130 cur_term->_prog.c_cc[VEOF] = cur_term->_shell.c_cc[VEOF]; 131 cur_term->_prog.c_cc[VEOL] = cur_term->_shell.c_cc[VEOL]; 132 cur_term->_prog.c_lflag |= ICANON | ISIG | IXON; 133 134 return __m_return_code("noraw", __m_tty_set(&cur_term->_prog)); 135 } 136 137