Deleted Added
full compact
tty.c (9616) tty.c (9617)
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
39 * $Id: tty.c,v 1.49 1995/07/21 13:56:29 bde Exp $
39 * $Id: tty.c,v 1.50 1995/07/21 14:15:09 bde Exp $
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.

--- 132 unchanged lines hidden (view full) ---

180#undef TB
181#undef VT
182
183/* Macros to clear/set/test flags. */
184#define SET(t, f) (t) |= (f)
185#define CLR(t, f) (t) &= ~(f)
186#define ISSET(t, f) ((t) & (f))
187
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.

--- 132 unchanged lines hidden (view full) ---

180#undef TB
181#undef VT
182
183/* Macros to clear/set/test flags. */
184#define SET(t, f) (t) |= (f)
185#define CLR(t, f) (t) &= ~(f)
186#define ISSET(t, f) ((t) & (f))
187
188#undef MAX_INPUT /* XXX wrong in <sys/syslimits.h> */
189#define MAX_INPUT TTYHOG
190
188/*
189 * Initial open of tty, or (re)entry to standard tty line discipline.
190 */
191int
192ttyopen(device, tp)
193 dev_t device;
194 register struct tty *tp;
195{

--- 107 unchanged lines hidden (view full) ---

303 c = cc[VINTR];
304 else if (ISSET(iflag, PARMRK))
305 goto parmrk;
306 } else if ((ISSET(err, TTY_PE) && ISSET(iflag, INPCK))
307 || ISSET(err, TTY_FE)) {
308 if (ISSET(iflag, IGNPAR))
309 return (0);
310 else if (ISSET(iflag, PARMRK)) {
191/*
192 * Initial open of tty, or (re)entry to standard tty line discipline.
193 */
194int
195ttyopen(device, tp)
196 dev_t device;
197 register struct tty *tp;
198{

--- 107 unchanged lines hidden (view full) ---

306 c = cc[VINTR];
307 else if (ISSET(iflag, PARMRK))
308 goto parmrk;
309 } else if ((ISSET(err, TTY_PE) && ISSET(iflag, INPCK))
310 || ISSET(err, TTY_FE)) {
311 if (ISSET(iflag, IGNPAR))
312 return (0);
313 else if (ISSET(iflag, PARMRK)) {
311parmrk: (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
314parmrk:
315 if (tp->t_rawq.c_cc + tp->t_canq.c_cc >
316 MAX_INPUT - 3)
317 goto input_overflow;
318 (void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
312 (void)putc(0 | TTY_QUOTE, &tp->t_rawq);
313 (void)putc(c | TTY_QUOTE, &tp->t_rawq);
314 goto endcase;
315 } else
316 c = 0;
317 }
318 }
319 /*

--- 193 unchanged lines hidden (view full) ---

513 if (!ISSET(lflag, NOKERNINFO))
514 ttyinfo(tp);
515 goto endcase;
516 }
517 }
518 /*
519 * Check for input buffer overflow
520 */
319 (void)putc(0 | TTY_QUOTE, &tp->t_rawq);
320 (void)putc(c | TTY_QUOTE, &tp->t_rawq);
321 goto endcase;
322 } else
323 c = 0;
324 }
325 }
326 /*

--- 193 unchanged lines hidden (view full) ---

520 if (!ISSET(lflag, NOKERNINFO))
521 ttyinfo(tp);
522 goto endcase;
523 }
524 }
525 /*
526 * Check for input buffer overflow
527 */
521 if (tp->t_rawq.c_cc + tp->t_canq.c_cc >= TTYHOG) {
528 if (tp->t_rawq.c_cc + tp->t_canq.c_cc >= MAX_INPUT) {
529input_overflow:
522 if (ISSET(iflag, IMAXBEL)) {
523 if (tp->t_outq.c_cc < tp->t_hiwat)
524 (void)ttyoutput(CTRL('g'), tp);
525 }
526 goto endcase;
527 }
528
529 if ( c == 0377 && ISSET(iflag, PARMRK) && !ISSET(iflag, ISTRIP)

--- 1754 unchanged lines hidden ---
530 if (ISSET(iflag, IMAXBEL)) {
531 if (tp->t_outq.c_cc < tp->t_hiwat)
532 (void)ttyoutput(CTRL('g'), tp);
533 }
534 goto endcase;
535 }
536
537 if ( c == 0377 && ISSET(iflag, PARMRK) && !ISSET(iflag, ISTRIP)

--- 1754 unchanged lines hidden ---