Revision bb002513 qemu-char.c

b/qemu-char.c
716 716
/* init terminal so that we can grab keys */
717 717
static struct termios oldtty;
718 718
static int old_fd0_flags;
719
static bool stdio_allow_signal;
719 720

  
720 721
static void term_exit(void)
721 722
{
......
723 724
    fcntl(0, F_SETFL, old_fd0_flags);
724 725
}
725 726

  
726
static void term_init(QemuOpts *opts)
727
static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo)
727 728
{
728 729
    struct termios tty;
729 730

  
730 731
    tty = oldtty;
731
    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
732
    if (!echo) {
733
        tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
732 734
                          |INLCR|IGNCR|ICRNL|IXON);
733
    tty.c_oflag |= OPOST;
734
    tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
735
        tty.c_oflag |= OPOST;
736
        tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
737
        tty.c_cflag &= ~(CSIZE|PARENB);
738
        tty.c_cflag |= CS8;
739
        tty.c_cc[VMIN] = 1;
740
        tty.c_cc[VTIME] = 0;
741
    }
735 742
    /* if graphical mode, we allow Ctrl-C handling */
736
    if (!qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC))
743
    if (!stdio_allow_signal)
737 744
        tty.c_lflag &= ~ISIG;
738
    tty.c_cflag &= ~(CSIZE|PARENB);
739
    tty.c_cflag |= CS8;
740
    tty.c_cc[VMIN] = 1;
741
    tty.c_cc[VTIME] = 0;
742 745

  
743 746
    tcsetattr (0, TCSANOW, &tty);
744 747
}
......
766 769

  
767 770
    chr = qemu_chr_open_fd(0, 1);
768 771
    chr->chr_close = qemu_chr_close_stdio;
772
    chr->chr_set_echo = qemu_chr_set_echo_stdio;
769 773
    qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr);
770 774
    stdio_nb_clients++;
771
    term_init(opts);
775
    stdio_allow_signal = qemu_opt_get_bool(opts, "signal",
776
                                           display_type != DT_NOGRAPHIC);
777
    qemu_chr_set_echo(chr, false);
772 778

  
773 779
    return chr;
774 780
}

Also available in: Unified diff