Mercurial > emacs
comparison src/sysdep.c @ 82995:039bd6989d29
Portability fixes (now it compiles & runs fine on Solaris).
lib-src/emacsclient.c: Removed tty proxy kludge. Emacs should just
use the same terminal as emacsclient.
(ec_get_tty, ec_set_tty, master, pty_name, old_tty, tty, old_tty_valid)
(tty_erase_char, quit_char, flow_control, meta_key, _sobuf, init_tty)
(window_change, reset_tty, init_pty, copy_from_to)
(pty_conversation): Removed.
(window_change_signal): Just forward the signal to Emacs, don't do
anything else.
(init_signals): Don't set handlers for SIGHUP & SIGINT.
(strprefix): New function.
(main): Don't touch the terminal, simply tell its name to Emacs.
lisp/server.el (server-frames): Changed name and semantics to server-ttys.
(server-tty-live-p): New function.
(server-sentinel): Delete the whole tty, not just the frame.
(server-handle-delete-frame): Removed.
(server-handle-delete-tty): New function. Close the client connection if
the tty is deleted.
(server-start): Clean up server-ttys, not server-frames. Set up
delete-tty-after-functions.
(server-process-filter): Set up server-ttys, not server-frames.
Updated protocol for sending our pid to emacsclient.
(server-buffer-done): Don't delete the client process directly, delete
the tty instead, and rely on the delete-tty hook to close the
connection. Otherwise the terminal could be left in a bad state.
src/cm.c (cmputc): Don't abort on write errors.
src/indent.c: #include <stdio.h>, for termchar.h.
src/window.c: Ditto.
src/xfaces.c: Ditto.
src/sysdep.c (init_sigio, reset_sigio, request_sigio)[!SIGIO]
(unrequest_sigio)[!SIGIO]: If SIGIO is not supported, don't do
anything. (For Solaris.)
(init_sys_modes): Moved tty_set_terminal_modes call back to here,
disable window system check.
(reset_sys_modes): Reset the terminal even if X is running.
src/term.c (Vdelete_tty_after_functions): New variable.
(syms_of_term): Initialize it.
(Fdelete_tty): Updated docs.
(delete_tty): Run delete-tty-after-functions.
(term_init): Removed tty_set_terminal_modes call.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-35
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 03 Jan 2004 08:31:14 +0000 |
parents | 2ecd1f669db9 |
children | 7900111db01c |
comparison
equal
deleted
inserted
replaced
82994:44ffe551079c | 82995:039bd6989d29 |
---|---|
911 signal (saved_handlers->code, saved_handlers->handler); | 911 signal (saved_handlers->code, saved_handlers->handler); |
912 saved_handlers++; | 912 saved_handlers++; |
913 } | 913 } |
914 } | 914 } |
915 | 915 |
916 #ifndef SIGIO | |
917 /* If SIGIO is broken, don't do anything. */ | |
918 void | |
919 init_sigio (int fd) | |
920 { | |
921 } | |
922 | |
923 void | |
924 reset_sigio (int fd) | |
925 { | |
926 } | |
927 | |
928 void | |
929 request_sigio (void) | |
930 { | |
931 } | |
932 | |
933 void | |
934 unrequest_sigio (void) | |
935 { | |
936 } | |
937 | |
938 #else | |
916 #ifdef F_SETFL | 939 #ifdef F_SETFL |
917 | 940 |
918 int old_fcntl_flags[MAXDESC]; | 941 int old_fcntl_flags[MAXDESC]; |
919 | 942 |
920 void | 943 void |
930 | 953 |
931 void | 954 void |
932 reset_sigio (fd) | 955 reset_sigio (fd) |
933 int fd; | 956 int fd; |
934 { | 957 { |
958 #ifdef FASYNC | |
935 fcntl (fd, F_SETFL, old_fcntl_flags[fd]); | 959 fcntl (fd, F_SETFL, old_fcntl_flags[fd]); |
960 #endif | |
936 } | 961 } |
937 | 962 |
938 #ifdef FASYNC /* F_SETFL does not imply existence of FASYNC */ | 963 #ifdef FASYNC /* F_SETFL does not imply existence of FASYNC */ |
964 /* XXX Uhm, this FASYNC is not used anymore here. */ | |
939 | 965 |
940 void | 966 void |
941 request_sigio () | 967 request_sigio () |
942 { | 968 { |
943 if (read_socket_hook) | 969 if (read_socket_hook) |
1051 #endif /* MSDOS */ | 1077 #endif /* MSDOS */ |
1052 #endif /* _CX_UX */ | 1078 #endif /* _CX_UX */ |
1053 #endif /* STRIDE */ | 1079 #endif /* STRIDE */ |
1054 #endif /* FASYNC */ | 1080 #endif /* FASYNC */ |
1055 #endif /* F_SETFL */ | 1081 #endif /* F_SETFL */ |
1082 #endif /* SIGIO */ | |
1056 | 1083 |
1057 /* Saving and restoring the process group of Emacs's terminal. */ | 1084 /* Saving and restoring the process group of Emacs's terminal. */ |
1058 | 1085 |
1059 #ifdef BSD_PGRPS | 1086 #ifdef BSD_PGRPS |
1060 | 1087 |
1366 #endif | 1393 #endif |
1367 | 1394 |
1368 #ifdef HAVE_WINDOW_SYSTEM | 1395 #ifdef HAVE_WINDOW_SYSTEM |
1369 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1396 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
1370 needs the initialization code below. */ | 1397 needs the initialization code below. */ |
1398 /* XXX This need to be revised for X+tty session support. */ | |
1371 if (tty_out->input != stdin || (!read_socket_hook && EQ (Vwindow_system, Qnil))) | 1399 if (tty_out->input != stdin || (!read_socket_hook && EQ (Vwindow_system, Qnil))) |
1372 #endif | 1400 #endif |
1373 { | 1401 { |
1374 if (! tty_out->old_tty) | 1402 if (! tty_out->old_tty) |
1375 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); | 1403 tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); |
1639 even with a call to setbuf. */ | 1667 even with a call to setbuf. */ |
1640 setvbuf (TTY_OUTPUT (tty_out), (char *) _sobuf, _IOFBF, sizeof _sobuf); | 1668 setvbuf (TTY_OUTPUT (tty_out), (char *) _sobuf, _IOFBF, sizeof _sobuf); |
1641 #else | 1669 #else |
1642 setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); | 1670 setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); |
1643 #endif | 1671 #endif |
1672 | |
1673 #if 0 /* We always need this with multi-tty support. */ | |
1644 #ifdef HAVE_WINDOW_SYSTEM | 1674 #ifdef HAVE_WINDOW_SYSTEM |
1645 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1675 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
1646 needs the initialization code below. */ | 1676 needs the initialization code below. */ |
1647 if (EQ (Vwindow_system, Qnil) | 1677 if (EQ (Vwindow_system, Qnil) |
1648 #ifndef WINDOWSNT | 1678 #ifndef WINDOWSNT |
1650 hook, but still need the rest of the initialization code below. */ | 1680 hook, but still need the rest of the initialization code below. */ |
1651 && (! read_socket_hook) | 1681 && (! read_socket_hook) |
1652 #endif | 1682 #endif |
1653 ) | 1683 ) |
1654 #endif | 1684 #endif |
1685 #endif | |
1686 tty_set_terminal_modes (tty_out); | |
1655 | 1687 |
1656 if (!tty_out->term_initted) | 1688 if (!tty_out->term_initted) |
1657 { | 1689 { |
1658 Lisp_Object tail, frame; | 1690 Lisp_Object tail, frame; |
1659 FOR_EACH_FRAME (tail, frame) | 1691 FOR_EACH_FRAME (tail, frame) |
1748 *heightp = ScreenRows (); | 1780 *heightp = ScreenRows (); |
1749 #else /* system doesn't know size */ | 1781 #else /* system doesn't know size */ |
1750 *widthp = 0; | 1782 *widthp = 0; |
1751 *heightp = 0; | 1783 *heightp = 0; |
1752 #endif | 1784 #endif |
1753 | |
1754 #endif /* not VMS */ | 1785 #endif /* not VMS */ |
1755 #endif /* not SunOS-style */ | 1786 #endif /* not SunOS-style */ |
1756 #endif /* not BSD-style */ | 1787 #endif /* not BSD-style */ |
1757 } | 1788 } |
1758 | 1789 |
1813 fflush (stdout); | 1844 fflush (stdout); |
1814 return; | 1845 return; |
1815 } | 1846 } |
1816 if (!tty_out->term_initted) | 1847 if (!tty_out->term_initted) |
1817 return; | 1848 return; |
1849 #if 0 /* We always need to do this with multi-tty support. */ | |
1818 #ifdef HAVE_WINDOW_SYSTEM | 1850 #ifdef HAVE_WINDOW_SYSTEM |
1819 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1851 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore |
1820 needs the clean-up code below. */ | 1852 needs the clean-up code below. */ |
1821 if (tty_out->input != stdin | 1853 if (tty_out->input != stdin |
1822 || (!EQ (Vwindow_system, Qnil) | 1854 || (!EQ (Vwindow_system, Qnil) |
1826 || read_socket_hook | 1858 || read_socket_hook |
1827 #endif | 1859 #endif |
1828 )) | 1860 )) |
1829 return; | 1861 return; |
1830 #endif | 1862 #endif |
1831 | 1863 #endif |
1864 | |
1832 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1865 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
1833 tty_clear_end_of_line (tty_out, FrameCols (tty_out)); | 1866 tty_clear_end_of_line (tty_out, FrameCols (tty_out)); |
1834 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1867 cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
1835 fflush (tty_out->output); | 1868 fflush (tty_out->output); |
1836 | 1869 |