Mercurial > emacs
comparison src/sysdep.c @ 83065:a871be7b26a5
Implemented suspending of emacsclient frames.
lib-src/emacsclient.c (quote_file_name): Renamed to quote_argument.
(unquote_argument, handle_sigcont, handle_sigtstp): New functions.
(out, in): New global variables for communicating with the Emacs process.
(init_signals): Set up handlers for SIGCONT, SIGTSTP and SIGTTOU.
(main): Changed out and in to global variables. Prepend `-eval' or
'-file' to each argument. Use fsync to force sending the strings to Emacs.
Removed obsolete -bad-version code. Support the -suspend command.
Cleaned up newline handling.
lisp/frame.el (suspend-frame): New function.
Substitute key definition of suspend-emacs with suspend-frame.
lisp/server.el (server-log): Cosmetic change in log format.
(server-handle-delete-tty, server-handle-delete-frame): Added logging.
(server-handle-suspend-tty, server-quote-arg): New functions.
(server-start): Install server-handle-suspend-tty.
(server-process-filter): Reorganized source code for clarity.
Implemented -resume, -suspend and -ignore commands.
lisp/term/x-win.el (x-initialize-window-system): Don't change the
binding of C-z.
src/cm.c: Replaced TTY_INPUT, TTY_OUTPUT, TTY_TERMSCRIPT calls with
their macro expansion.
src/dispnew.c: Ditto.
src/frame.c: Ditto.
src/keyboard.c: Ditto.
src/sysdep.c: Ditto.
src/keyboard.c (tty_read_avail_input): Don't read if the terminal is
suspended.
src/sysdep.c (discard_tty_input, init_sys_modes, reset_sys_modes): Ditto.
src/term.c (tty_set_terminal_modes, tty_reset_terminal_modes): Ditto.
src/term.c (Vsuspend_tty_functions, Vresume_tty_functions): New hooks.
(syms_of_term): Defvar them.
(term_init): Don't allow opening a new frame on a suspended tty device.
(Fsuspend_tty, Fresume_tty): New functions.
(syms_of_term): Defsubr them.
src/termchar.c (struct tty_display_info): Update documentation of
input and output.
(TTY_INPUT, TTY_OUTPUT, TTY_TERMSCRIPT): Removed.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-105
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 28 Feb 2004 01:23:39 +0000 |
parents | 03a73693678e |
children | b44978264e1d |
comparison
equal
deleted
inserted
replaced
83064:e7e9448cb3a0 | 83065:a871be7b26a5 |
---|---|
272 if (noninteractive) | 272 if (noninteractive) |
273 return; | 273 return; |
274 | 274 |
275 #ifdef VMS | 275 #ifdef VMS |
276 end_kbd_input (); | 276 end_kbd_input (); |
277 SYS$QIOW (0, fileno (TTY_INPUT (CURTTY())), IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0, | 277 SYS$QIOW (0, fileno (CURTTY()->input), IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0, |
278 &buf.main, 0, 0, terminator_mask, 0, 0); | 278 &buf.main, 0, 0, terminator_mask, 0, 0); |
279 queue_kbd_input (); | 279 queue_kbd_input (); |
280 #else /* not VMS */ | 280 #else /* not VMS */ |
281 #ifdef APOLLO | 281 #ifdef APOLLO |
282 { | 282 { |
283 struct tty_display_info *tty; | 283 struct tty_display_info *tty; |
284 for (tty = tty_list; tty; tty = tty->next) | 284 for (tty = tty_list; tty; tty = tty->next) |
285 { | 285 { |
286 int zero = 0; | 286 int zero = 0; |
287 ioctl (fileno (TTY_INPUT (tty)), TIOCFLUSH, &zero); | 287 if (tty->input) |
288 ioctl (fileno (tty->input), TIOCFLUSH, &zero); | |
288 } | 289 } |
289 } | 290 } |
290 #else /* not Apollo */ | 291 #else /* not Apollo */ |
291 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 292 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
292 while (dos_keyread () != -1) | 293 while (dos_keyread () != -1) |
294 #else /* not MSDOS */ | 295 #else /* not MSDOS */ |
295 { | 296 { |
296 struct tty_display_info *tty; | 297 struct tty_display_info *tty; |
297 for (tty = tty_list; tty; tty = tty->next) | 298 for (tty = tty_list; tty; tty = tty->next) |
298 { | 299 { |
299 EMACS_GET_TTY (fileno (TTY_INPUT (tty)), &buf); | 300 if (tty->input) /* Is the device suspended? */ |
300 EMACS_SET_TTY (fileno (TTY_INPUT (tty)), &buf, 0); | 301 { |
302 EMACS_GET_TTY (fileno (tty->input), &buf); | |
303 EMACS_SET_TTY (fileno (tty->input), &buf, 0); | |
304 } | |
301 } | 305 } |
302 } | 306 } |
303 #endif /* not MSDOS */ | 307 #endif /* not MSDOS */ |
304 #endif /* not Apollo */ | 308 #endif /* not Apollo */ |
305 #endif /* not VMS */ | 309 #endif /* not VMS */ |
320 if (! FRAME_TERMCAP_P (SELECTED_FRAME ())) | 324 if (! FRAME_TERMCAP_P (SELECTED_FRAME ())) |
321 return; | 325 return; |
322 | 326 |
323 /* Should perhaps error if in batch mode */ | 327 /* Should perhaps error if in batch mode */ |
324 #ifdef TIOCSTI | 328 #ifdef TIOCSTI |
325 ioctl (fileno (TTY_INPUT (CURTTY())), TIOCSTI, &c); | 329 ioctl (fileno (CURTTY()->input), TIOCSTI, &c); |
326 #else /* no TIOCSTI */ | 330 #else /* no TIOCSTI */ |
327 error ("Cannot stuff terminal input characters in this version of Unix"); | 331 error ("Cannot stuff terminal input characters in this version of Unix"); |
328 #endif /* no TIOCSTI */ | 332 #endif /* no TIOCSTI */ |
329 } | 333 } |
330 | 334 |
1003 | 1007 |
1004 if (read_socket_hook) | 1008 if (read_socket_hook) |
1005 return; | 1009 return; |
1006 | 1010 |
1007 /* XXX CURTTY() is bogus here. */ | 1011 /* XXX CURTTY() is bogus here. */ |
1008 ioctl (fileno (TTY_INPUT (CURTTY ())), FIOASYNC, &on); | 1012 ioctl (fileno (CURTTY ()->input), FIOASYNC, &on); |
1009 interrupts_deferred = 0; | 1013 interrupts_deferred = 0; |
1010 } | 1014 } |
1011 | 1015 |
1012 void | 1016 void |
1013 unrequest_sigio () | 1017 unrequest_sigio () |
1016 | 1020 |
1017 if (read_socket_hook) | 1021 if (read_socket_hook) |
1018 return; | 1022 return; |
1019 | 1023 |
1020 /* XXX CURTTY() is bogus here. */ | 1024 /* XXX CURTTY() is bogus here. */ |
1021 ioctl (fileno (TTY_INPUT (CURTTY ())), FIOASYNC, &off); | 1025 ioctl (fileno (CURTTY ()->input), FIOASYNC, &off); |
1022 interrupts_deferred = 1; | 1026 interrupts_deferred = 1; |
1023 } | 1027 } |
1024 | 1028 |
1025 #else /* not FASYNC, not STRIDE */ | 1029 #else /* not FASYNC, not STRIDE */ |
1026 | 1030 |
1364 Vtty_erase_char = Qnil; | 1368 Vtty_erase_char = Qnil; |
1365 | 1369 |
1366 if (noninteractive) | 1370 if (noninteractive) |
1367 return; | 1371 return; |
1368 | 1372 |
1373 if (!tty_out->output) | |
1374 return; /* The tty is suspended. */ | |
1375 | |
1369 #ifdef VMS | 1376 #ifdef VMS |
1370 if (!input_ef) | 1377 if (!input_ef) |
1371 input_ef = get_kbd_event_flag (); | 1378 input_ef = get_kbd_event_flag (); |
1372 /* LIB$GET_EF (&input_ef); */ | 1379 /* LIB$GET_EF (&input_ef); */ |
1373 SYS$CLREF (input_ef); | 1380 SYS$CLREF (input_ef); |
1402 #if 0 | 1409 #if 0 |
1403 /* read_socket_hook is not global anymore. I think doing this | 1410 /* read_socket_hook is not global anymore. I think doing this |
1404 unconditionally will not cause any problems. */ | 1411 unconditionally will not cause any problems. */ |
1405 if (! read_socket_hook && EQ (Vinitial_window_system, Qnil)) | 1412 if (! read_socket_hook && EQ (Vinitial_window_system, Qnil)) |
1406 #endif | 1413 #endif |
1407 narrow_foreground_group (fileno (TTY_INPUT (tty_out))); | 1414 narrow_foreground_group (fileno (tty_out->input)); |
1408 #endif | 1415 #endif |
1409 | 1416 |
1410 if (! tty_out->old_tty) | 1417 if (! tty_out->old_tty) |
1411 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); | 1418 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); |
1412 | 1419 |
1413 EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), tty_out->old_tty); | 1420 EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty); |
1414 | 1421 |
1415 tty = *tty_out->old_tty; | 1422 tty = *tty_out->old_tty; |
1416 | 1423 |
1417 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 1424 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) |
1418 XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); | 1425 XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); |
1624 if (!tty_out->term_initted) | 1631 if (!tty_out->term_initted) |
1625 internal_terminal_init (); | 1632 internal_terminal_init (); |
1626 dos_ttraw (); | 1633 dos_ttraw (); |
1627 #endif | 1634 #endif |
1628 | 1635 |
1629 EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), &tty, 0); | 1636 EMACS_SET_TTY (fileno (tty_out->input), &tty, 0); |
1630 | 1637 |
1631 /* This code added to insure that, if flow-control is not to be used, | 1638 /* This code added to insure that, if flow-control is not to be used, |
1632 we have an unlocked terminal at the start. */ | 1639 we have an unlocked terminal at the start. */ |
1633 | 1640 |
1634 #ifdef TCXONC | 1641 #ifdef TCXONC |
1635 if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); | 1642 if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TCXONC, 1); |
1636 #endif | 1643 #endif |
1637 #ifndef APOLLO | 1644 #ifndef APOLLO |
1638 #ifdef TIOCSTART | 1645 #ifdef TIOCSTART |
1639 if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); | 1646 if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); |
1640 #endif | 1647 #endif |
1641 #endif | 1648 #endif |
1642 | 1649 |
1643 #if defined (HAVE_TERMIOS) || defined (HPUX9) | 1650 #if defined (HAVE_TERMIOS) || defined (HPUX9) |
1644 #ifdef TCOON | 1651 #ifdef TCOON |
1645 if (!tty_out->flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); | 1652 if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); |
1646 #endif | 1653 #endif |
1647 #endif | 1654 #endif |
1648 | 1655 |
1649 #ifdef AIXHFT | 1656 #ifdef AIXHFT |
1650 hft_init (tty_out); | 1657 hft_init (tty_out); |
1660 #endif | 1667 #endif |
1661 #endif /* AIXHFT */ | 1668 #endif /* AIXHFT */ |
1662 | 1669 |
1663 #ifdef VMS | 1670 #ifdef VMS |
1664 /* Appears to do nothing when in PASTHRU mode. | 1671 /* Appears to do nothing when in PASTHRU mode. |
1665 SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, | 1672 SYS$QIOW (0, fileno (tty_out->input), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, |
1666 interrupt_signal, oob_chars, 0, 0, 0, 0); | 1673 interrupt_signal, oob_chars, 0, 0, 0, 0); |
1667 */ | 1674 */ |
1668 queue_kbd_input (0); | 1675 queue_kbd_input (0); |
1669 #endif /* VMS */ | 1676 #endif /* VMS */ |
1670 | 1677 |
1671 #ifdef F_SETFL | 1678 #ifdef F_SETFL |
1672 #ifndef F_SETOWN_BUG | 1679 #ifndef F_SETOWN_BUG |
1673 #ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ | 1680 #ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ |
1674 if (interrupt_input) | 1681 if (interrupt_input) |
1675 { | 1682 { |
1676 old_fcntl_owner[fileno (TTY_INPUT (tty_out))] = | 1683 old_fcntl_owner[fileno (tty_out->input)] = |
1677 fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); | 1684 fcntl (fileno (tty_out->input), F_GETOWN, 0); |
1678 fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, getpid ()); | 1685 fcntl (fileno (tty_out->input), F_SETOWN, getpid ()); |
1679 init_sigio (fileno (TTY_INPUT (tty_out))); | 1686 init_sigio (fileno (tty_out->input)); |
1680 } | 1687 } |
1681 #endif /* F_GETOWN */ | 1688 #endif /* F_GETOWN */ |
1682 #endif /* F_SETOWN_BUG */ | 1689 #endif /* F_SETOWN_BUG */ |
1683 #endif /* F_SETFL */ | 1690 #endif /* F_SETFL */ |
1684 | 1691 |
1685 #ifdef BSD4_1 | 1692 #ifdef BSD4_1 |
1686 if (interrupt_input) | 1693 if (interrupt_input) |
1687 init_sigio (fileno (TTY_INPUT (tty_out))); | 1694 init_sigio (fileno (tty_out->input)); |
1688 #endif | 1695 #endif |
1689 | 1696 |
1690 #ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */ | 1697 #ifdef VMS /* VMS sometimes has this symbol but lacks setvbuf. */ |
1691 #undef _IOFBF | 1698 #undef _IOFBF |
1692 #endif | 1699 #endif |
1693 #ifdef _IOFBF | 1700 #ifdef _IOFBF |
1694 /* This symbol is defined on recent USG systems. | 1701 /* This symbol is defined on recent USG systems. |
1695 Someone says without this call USG won't really buffer the file | 1702 Someone says without this call USG won't really buffer the file |
1696 even with a call to setbuf. */ | 1703 even with a call to setbuf. */ |
1697 setvbuf (TTY_OUTPUT (tty_out), (char *) _sobuf, _IOFBF, sizeof _sobuf); | 1704 setvbuf (tty_out->output, (char *) _sobuf, _IOFBF, sizeof _sobuf); |
1698 #else | 1705 #else |
1699 setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); | 1706 setbuf (tty_out->output, (char *) _sobuf); |
1700 #endif | 1707 #endif |
1701 | 1708 |
1702 tty_set_terminal_modes (tty_out->display); | 1709 tty_set_terminal_modes (tty_out->display); |
1703 | 1710 |
1704 if (!tty_out->term_initted) | 1711 if (!tty_out->term_initted) |
1865 return; | 1872 return; |
1866 } | 1873 } |
1867 if (!tty_out->term_initted) | 1874 if (!tty_out->term_initted) |
1868 return; | 1875 return; |
1869 | 1876 |
1877 if (!tty_out->output) | |
1878 return; /* The tty is suspended. */ | |
1879 | |
1870 /* Go to and clear the last line of the terminal. */ | 1880 /* Go to and clear the last line of the terminal. */ |
1871 | 1881 |
1872 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1882 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
1873 | 1883 |
1874 /* Code adapted from tty_clear_end_of_line. */ | 1884 /* Code adapted from tty_clear_end_of_line. */ |
1875 if (tty_out->TS_clr_line) | 1885 if (tty_out->TS_clr_line) |
1876 { | 1886 { |
1877 emacs_tputs (tty_out, tty_out->TS_clr_line, 1, cmputc); | 1887 emacs_tputs (tty_out, tty_out->TS_clr_line, 1, cmputc); |
1878 } | 1888 } |
1879 else | 1889 else |
1880 { /* have to do it the hard way */ | 1890 { /* have to do it the hard way */ |
1881 int i; | 1891 int i; |
1882 turn_off_insert (tty_out); | 1892 turn_off_insert (tty_out); |
1883 | 1893 |
1884 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) | 1894 for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++) |
1885 { | 1895 { |
1886 fputc (' ', TTY_OUTPUT (tty_out)); | 1896 fputc (' ', tty_out->output); |
1887 } | 1897 } |
1888 } | 1898 } |
1889 | 1899 |
1890 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1900 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
1891 fflush (tty_out->output); | 1901 fflush (tty_out->output); |
1892 | 1902 |
1893 #if defined (IBMR2AIX) && defined (AIXHFT) | 1903 #if defined (IBMR2AIX) && defined (AIXHFT) |
1894 { | 1904 { |
1900 write (1, "\033[20h", 5); | 1910 write (1, "\033[20h", 5); |
1901 } | 1911 } |
1902 #endif | 1912 #endif |
1903 | 1913 |
1904 tty_reset_terminal_modes (tty_out->display); | 1914 tty_reset_terminal_modes (tty_out->display); |
1905 fflush (TTY_OUTPUT (tty_out)); | 1915 fflush (tty_out->output); |
1906 #ifdef BSD_SYSTEM | 1916 #ifdef BSD_SYSTEM |
1907 #ifndef BSD4_1 | 1917 #ifndef BSD4_1 |
1908 /* Avoid possible loss of output when changing terminal modes. */ | 1918 /* Avoid possible loss of output when changing terminal modes. */ |
1909 fsync (fileno (TTY_OUTPUT (tty_out))); | 1919 fsync (fileno (tty_out->output)); |
1910 #endif | 1920 #endif |
1911 #endif | 1921 #endif |
1912 | 1922 |
1913 #ifdef F_SETFL | 1923 #ifdef F_SETFL |
1914 #ifndef F_SETOWN_BUG | 1924 #ifndef F_SETOWN_BUG |
1915 #ifdef F_SETOWN /* F_SETFL does not imply existence of F_SETOWN */ | 1925 #ifdef F_SETOWN /* F_SETFL does not imply existence of F_SETOWN */ |
1916 if (interrupt_input) | 1926 if (interrupt_input) |
1917 { | 1927 { |
1918 reset_sigio (fileno (TTY_INPUT (tty_out))); | 1928 reset_sigio (fileno (tty_out->input)); |
1919 fcntl (fileno (TTY_INPUT (tty_out)), F_SETOWN, | 1929 fcntl (fileno (tty_out->input), F_SETOWN, |
1920 old_fcntl_owner[fileno (TTY_INPUT (tty_out))]); | 1930 old_fcntl_owner[fileno (tty_out->input)]); |
1921 } | 1931 } |
1922 #endif /* F_SETOWN */ | 1932 #endif /* F_SETOWN */ |
1923 #endif /* F_SETOWN_BUG */ | 1933 #endif /* F_SETOWN_BUG */ |
1924 #ifdef O_NDELAY | 1934 #ifdef O_NDELAY |
1925 fcntl (fileno (TTY_INPUT (tty_out)), F_SETFL, | 1935 fcntl (fileno (tty_out->input), F_SETFL, |
1926 fcntl (fileno (TTY_INPUT (tty_out)), F_GETFL, 0) & ~O_NDELAY); | 1936 fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NDELAY); |
1927 #endif | 1937 #endif |
1928 #endif /* F_SETFL */ | 1938 #endif /* F_SETFL */ |
1929 #ifdef BSD4_1 | 1939 #ifdef BSD4_1 |
1930 if (interrupt_input) | 1940 if (interrupt_input) |
1931 reset_sigio (fileno (TTY_INPUT (tty_out))); | 1941 reset_sigio (fileno (tty_out->input)); |
1932 #endif /* BSD4_1 */ | 1942 #endif /* BSD4_1 */ |
1933 | 1943 |
1934 if (tty_out->old_tty) | 1944 if (tty_out->old_tty) |
1935 while (EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), | 1945 while (EMACS_SET_TTY (fileno (tty_out->input), |
1936 tty_out->old_tty, 0) < 0 && errno == EINTR) | 1946 tty_out->old_tty, 0) < 0 && errno == EINTR) |
1937 ; | 1947 ; |
1938 | 1948 |
1939 #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ | 1949 #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida */ |
1940 dos_ttcooked (); | 1950 dos_ttcooked (); |
1950 #ifdef AIXHFT | 1960 #ifdef AIXHFT |
1951 hft_reset (); | 1961 hft_reset (); |
1952 #endif | 1962 #endif |
1953 | 1963 |
1954 #ifdef BSD_PGRPS | 1964 #ifdef BSD_PGRPS |
1955 widen_foreground_group (fileno (TTY_INPUT (tty_out))); | 1965 widen_foreground_group (fileno (tty_out->input)); |
1956 #endif | 1966 #endif |
1957 } | 1967 } |
1958 | 1968 |
1959 #ifdef HAVE_PTYS | 1969 #ifdef HAVE_PTYS |
1960 | 1970 |
2015 void | 2025 void |
2016 init_vms_input () | 2026 init_vms_input () |
2017 { | 2027 { |
2018 int status; | 2028 int status; |
2019 | 2029 |
2020 if (fileno (TTY_INPUT (CURTTY())) == 0) | 2030 if (fileno (CURTTY ()->input)) == 0) |
2021 { | 2031 { |
2022 status = SYS$ASSIGN (&input_dsc, &fileno (TTY_INPUT (CURTTY())), 0, 0); | 2032 status = SYS$ASSIGN (&input_dsc, &fileno (CURTTY ()->input)), 0, 0); |
2023 if (! (status & 1)) | 2033 if (! (status & 1)) |
2024 LIB$STOP (status); | 2034 LIB$STOP (status); |
2025 } | 2035 } |
2026 } | 2036 } |
2027 | 2037 |
2028 /* Deassigning the input channel is done before exiting. */ | 2038 /* Deassigning the input channel is done before exiting. */ |
2029 | 2039 |
2030 void | 2040 void |
2031 stop_vms_input () | 2041 stop_vms_input () |
2032 { | 2042 { |
2033 return SYS$DASSGN (fileno (TTY_INPUT (CURTTY()))); | 2043 return SYS$DASSGN (fileno (CURTTY ()->input))); |
2034 } | 2044 } |
2035 | 2045 |
2036 short input_buffer; | 2046 short input_buffer; |
2037 | 2047 |
2038 /* Request reading one character into the keyboard buffer. | 2048 /* Request reading one character into the keyboard buffer. |
2044 int status; | 2054 int status; |
2045 extern kbd_input_ast (); | 2055 extern kbd_input_ast (); |
2046 | 2056 |
2047 waiting_for_ast = 0; | 2057 waiting_for_ast = 0; |
2048 stop_input = 0; | 2058 stop_input = 0; |
2049 status = SYS$QIO (0, fileno (TTY_INPUT (CURTTY())), IO$_READVBLK, | 2059 status = SYS$QIO (0, fileno (CURTTY()->input), IO$_READVBLK, |
2050 &input_iosb, kbd_input_ast, 1, | 2060 &input_iosb, kbd_input_ast, 1, |
2051 &input_buffer, 1, 0, terminator_mask, 0, 0); | 2061 &input_buffer, 1, 0, terminator_mask, 0, 0); |
2052 } | 2062 } |
2053 | 2063 |
2054 int input_count; | 2064 int input_count; |
2161 fflush (stdout); | 2171 fflush (stdout); |
2162 sleep (1); | 2172 sleep (1); |
2163 #endif | 2173 #endif |
2164 if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */ | 2174 if (LIB$AST_IN_PROG ()) /* Don't wait if suspending from kbd_buffer_store_event! */ |
2165 { | 2175 { |
2166 SYS$CANCEL (fileno (TTY_INPUT (CURTTY()))); | 2176 SYS$CANCEL (fileno (CURTTY()->input)); |
2167 return; | 2177 return; |
2168 } | 2178 } |
2169 | 2179 |
2170 SYS$SETAST (0); | 2180 SYS$SETAST (0); |
2171 /* Clear a flag, and tell ast routine above to set it. */ | 2181 /* Clear a flag, and tell ast routine above to set it. */ |
2172 SYS$CLREF (input_ef); | 2182 SYS$CLREF (input_ef); |
2173 waiting_for_ast = 1; | 2183 waiting_for_ast = 1; |
2174 stop_input = 1; | 2184 stop_input = 1; |
2175 SYS$CANCEL (fileno (TTY_INPUT (CURTTY()))); | 2185 SYS$CANCEL (fileno (CURTTY()->input)); |
2176 SYS$SETAST (1); | 2186 SYS$SETAST (1); |
2177 SYS$WAITFR (input_ef); | 2187 SYS$WAITFR (input_ef); |
2178 waiting_for_ast = 0; | 2188 waiting_for_ast = 0; |
2179 } | 2189 } |
2180 | 2190 |