tty.c (9bfd6482c853c78c817bbfd93cae5ba36e619c5b) tty.c (3617ddfc33101e0c75cac231ca0c335f8182fa99)
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.

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

662
663 /*
664 * Newline translation: if ONLCR is set,
665 * translate newline into "\r\n".
666 */
667 if (c == '\n' && ISSET(tp->t_oflag, ONLCR)) {
668 tk_nout++;
669 tp->t_outcc++;
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.

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

662
663 /*
664 * Newline translation: if ONLCR is set,
665 * translate newline into "\r\n".
666 */
667 if (c == '\n' && ISSET(tp->t_oflag, ONLCR)) {
668 tk_nout++;
669 tp->t_outcc++;
670 if (putc('\r', &tp->t_outq))
670 if (!ISSET(tp->t_lflag, FLUSHO) && putc('\r', &tp->t_outq))
671 return (c);
672 }
671 return (c);
672 }
673 /* If OCRNL is set, translate "\r" into "\n". */
674 else if (c == '\r' && ISSET(tp->t_oflag, OCRNL))
675 c = '\n';
676 /* If ONOCR is set, don't transmit CRs when on column 0. */
677 else if (c == '\r' && ISSET(tp->t_oflag, ONOCR) && tp->t_column == 0)
678 return (-1);
679
673 tk_nout++;
674 tp->t_outcc++;
675 if (!ISSET(tp->t_lflag, FLUSHO) && putc(c, &tp->t_outq))
676 return (c);
677
678 col = tp->t_column;
679 switch (CCLASS(c)) {
680 case BACKSPACE:
681 if (col > 0)
682 --col;
683 break;
684 case CONTROL:
685 break;
686 case NEWLINE:
680 tk_nout++;
681 tp->t_outcc++;
682 if (!ISSET(tp->t_lflag, FLUSHO) && putc(c, &tp->t_outq))
683 return (c);
684
685 col = tp->t_column;
686 switch (CCLASS(c)) {
687 case BACKSPACE:
688 if (col > 0)
689 --col;
690 break;
691 case CONTROL:
692 break;
693 case NEWLINE:
694 if (ISSET(tp->t_oflag, ONLCR | ONLRET))
695 col = 0;
696 break;
687 case RETURN:
688 col = 0;
689 break;
690 case ORDINARY:
691 ++col;
692 break;
693 case TAB:
694 col = (col + 8) & ~7;

--- 1893 unchanged lines hidden ---
697 case RETURN:
698 col = 0;
699 break;
700 case ORDINARY:
701 ++col;
702 break;
703 case TAB:
704 col = (col + 8) & ~7;

--- 1893 unchanged lines hidden ---