Mercurial > hg > xemacs-beta
comparison src/console-tty.c @ 30:ec9a17fef872 r19-15b98
Import from CVS: tag r19-15b98
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:29 +0200 |
parents | 859a2309aef8 |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
29:7976500f47f9 | 30:ec9a17fef872 |
---|---|
40 #endif | 40 #endif |
41 | 41 |
42 DEFINE_CONSOLE_TYPE (tty); | 42 DEFINE_CONSOLE_TYPE (tty); |
43 | 43 |
44 Lisp_Object Qterminal_type; | 44 Lisp_Object Qterminal_type; |
45 Lisp_Object Qcontrolling_process; | |
45 | 46 |
46 extern Lisp_Object Vstdio_str; /* in console-stream.c */ | 47 extern Lisp_Object Vstdio_str; /* in console-stream.c */ |
47 | 48 |
48 static void | 49 static void |
49 allocate_tty_console_struct (struct console *con) | 50 allocate_tty_console_struct (struct console *con) |
60 } | 61 } |
61 | 62 |
62 static void | 63 static void |
63 tty_init_console (struct console *con, Lisp_Object props) | 64 tty_init_console (struct console *con, Lisp_Object props) |
64 { | 65 { |
65 Lisp_Object tty = CONSOLE_CONNECTION (con), terminal_type = Qnil; | 66 Lisp_Object tty = CONSOLE_CONNECTION (con); |
67 Lisp_Object terminal_type = Qnil, controlling_process = Qnil; | |
66 int infd, outfd; | 68 int infd, outfd; |
67 struct gcpro gcpro1; | 69 struct gcpro gcpro1, gcpro2; |
68 | 70 |
69 GCPRO1 (terminal_type); | 71 GCPRO2 (terminal_type, controlling_process); |
70 | 72 |
71 terminal_type = Fplist_get (props, Qterminal_type, Qnil); | 73 terminal_type = Fplist_get (props, Qterminal_type, Qnil); |
72 | 74 controlling_process = Fplist_get(props, Qcontrolling_process, Qnil); |
75 | |
73 /* Determine the terminal type */ | 76 /* Determine the terminal type */ |
74 | 77 |
75 if (!NILP (terminal_type)) | 78 if (!NILP (terminal_type)) |
76 CHECK_STRING (terminal_type); | 79 CHECK_STRING (terminal_type); |
77 else | 80 else |
83 error ("Cannot determine terminal type"); | 86 error ("Cannot determine terminal type"); |
84 } | 87 } |
85 else | 88 else |
86 terminal_type = build_string (temp_type); | 89 terminal_type = build_string (temp_type); |
87 } | 90 } |
91 | |
92 /* Determine the controlling process */ | |
93 if (!NILP (controlling_process)) | |
94 CHECK_INT (controlling_process); | |
88 | 95 |
89 /* Open the specified console */ | 96 /* Open the specified console */ |
90 | 97 |
91 allocate_tty_console_struct (con); | 98 allocate_tty_console_struct (con); |
92 if (!NILP (Fequal (tty, Vstdio_str))) | 99 if (!NILP (Fequal (tty, Vstdio_str))) |
108 CONSOLE_TTY_DATA (con)->instream = make_filedesc_input_stream (infd, 0, | 115 CONSOLE_TTY_DATA (con)->instream = make_filedesc_input_stream (infd, 0, |
109 -1, 0); | 116 -1, 0); |
110 CONSOLE_TTY_DATA (con)->outstream = make_filedesc_output_stream (outfd, 0, | 117 CONSOLE_TTY_DATA (con)->outstream = make_filedesc_output_stream (outfd, 0, |
111 -1, 0); | 118 -1, 0); |
112 CONSOLE_TTY_DATA (con)->terminal_type = terminal_type; | 119 CONSOLE_TTY_DATA (con)->terminal_type = terminal_type; |
120 CONSOLE_TTY_DATA (con)->controlling_process = controlling_process; | |
113 if (NILP (CONSOLE_NAME (con))) | 121 if (NILP (CONSOLE_NAME (con))) |
114 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); | 122 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); |
115 { | 123 { |
116 int tty_pg; | 124 int tty_pg; |
117 int controlling_tty_pg; | 125 int controlling_tty_pg; |
195 (console)) | 203 (console)) |
196 { | 204 { |
197 return CONSOLE_TTY_DATA (decode_tty_console (console))->terminal_type; | 205 return CONSOLE_TTY_DATA (decode_tty_console (console))->terminal_type; |
198 } | 206 } |
199 | 207 |
208 DEFUN ("console-tty-controlling-process", Fconsole_tty_controlling_process, 0, 1, 0, /* | |
209 Return the controlling process of TTY console CONSOLE. | |
210 */ | |
211 (console)) | |
212 { | |
213 return CONSOLE_TTY_DATA (decode_tty_console (console))->controlling_process; | |
214 } | |
215 | |
200 extern Lisp_Object stream_semi_canonicalize_console_connection(Lisp_Object, | 216 extern Lisp_Object stream_semi_canonicalize_console_connection(Lisp_Object, |
201 Error_behavior); | 217 Error_behavior); |
202 Lisp_Object | 218 Lisp_Object |
203 tty_semi_canonicalize_console_connection (Lisp_Object connection, | 219 tty_semi_canonicalize_console_connection (Lisp_Object connection, |
204 Error_behavior errb) | 220 Error_behavior errb) |
236 | 252 |
237 void | 253 void |
238 syms_of_console_tty (void) | 254 syms_of_console_tty (void) |
239 { | 255 { |
240 DEFSUBR (Fconsole_tty_terminal_type); | 256 DEFSUBR (Fconsole_tty_terminal_type); |
257 DEFSUBR (Fconsole_tty_controlling_process); | |
241 defsymbol (&Qterminal_type, "terminal-type"); | 258 defsymbol (&Qterminal_type, "terminal-type"); |
259 defsymbol (&Qcontrolling_process, "controlling-process"); | |
242 } | 260 } |
243 | 261 |
244 void | 262 void |
245 console_type_create_tty (void) | 263 console_type_create_tty (void) |
246 { | 264 { |