aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-01-03 08:31:14 +0000
committerKaroly Lorentey2004-01-03 08:31:14 +0000
commit4d553a13abdadb4bb469bc0b59c003d48066dce5 (patch)
tree0b84a435d41801417190e60bf89ffa0305c8c4ac /src
parentb28c910d1f41815fa4744756852d5f2377d28636 (diff)
downloademacs-4d553a13abdadb4bb469bc0b59c003d48066dce5.tar.gz
emacs-4d553a13abdadb4bb469bc0b59c003d48066dce5.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in2
-rw-r--r--src/cm.c3
-rw-r--r--src/dispnew.c18
-rw-r--r--src/indent.c2
-rw-r--r--src/sysdep.c37
-rw-r--r--src/syssignal.h1
-rw-r--r--src/term.c38
-rw-r--r--src/window.c2
-rw-r--r--src/xfaces.c3
9 files changed, 82 insertions, 24 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 1f0e18d9e55..32215899a4a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1142,7 +1142,7 @@ xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h co
1142 msdos.h composite.h fontset.h blockinput.h atimer.h systime.h keymap.h 1142 msdos.h composite.h fontset.h blockinput.h atimer.h systime.h keymap.h
1143xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \ 1143xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
1144 window.h charset.h msdos.h dosfns.h composite.h atimer.h systime.h \ 1144 window.h charset.h msdos.h dosfns.h composite.h atimer.h systime.h \
1145 systty.h termchar.h $(config_h) 1145 termchar.h $(config_h)
1146xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \ 1146xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
1147 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \ 1147 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
1148 charset.h gtkutil.h systty.h termchar.h $(config_h) 1148 charset.h gtkutil.h systty.h termchar.h $(config_h)
diff --git a/src/cm.c b/src/cm.c
index 74f119d9b68..1f165e90f4a 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -70,8 +70,7 @@ cmputc (c)
70{ 70{
71 if (TTY_TERMSCRIPT (current_tty)) 71 if (TTY_TERMSCRIPT (current_tty))
72 putc (c & 0177, TTY_TERMSCRIPT (current_tty)); 72 putc (c & 0177, TTY_TERMSCRIPT (current_tty));
73 if (putc (c & 0177, TTY_OUTPUT (current_tty)) == EOF) 73 putc (c & 0177, TTY_OUTPUT (current_tty));
74 abort (); /* XXX For testing only! */
75 return c; 74 return c;
76} 75}
77 76
diff --git a/src/dispnew.c b/src/dispnew.c
index 87ac292a1b0..be6e6330e31 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5925,7 +5925,7 @@ window_change_signal (signalnum) /* If we don't have an argument, */
5925 int old_errno = errno; 5925 int old_errno = errno;
5926 5926
5927 struct tty_display_info *tty; 5927 struct tty_display_info *tty;
5928 5928
5929 /* The frame size change obviously applies to a single 5929 /* The frame size change obviously applies to a single
5930 termcap-controlled terminal, but we can't decide which. 5930 termcap-controlled terminal, but we can't decide which.
5931 Therefore, we resize the frames corresponding to each tty. 5931 Therefore, we resize the frames corresponding to each tty.
@@ -5934,22 +5934,18 @@ window_change_signal (signalnum) /* If we don't have an argument, */
5934 5934
5935 if (! tty->term_initted) 5935 if (! tty->term_initted)
5936 continue; 5936 continue;
5937 5937
5938 get_tty_size (fileno (TTY_INPUT (tty)), &width, &height); 5938 get_tty_size (fileno (TTY_INPUT (tty)), &width, &height);
5939 5939
5940 { 5940 {
5941 Lisp_Object tail, frame; 5941 Lisp_Object tail, frame;
5942 5942
5943 FOR_EACH_FRAME (tail, frame) 5943 FOR_EACH_FRAME (tail, frame)
5944 { 5944 if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty)
5945 if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty) 5945 /* Record the new sizes, but don't reallocate the data
5946 { 5946 structures now. Let that be done later outside of the
5947 /* Record the new sizes, but don't reallocate the data structures 5947 signal handler. */
5948 now. Let that be done later outside of the signal handler. */ 5948 change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
5949 change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
5950 break;
5951 }
5952 }
5953 } 5949 }
5954 } 5950 }
5955 5951
diff --git a/src/indent.c b/src/indent.c
index bc32aa1f407..0eca2f3410e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -20,6 +20,8 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */ 20Boston, MA 02111-1307, USA. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h>
24
23#include "lisp.h" 25#include "lisp.h"
24#include "buffer.h" 26#include "buffer.h"
25#include "charset.h" 27#include "charset.h"
diff --git a/src/sysdep.c b/src/sysdep.c
index 502671ba0f6..a84a6d5c1fb 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -913,6 +913,29 @@ restore_signal_handlers (saved_handlers)
913 } 913 }
914} 914}
915 915
916#ifndef SIGIO
917/* If SIGIO is broken, don't do anything. */
918void
919init_sigio (int fd)
920{
921}
922
923void
924reset_sigio (int fd)
925{
926}
927
928void
929request_sigio (void)
930{
931}
932
933void
934unrequest_sigio (void)
935{
936}
937
938#else
916#ifdef F_SETFL 939#ifdef F_SETFL
917 940
918int old_fcntl_flags[MAXDESC]; 941int old_fcntl_flags[MAXDESC];
@@ -932,10 +955,13 @@ void
932reset_sigio (fd) 955reset_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
940void 966void
941request_sigio () 967request_sigio ()
@@ -1053,6 +1079,7 @@ unrequest_sigio ()
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
@@ -1368,6 +1395,7 @@ nil means don't delete them until `list-processes' is run. */);
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 {
@@ -1641,6 +1669,8 @@ nil means don't delete them until `list-processes' is run. */);
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. */
@@ -1652,6 +1682,8 @@ nil means don't delete them until `list-processes' is run. */);
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 {
@@ -1750,7 +1782,6 @@ get_tty_size (int fd, int *widthp, int *heightp)
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 */
@@ -1815,6 +1846,7 @@ reset_sys_modes (tty_out)
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. */
@@ -1828,7 +1860,8 @@ reset_sys_modes (tty_out)
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);
diff --git a/src/syssignal.h b/src/syssignal.h
index 2b536758e27..7c3690903df 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */
25 indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file 25 indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file
26 #includes <signal.h>, then that will re-#define SIGIO and confuse 26 #includes <signal.h>, then that will re-#define SIGIO and confuse
27 things. */ 27 things. */
28/* XXX This is not correct anymore, there is a BROKEN_SIGIO macro. */
28 29
29#define SIGMASKTYPE sigset_t 30#define SIGMASKTYPE sigset_t
30 31
diff --git a/src/term.c b/src/term.c
index 24dbc614c6f..96fa9baddac 100644
--- a/src/term.c
+++ b/src/term.c
@@ -100,6 +100,9 @@ static void delete_tty_1 P_ ((struct tty_display_info *));
100 100
101Lisp_Object Vring_bell_function; 101Lisp_Object Vring_bell_function;
102 102
103/* Functions to call after a tty was deleted. */
104Lisp_Object Vdelete_tty_after_functions;
105
103/* Terminal characteristics that higher levels want to look at. */ 106/* Terminal characteristics that higher levels want to look at. */
104 107
105struct tty_display_info *tty_list; 108struct tty_display_info *tty_list;
@@ -2751,8 +2754,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2751 /* Init system terminal modes (RAW or CBREAK, etc.). */ 2754 /* Init system terminal modes (RAW or CBREAK, etc.). */
2752 init_sys_modes (tty); 2755 init_sys_modes (tty);
2753 2756
2754 tty_set_terminal_modes (tty);
2755
2756 return tty; 2757 return tty;
2757#endif /* not WINDOWSNT */ 2758#endif /* not WINDOWSNT */
2758} 2759}
@@ -2772,7 +2773,11 @@ fatal (str, arg1, arg2)
2772 2773
2773 2774
2774DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0, 2775DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0,
2775 doc: /* Delete all frames on the terminal named TTY, and close the device. */) 2776 doc: /* Delete all frames on the terminal named TTY, and close the device.
2777If omitted, TTY defaults to the controlling terminal.
2778
2779This function runs `delete-tty-after-functions' after closing the
2780tty. The functions are run with one arg, the frame to be deleted. */)
2776 (tty) 2781 (tty)
2777 Lisp_Object tty; 2782 Lisp_Object tty;
2778{ 2783{
@@ -2802,7 +2807,8 @@ void
2802delete_tty (struct tty_display_info *tty) 2807delete_tty (struct tty_display_info *tty)
2803{ 2808{
2804 Lisp_Object tail, frame; 2809 Lisp_Object tail, frame;
2805 2810 char *tty_name;
2811
2806 if (deleting_tty) 2812 if (deleting_tty)
2807 /* We get a recursive call when we delete the last frame on this 2813 /* We get a recursive call when we delete the last frame on this
2808 tty. */ 2814 tty. */
@@ -2838,8 +2844,7 @@ delete_tty (struct tty_display_info *tty)
2838 2844
2839 reset_sys_modes (tty); 2845 reset_sys_modes (tty);
2840 2846
2841 if (tty->name) 2847 tty_name = tty->name;
2842 xfree (tty->name);
2843 if (tty->type) 2848 if (tty->type)
2844 xfree (tty->type); 2849 xfree (tty->type);
2845 2850
@@ -2873,6 +2878,21 @@ delete_tty (struct tty_display_info *tty)
2873 bzero (tty, sizeof (struct tty_display_info)); 2878 bzero (tty, sizeof (struct tty_display_info));
2874 xfree (tty); 2879 xfree (tty);
2875 deleting_tty = 0; 2880 deleting_tty = 0;
2881
2882 /* Run `delete-tty-after-functions'. */
2883 if (!NILP (Vrun_hooks))
2884 {
2885 Lisp_Object args[2];
2886 args[0] = intern ("delete-tty-after-functions");
2887 if (tty_name)
2888 {
2889 args[1] = build_string (tty_name);
2890 xfree (tty_name);
2891 }
2892 else
2893 args[1] = Qnil;
2894 Frun_hook_with_args (2, args);
2895 }
2876} 2896}
2877 2897
2878 2898
@@ -2911,6 +2931,12 @@ This variable can be used by terminal emulator packages. */);
2911The function should accept no arguments. */); 2931The function should accept no arguments. */);
2912 Vring_bell_function = Qnil; 2932 Vring_bell_function = Qnil;
2913 2933
2934 DEFVAR_LISP ("delete-tty-after-functions", &Vdelete_tty_after_functions,
2935 doc: /* Functions to be run after deleting a tty.
2936The functions are run with one argument, the name of the tty to be deleted.
2937See `delete-tty'. */);
2938 Vdelete_tty_after_functions = Qnil;
2939
2914 Qframe_tty_name = intern ("frame-tty-name"); 2940 Qframe_tty_name = intern ("frame-tty-name");
2915 staticpro (&Qframe_tty_name); 2941 staticpro (&Qframe_tty_name);
2916 2942
diff --git a/src/window.c b/src/window.c
index 48e517a68f7..854fb712a2d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -21,6 +21,8 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21Boston, MA 02111-1307, USA. */ 21Boston, MA 02111-1307, USA. */
22 22
23#include <config.h> 23#include <config.h>
24#include <stdio.h>
25
24#include "lisp.h" 26#include "lisp.h"
25#include "buffer.h" 27#include "buffer.h"
26#include "keyboard.h" 28#include "keyboard.h"
diff --git a/src/xfaces.c b/src/xfaces.c
index 7b3637b1a6a..9f51f118f3e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -194,6 +194,7 @@ Boston, MA 02111-1307, USA. */
194#include <config.h> 194#include <config.h>
195#include <sys/types.h> 195#include <sys/types.h>
196#include <sys/stat.h> 196#include <sys/stat.h>
197#include <stdio.h> /* This needs to be before termchar.h */
197 198
198#include "lisp.h" 199#include "lisp.h"
199#include "charset.h" 200#include "charset.h"
@@ -241,7 +242,6 @@ Boston, MA 02111-1307, USA. */
241#include "blockinput.h" 242#include "blockinput.h"
242#include "window.h" 243#include "window.h"
243#include "intervals.h" 244#include "intervals.h"
244#include "systty.h" /* For emacs_tty in termchar.h */
245#include "termchar.h" 245#include "termchar.h"
246 246
247#ifdef HAVE_X_WINDOWS 247#ifdef HAVE_X_WINDOWS
@@ -263,7 +263,6 @@ Boston, MA 02111-1307, USA. */
263 263
264#endif /* HAVE_X_WINDOWS */ 264#endif /* HAVE_X_WINDOWS */
265 265
266#include <stdio.h>
267#include <ctype.h> 266#include <ctype.h>
268 267
269#define abs(X) ((X) < 0 ? -(X) : (X)) 268#define abs(X) ((X) < 0 ? -(X) : (X))