PERFORCE change 146878 for review
Ed Schouten
ed at FreeBSD.org
Thu Aug 7 22:38:15 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146878
Change 146878 by ed at ed_dull on 2008/08/07 22:37:43
Move tty_putchar() into the TTYDISC code, so we can perform
proper output processing on characters added by tty_putchar().
This means things like reprinting now even work on stuff like
^T.
While there, remove the unushed t_writebytes from struct tty.
Affected files ...
.. //depot/projects/mpsafetty/sys/kern/tty.c#18 edit
.. //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#8 edit
.. //depot/projects/mpsafetty/sys/sys/tty.h#6 edit
Differences ...
==== //depot/projects/mpsafetty/sys/kern/tty.c#18 (text+ko) ====
@@ -1612,26 +1612,6 @@
}
int
-tty_putchar(struct tty *tp, char c)
-{
- tty_lock_assert(tp, MA_OWNED);
-
- if (tty_gone(tp))
- return (-1);
-
- /*
- * Convert \n to \r\n.
- * XXX: What about output processing?
- */
- if (c == '\n')
- ttyoutq_write_nofrag(&tp->t_outq, "\r\n", 2);
- else
- ttyoutq_write_nofrag(&tp->t_outq, &c, 1);
- ttydevsw_outwakeup(tp);
- return (0);
-}
-
-int
tty_checkoutq(struct tty *tp)
{
==== //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#8 (text+ko) ====
@@ -604,15 +604,8 @@
}
static int
-ttydisc_echo(struct tty *tp, char c, int quote)
+ttydisc_echo_force(struct tty *tp, char c, int quote)
{
- /*
- * Only echo characters when ECHO is turned on, or ECHONL when
- * the character is an unquoted newline.
- */
- if (!CMP_FLAG(l, ECHO) &&
- (!CMP_FLAG(l, ECHONL) || c != CNL || quote))
- return (0);
if (CMP_FLAG(o, OPOST) && CTL_ECHO(c, quote)) {
/*
@@ -640,6 +633,22 @@
}
}
+static int
+ttydisc_echo(struct tty *tp, char c, int quote)
+{
+
+ /*
+ * Only echo characters when ECHO is turned on, or ECHONL when
+ * the character is an unquoted newline.
+ */
+ if (!CMP_FLAG(l, ECHO) &&
+ (!CMP_FLAG(l, ECHONL) || c != CNL || quote))
+ return (0);
+
+ return ttydisc_echo_force(tp, c, quote);
+}
+
+
static void
ttydisc_reprint_char(void *d, char c, int quote)
{
@@ -1098,3 +1107,25 @@
return (error);
}
+
+/*
+ * XXX: not really related to the TTYDISC, but we'd better put
+ * tty_putchar() here, because we need to perform proper output
+ * processing.
+ */
+
+int
+tty_putchar(struct tty *tp, char c)
+{
+ tty_lock_assert(tp, MA_OWNED);
+
+ if (tty_gone(tp))
+ return (-1);
+
+ ttydisc_echo_force(tp, c, 0);
+ tp->t_writepos = tp->t_column;
+ ttyinq_reprintpos_set(&tp->t_inq);
+
+ ttydevsw_outwakeup(tp);
+ return (0);
+}
==== //depot/projects/mpsafetty/sys/sys/tty.h#6 (text+ko) ====
@@ -102,7 +102,6 @@
struct winsize t_winsize; /* (t) Window size */
unsigned int t_column; /* (t) Current cursor position */
unsigned int t_writepos; /* (t) Where input was interrupted */
- unsigned int t_writebytes; /* (t) Amount of bytes written */
/* Init/lock-state devices */
struct termios t_termios_init_in; /* tty%s.init */
More information about the p4-projects
mailing list