comparison src/sysdep.c @ 430:a5df635868b2 r21-2-23

Import from CVS: tag r21-2-23
author cvs
date Mon, 13 Aug 2007 11:29:08 +0200
parents 3ecd8885ac67
children 3a7e78e1142d
comparison
equal deleted inserted replaced
429:8305706cbb93 430:a5df635868b2
422 422
423 void 423 void
424 child_setup_tty (int out) 424 child_setup_tty (int out)
425 { 425 {
426 struct emacs_tty s; 426 struct emacs_tty s;
427 EMACS_GET_TTY (out, &s); 427 emacs_get_tty (out, &s);
428 428
429 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 429 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
430 assert (isatty(out)); 430 assert (isatty(out));
431 s.main.c_oflag |= OPOST; /* Enable output postprocessing */ 431 s.main.c_oflag |= OPOST; /* Enable output postprocessing */
432 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ 432 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
514 s.main.sg_erase = 0377; 514 s.main.sg_erase = 0377;
515 s.main.sg_kill = 0377; 515 s.main.sg_kill = 0377;
516 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */ 516 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */
517 517
518 #endif /* not HAVE_TERMIO */ 518 #endif /* not HAVE_TERMIO */
519 EMACS_SET_TTY (out, &s, 0); 519 emacs_set_tty (out, &s, 0);
520 520
521 #ifdef RTU 521 #ifdef RTU
522 { 522 {
523 int zero = 0; 523 int zero = 0;
524 ioctl (out, FIOASYNC, &zero); 524 ioctl (out, FIOASYNC, &zero);
1370 return 0; 1370 return 0;
1371 } 1371 }
1372 1372
1373 /* Set the parameters of the tty on FD according to the contents of 1373 /* Set the parameters of the tty on FD according to the contents of
1374 *SETTINGS. If FLUSHP is non-zero, we discard input. 1374 *SETTINGS. If FLUSHP is non-zero, we discard input.
1375 Return 0 if all went well, and -1 if anything failed. */ 1375 Return 0 if all went well, and -1 if anything failed.
1376 #### All current callers use FLUSHP == 0. */
1376 1377
1377 int 1378 int
1378 emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) 1379 emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
1379 { 1380 {
1380 /* Set the primary parameters - baud rate, character size, etcetera. */ 1381 /* Set the primary parameters - baud rate, character size, etcetera. */
1480 struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); 1481 struct console *con = XCONSOLE (DEVICE_CONSOLE (d));
1481 1482
1482 input_fd = CONSOLE_TTY_DATA (con)->infd; 1483 input_fd = CONSOLE_TTY_DATA (con)->infd;
1483 output_fd = CONSOLE_TTY_DATA (con)->outfd; 1484 output_fd = CONSOLE_TTY_DATA (con)->outfd;
1484 1485
1485 EMACS_GET_TTY (input_fd, &CONSOLE_TTY_DATA (con)->old_tty); 1486 emacs_get_tty (input_fd, &CONSOLE_TTY_DATA (con)->old_tty);
1486 tty = CONSOLE_TTY_DATA (con)->old_tty; 1487 tty = CONSOLE_TTY_DATA (con)->old_tty;
1487 1488
1488 con->tty_erase_char = Qnil; 1489 con->tty_erase_char = Qnil;
1489 1490
1490 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 1491 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
1647 1648
1648 #ifdef HAVE_LTCHARS 1649 #ifdef HAVE_LTCHARS
1649 tty.ltchars = new_ltchars; 1650 tty.ltchars = new_ltchars;
1650 #endif /* HAVE_LTCHARS */ 1651 #endif /* HAVE_LTCHARS */
1651 1652
1652 EMACS_SET_TTY (input_fd, &tty, 0); 1653 emacs_set_tty (input_fd, &tty, 0);
1653 1654
1654 /* This code added to insure that, if flow-control is not to be used, 1655 /* This code added to insure that, if flow-control is not to be used,
1655 we have an unlocked terminal at the start. */ 1656 we have an unlocked terminal at the start. */
1656 1657
1657 #ifdef TCXONC 1658 #ifdef TCXONC
1754 #ifdef HAVE_TTY 1755 #ifdef HAVE_TTY
1755 if (DEVICE_TTY_P (d)) 1756 if (DEVICE_TTY_P (d))
1756 { 1757 {
1757 struct emacs_tty tty; 1758 struct emacs_tty tty;
1758 1759
1759 EMACS_GET_TTY (DEVICE_INFD (d), &tty); 1760 emacs_get_tty (DEVICE_INFD (d), &tty);
1760 return EMACS_TTY_TABS_OK (&tty); 1761 return EMACS_TTY_TABS_OK (&tty);
1761 } 1762 }
1762 #endif 1763 #endif
1763 return 1; 1764 return 1;
1764 } 1765 }
1827 int eight_bit = 0; 1828 int eight_bit = 0;
1828 1829
1829 assert (DEVICE_TTY_P (d)); 1830 assert (DEVICE_TTY_P (d));
1830 input_fd = DEVICE_INFD (d); 1831 input_fd = DEVICE_INFD (d);
1831 1832
1832 EMACS_GET_TTY (input_fd, &s); 1833 emacs_get_tty (input_fd, &s);
1833 1834
1834 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 1835 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
1835 eight_bit = (s.main.c_cflag & CSIZE) == CS8; 1836 eight_bit = (s.main.c_cflag & CSIZE) == CS8;
1836 #else 1837 #else
1837 eight_bit = 0; /* I don't know how to do it */ 1838 eight_bit = 0; /* I don't know how to do it */
1877 #if defined (BSD) 1878 #if defined (BSD)
1878 /* Avoid possible loss of output when changing terminal modes. */ 1879 /* Avoid possible loss of output when changing terminal modes. */
1879 fsync (output_fd); 1880 fsync (output_fd);
1880 #endif 1881 #endif
1881 1882
1882 while (EMACS_SET_TTY (input_fd, &CONSOLE_TTY_DATA (con)->old_tty, 0) 1883 while (emacs_set_tty (input_fd, &CONSOLE_TTY_DATA (con)->old_tty, 0)
1883 < 0 && errno == EINTR) 1884 < 0 && errno == EINTR)
1884 ; 1885 ;
1885 1886
1886 #ifdef SET_LINE_DISCIPLINE 1887 #ifdef SET_LINE_DISCIPLINE
1887 /* Ultrix's termios *ignores* any line discipline except TERMIODISC. 1888 /* Ultrix's termios *ignores* any line discipline except TERMIODISC.