aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2007-09-22 12:41:29 +0000
committerEli Zaretskii2007-09-22 12:41:29 +0000
commit78048085706b17933eaa1f7d2c0b2f0578b561bf (patch)
tree97f558cb64fc99a302c6564c7ddb514056fbdaa8 /src
parent2d5a3812de79b75768cda0f209a4f4a84c83e2ad (diff)
downloademacs-78048085706b17933eaa1f7d2c0b2f0578b561bf.tar.gz
emacs-78048085706b17933eaa1f7d2c0b2f0578b561bf.zip
(DEV_TTY): New macro. Provide a definition for MS-Windows.
(FRAME_TERMCAP_P) [WINDOWSNT]: Don't define to zero. (Fcontrolling_tty_p, Fresume_tty, dissociate_if_controlling_tty) (init_tty): Use DEV_TTY instead of "/dev/tty". [WINDOWSNT]: No need to protect from NAME arg being null.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/term.c56
2 files changed, 32 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3d3b64588e3..3ba10216c6a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12007-09-22 Eli Zaretskii <eliz@gnu.org>
2
3 * term.c (DEV_TTY): New macro. Provide a definition for
4 MS-Windows.
5 (FRAME_TERMCAP_P) [WINDOWSNT]: Don't define to zero.
6 (Fcontrolling_tty_p, Fresume_tty, dissociate_if_controlling_tty)
7 (init_tty): Use DEV_TTY instead of "/dev/tty".
8 [WINDOWSNT]: No need to protect from NAME arg being null.
9
12007-09-21 Dan Nicolaescu <dann@ics.uci.edu> 102007-09-21 Dan Nicolaescu <dann@ics.uci.edu>
2 11
3 * term.c (Fsuspend_tty): Run suspend-tty-functions before cleaning 12 * term.c (Fsuspend_tty): Run suspend-tty-functions before cleaning
diff --git a/src/term.c b/src/term.c
index be3430574f7..b18722f816f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -84,6 +84,13 @@ extern int tgetnum P_ ((char *id));
84#define O_NOCTTY 0 84#define O_NOCTTY 0
85#endif 85#endif
86 86
87/* The name of the default console device. */
88#ifdef WINDOWSNT
89#define DEV_TTY "CONOUT$"
90#else
91#define DEV_TTY "/dev/tty"
92#endif
93
87static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop)); 94static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop));
88static void turn_on_face P_ ((struct frame *, int face_id)); 95static void turn_on_face P_ ((struct frame *, int face_id));
89static void turn_off_face P_ ((struct frame *, int face_id)); 96static void turn_off_face P_ ((struct frame *, int face_id));
@@ -180,17 +187,6 @@ static void term_clear_mouse_face ();
180static void term_mouse_highlight (struct frame *f, int x, int y); 187static void term_mouse_highlight (struct frame *f, int x, int y);
181 188
182 189
183#ifdef WINDOWSNT
184/* We aren't X windows, but we aren't termcap either. This makes me
185 uncertain as to what value to use for frame.output_method. For
186 this file, we'll define FRAME_TERMCAP_P to be zero so that our
187 output hooks get called instead of the termcap functions. Probably
188 the best long-term solution is to define an output_windows_nt... */
189
190#undef FRAME_TERMCAP_P
191#define FRAME_TERMCAP_P(_f_) 0
192#endif /* WINDOWSNT */
193
194#ifdef HAVE_GPM 190#ifdef HAVE_GPM
195#include <sys/fcntl.h> 191#include <sys/fcntl.h>
196#include "buffer.h" 192#include "buffer.h"
@@ -2185,7 +2181,7 @@ is not on a tty device. */)
2185{ 2181{
2186 struct terminal *t = get_terminal (terminal, 1); 2182 struct terminal *t = get_terminal (terminal, 1);
2187 2183
2188 if (t->type != output_termcap || strcmp (t->display_info.tty->name, "/dev/tty")) 2184 if (t->type != output_termcap || strcmp (t->display_info.tty->name, DEV_TTY))
2189 return Qnil; 2185 return Qnil;
2190 else 2186 else
2191 return Qt; 2187 return Qt;
@@ -2313,12 +2309,12 @@ the currently selected frame. */)
2313 if (fd == -1) 2309 if (fd == -1)
2314 error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno)); 2310 error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
2315 2311
2316 if (strcmp (t->display_info.tty->name, "/dev/tty")) 2312 if (strcmp (t->display_info.tty->name, DEV_TTY))
2317 dissociate_if_controlling_tty (fd); 2313 dissociate_if_controlling_tty (fd);
2318 2314
2319 t->display_info.tty->output = fdopen (fd, "w+"); 2315 t->display_info.tty->output = fdopen (fd, "w+");
2320 t->display_info.tty->input = t->display_info.tty->output; 2316 t->display_info.tty->input = t->display_info.tty->output;
2321 2317
2322 add_keyboard_wait_descriptor (fd); 2318 add_keyboard_wait_descriptor (fd);
2323 2319
2324 if (FRAMEP (t->display_info.tty->top_frame)) 2320 if (FRAMEP (t->display_info.tty->top_frame))
@@ -3140,7 +3136,7 @@ dissociate_if_controlling_tty (int fd)
3140#else 3136#else
3141#ifdef TIOCNOTTY /* Try BSD ioctls. */ 3137#ifdef TIOCNOTTY /* Try BSD ioctls. */
3142 sigblock (sigmask (SIGTTOU)); 3138 sigblock (sigmask (SIGTTOU));
3143 fd = emacs_open ("/dev/tty", O_RDWR, 0); 3139 fd = emacs_open (DEV_TTY, O_RDWR, 0);
3144 if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) 3140 if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
3145 { 3141 {
3146 no_controlling_tty = 1; 3142 no_controlling_tty = 1;
@@ -3154,7 +3150,7 @@ dissociate_if_controlling_tty (int fd)
3154#endif /* ! TIOCNOTTY */ 3150#endif /* ! TIOCNOTTY */
3155#endif /* ! USG */ 3151#endif /* ! USG */
3156 } 3152 }
3157#endif 3153#endif /* !WINDOWSNT */
3158} 3154}
3159 3155
3160static void maybe_fatal(); 3156static void maybe_fatal();
@@ -3188,10 +3184,9 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3188 "Unknown terminal type", 3184 "Unknown terminal type",
3189 "Unknown terminal type"); 3185 "Unknown terminal type");
3190 3186
3191#ifndef WINDOWSNT
3192 if (name == NULL) 3187 if (name == NULL)
3193 name = "/dev/tty"; 3188 name = DEV_TTY;
3194 if (!strcmp (name, "/dev/tty")) 3189 if (!strcmp (name, DEV_TTY))
3195 ctty = 1; 3190 ctty = 1;
3196 3191
3197 /* If we already have a terminal on the given device, use that. If 3192 /* If we already have a terminal on the given device, use that. If
@@ -3202,8 +3197,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3202 terminal = get_named_tty (name); 3197 terminal = get_named_tty (name);
3203 if (terminal) 3198 if (terminal)
3204 return terminal; 3199 return terminal;
3205#endif 3200
3206
3207 terminal = create_terminal (); 3201 terminal = create_terminal ();
3208 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); 3202 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
3209 bzero (tty, sizeof (struct tty_display_info)); 3203 bzero (tty, sizeof (struct tty_display_info));
@@ -3219,7 +3213,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3219 3213
3220#ifndef WINDOWSNT 3214#ifndef WINDOWSNT
3221 set_tty_hooks (terminal); 3215 set_tty_hooks (terminal);
3222 3216
3223 { 3217 {
3224 int fd; 3218 int fd;
3225 FILE *file; 3219 FILE *file;
@@ -3264,7 +3258,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3264 tty->input = file; 3258 tty->input = file;
3265 tty->output = file; 3259 tty->output = file;
3266 } 3260 }
3267 3261
3268 tty->type = xstrdup (terminal_type); 3262 tty->type = xstrdup (terminal_type);
3269 3263
3270 add_keyboard_wait_descriptor (fileno (tty->input)); 3264 add_keyboard_wait_descriptor (fileno (tty->input));
@@ -3284,13 +3278,9 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3284 terminal->delete_frame_hook = &delete_tty_output; 3278 terminal->delete_frame_hook = &delete_tty_output;
3285 terminal->delete_terminal_hook = &delete_tty; 3279 terminal->delete_terminal_hook = &delete_tty;
3286 3280
3287 /* XXX Can this be non-null? */ 3281 tty->name = xstrdup (name);
3288 if (name) 3282 terminal->name = xstrdup (name);
3289 { 3283 tty->type = xstrdup (terminal_type);
3290 tty->name = xstrdup (name);
3291 terminal->name = xstrdup (name);
3292 }
3293 tty->type = xstrdup (terminal_type);
3294 3284
3295 tty->output = stdout; 3285 tty->output = stdout;
3296 tty->input = stdin; 3286 tty->input = stdin;
@@ -3328,13 +3318,13 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3328 Wcm_clear (tty); 3318 Wcm_clear (tty);
3329 3319
3330 buffer = (char *) xmalloc (buffer_size); 3320 buffer = (char *) xmalloc (buffer_size);
3331 3321
3332 /* On some systems, tgetent tries to access the controlling 3322 /* On some systems, tgetent tries to access the controlling
3333 terminal. */ 3323 terminal. */
3334 sigblock (sigmask (SIGTTOU)); 3324 sigblock (sigmask (SIGTTOU));
3335 status = tgetent (buffer, terminal_type); 3325 status = tgetent (buffer, terminal_type);
3336 sigunblock (sigmask (SIGTTOU)); 3326 sigunblock (sigmask (SIGTTOU));
3337 3327
3338 if (status < 0) 3328 if (status < 0)
3339 { 3329 {
3340#ifdef TERMINFO 3330#ifdef TERMINFO