Mercurial > hg > xemacs-beta
comparison src/console-tty.c @ 108:360340f9fd5f r20-1b6
Import from CVS: tag r20-1b6
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:18:39 +0200 |
parents | 1ce6082ce73f |
children | 25f70ba0133c |
comparison
equal
deleted
inserted
replaced
107:523141596bda | 108:360340f9fd5f |
---|---|
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))) |
117 CONSOLE_TTY_DATA (con)->outstream = | 124 CONSOLE_TTY_DATA (con)->outstream = |
118 make_encoding_output_stream (XLSTREAM (CONSOLE_TTY_DATA (con)->outstream), | 125 make_encoding_output_stream (XLSTREAM (CONSOLE_TTY_DATA (con)->outstream), |
119 Fget_coding_system (Vterminal_coding_system)); | 126 Fget_coding_system (Vterminal_coding_system)); |
120 #endif /* MULE */ | 127 #endif /* MULE */ |
121 CONSOLE_TTY_DATA (con)->terminal_type = terminal_type; | 128 CONSOLE_TTY_DATA (con)->terminal_type = terminal_type; |
129 CONSOLE_TTY_DATA (con)->controlling_process = controlling_process; | |
122 if (NILP (CONSOLE_NAME (con))) | 130 if (NILP (CONSOLE_NAME (con))) |
123 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); | 131 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); |
124 { | 132 { |
125 int tty_pg; | 133 int tty_pg; |
126 int controlling_tty_pg; | 134 int controlling_tty_pg; |
204 (console)) | 212 (console)) |
205 { | 213 { |
206 return CONSOLE_TTY_DATA (decode_tty_console (console))->terminal_type; | 214 return CONSOLE_TTY_DATA (decode_tty_console (console))->terminal_type; |
207 } | 215 } |
208 | 216 |
217 DEFUN ("console-tty-controlling-process", Fconsole_tty_controlling_process, 0, 1, 0, /* | |
218 Return the controlling process of TTY console CONSOLE. | |
219 */ | |
220 (console)) | |
221 { | |
222 return CONSOLE_TTY_DATA (decode_tty_console (console))->controlling_process; | |
223 } | |
224 | |
209 extern Lisp_Object stream_semi_canonicalize_console_connection(Lisp_Object, | 225 extern Lisp_Object stream_semi_canonicalize_console_connection(Lisp_Object, |
210 Error_behavior); | 226 Error_behavior); |
211 Lisp_Object | 227 Lisp_Object |
212 tty_semi_canonicalize_console_connection (Lisp_Object connection, | 228 tty_semi_canonicalize_console_connection (Lisp_Object connection, |
213 Error_behavior errb) | 229 Error_behavior errb) |
245 | 261 |
246 void | 262 void |
247 syms_of_console_tty (void) | 263 syms_of_console_tty (void) |
248 { | 264 { |
249 DEFSUBR (Fconsole_tty_terminal_type); | 265 DEFSUBR (Fconsole_tty_terminal_type); |
266 DEFSUBR (Fconsole_tty_controlling_process); | |
250 defsymbol (&Qterminal_type, "terminal-type"); | 267 defsymbol (&Qterminal_type, "terminal-type"); |
268 defsymbol (&Qcontrolling_process, "controlling-process"); | |
251 } | 269 } |
252 | 270 |
253 void | 271 void |
254 console_type_create_tty (void) | 272 console_type_create_tty (void) |
255 { | 273 { |