comparison src/console-tty.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents 0132846995bd
children a2f645c6b9f8
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
47 extern Lisp_Object Vstdio_str; /* in console-stream.c */ 47 extern Lisp_Object Vstdio_str; /* in console-stream.c */
48 48
49 static void 49 static void
50 allocate_tty_console_struct (struct console *con) 50 allocate_tty_console_struct (struct console *con)
51 { 51 {
52 con->console_data = 52 /* zero out all slots except the lisp ones ... */
53 (struct tty_console *) xmalloc (sizeof (struct tty_console)); 53 con->console_data = xnew_and_zero (struct tty_console);
54
55 /* zero out all slots. */
56 memset (con->console_data, 0, sizeof (struct tty_console));
57 /* except the lisp ones ... */
58 CONSOLE_TTY_DATA (con)->terminal_type = Qnil; 54 CONSOLE_TTY_DATA (con)->terminal_type = Qnil;
59 CONSOLE_TTY_DATA (con)->instream = Qnil; 55 CONSOLE_TTY_DATA (con)->instream = Qnil;
60 CONSOLE_TTY_DATA (con)->outstream = Qnil; 56 CONSOLE_TTY_DATA (con)->outstream = Qnil;
61 } 57 }
62 58
70 66
71 GCPRO2 (terminal_type, controlling_process); 67 GCPRO2 (terminal_type, controlling_process);
72 68
73 terminal_type = Fplist_get (props, Qterminal_type, Qnil); 69 terminal_type = Fplist_get (props, Qterminal_type, Qnil);
74 controlling_process = Fplist_get(props, Qcontrolling_process, Qnil); 70 controlling_process = Fplist_get(props, Qcontrolling_process, Qnil);
75 71
76 /* Determine the terminal type */ 72 /* Determine the terminal type */
77 73
78 if (!NILP (terminal_type)) 74 if (!NILP (terminal_type))
79 CHECK_STRING (terminal_type); 75 CHECK_STRING (terminal_type);
80 else 76 else
107 infd = outfd = open ((char *) XSTRING_DATA (tty), O_RDWR); 103 infd = outfd = open ((char *) XSTRING_DATA (tty), O_RDWR);
108 if (infd < 0) 104 if (infd < 0)
109 error ("Unable to open tty %s", XSTRING_DATA (tty)); 105 error ("Unable to open tty %s", XSTRING_DATA (tty));
110 CONSOLE_TTY_DATA (con)->is_stdio = 0; 106 CONSOLE_TTY_DATA (con)->is_stdio = 0;
111 } 107 }
112 108
113 CONSOLE_TTY_DATA (con)->infd = infd; 109 CONSOLE_TTY_DATA (con)->infd = infd;
114 CONSOLE_TTY_DATA (con)->outfd = outfd; 110 CONSOLE_TTY_DATA (con)->outfd = outfd;
115 CONSOLE_TTY_DATA (con)->instream = make_filedesc_input_stream (infd, 0, 111 CONSOLE_TTY_DATA (con)->instream = make_filedesc_input_stream (infd, 0,
116 -1, 0); 112 -1, 0);
117 CONSOLE_TTY_DATA (con)->outstream = make_filedesc_output_stream (outfd, 0, 113 CONSOLE_TTY_DATA (con)->outstream = make_filedesc_output_stream (outfd, 0,