MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / ttydisc_echo_force

Function ttydisc_echo_force

components/lwp/terminal/freebsd/tty_ttydisc.c:683–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681}
682
683static int ttydisc_echo_force(struct lwp_tty *tp, char c, int quote)
684{
685 if (CMP_FLAG(l, FLUSHO))
686 return 0;
687
688 if (CMP_FLAG(o, OPOST) && CTL_ECHO(c, quote))
689 {
690 /*
691 * Only perform postprocessing when OPOST is turned on
692 * and the character is an unquoted BS/TB/NL/CR.
693 */
694 return ttydisc_write_oproc(tp, c);
695 }
696 else if (CMP_FLAG(l, ECHOCTL) && CTL_PRINT(c, quote))
697 {
698 /*
699 * Only use ^X notation when ECHOCTL is turned on and
700 * we've got an quoted control character.
701 *
702 * Print backspaces when echoing an end-of-file.
703 */
704 char ob[4] = "^?\b\b";
705
706 /* Print ^X notation. */
707 if (c != 0x7f)
708 ob[1] = c + 'A' - 1;
709
710 if (!quote && CMP_CC(VEOF, c))
711 {
712 return ttyoutq_write_nofrag(&tp->t_outq, ob, 4);
713 }
714 else
715 {
716 tp->t_column += 2;
717 return ttyoutq_write_nofrag(&tp->t_outq, ob, 2);
718 }
719 }
720 else
721 {
722 /* Can just be printed. */
723 tp->t_column++;
724 return ttyoutq_write_nofrag(&tp->t_outq, &c, 1);
725 }
726}
727
728static int ttydisc_echo(struct lwp_tty *tp, char c, int quote)
729{

Callers 1

ttydisc_echoFunction · 0.85

Calls 2

ttydisc_write_oprocFunction · 0.85
ttyoutq_write_nofragFunction · 0.85

Tested by

no test coverage detected