MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ttydisc_echo_force

Function ttydisc_echo_force

freebsd/kern/tty_ttydisc.c:641–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639}
640
641static int
642ttydisc_echo_force(struct tty *tp, char c, int quote)
643{
644
645 if (CMP_FLAG(l, FLUSHO))
646 return 0;
647
648 if (CMP_FLAG(o, OPOST) && CTL_ECHO(c, quote)) {
649 /*
650 * Only perform postprocessing when OPOST is turned on
651 * and the character is an unquoted BS/TB/NL/CR.
652 */
653 return ttydisc_write_oproc(tp, c);
654 } else if (CMP_FLAG(l, ECHOCTL) && CTL_PRINT(c, quote)) {
655 /*
656 * Only use ^X notation when ECHOCTL is turned on and
657 * we've got an quoted control character.
658 *
659 * Print backspaces when echoing an end-of-file.
660 */
661 char ob[4] = "^?\b\b";
662
663 /* Print ^X notation. */
664 if (c != 0x7f)
665 ob[1] = c + 'A' - 1;
666
667 if (!quote && CMP_CC(VEOF, c)) {
668 return ttyoutq_write_nofrag(&tp->t_outq, ob, 4);
669 } else {
670 tp->t_column += 2;
671 return ttyoutq_write_nofrag(&tp->t_outq, ob, 2);
672 }
673 } else {
674 /* Can just be printed. */
675 tp->t_column++;
676 return ttyoutq_write_nofrag(&tp->t_outq, &c, 1);
677 }
678}
679
680static int
681ttydisc_echo(struct tty *tp, char c, int quote)

Callers 2

ttydisc_echoFunction · 0.85
tty_putstrnFunction · 0.85

Calls 2

ttydisc_write_oprocFunction · 0.85
ttyoutq_write_nofragFunction · 0.85

Tested by

no test coverage detected