#define O_NOCTTY 0
#endif
+/* The name of the default console device. */
+#ifdef WINDOWSNT
+#define DEV_TTY "CONOUT$"
+#else
+#define DEV_TTY "/dev/tty"
+#endif
+
static void tty_set_scroll_region P_ ((struct frame *f, int start, int stop));
static void turn_on_face P_ ((struct frame *, int face_id));
static void turn_off_face P_ ((struct frame *, int face_id));
static void term_mouse_highlight (struct frame *f, int x, int y);
\f
-#ifdef WINDOWSNT
-/* We aren't X windows, but we aren't termcap either. This makes me
- uncertain as to what value to use for frame.output_method. For
- this file, we'll define FRAME_TERMCAP_P to be zero so that our
- output hooks get called instead of the termcap functions. Probably
- the best long-term solution is to define an output_windows_nt... */
-
-#undef FRAME_TERMCAP_P
-#define FRAME_TERMCAP_P(_f_) 0
-#endif /* WINDOWSNT */
-
#ifdef HAVE_GPM
#include <sys/fcntl.h>
#include "buffer.h"
{
struct terminal *t = get_terminal (terminal, 1);
- if (t->type != output_termcap || strcmp (t->display_info.tty->name, "/dev/tty"))
+ if (t->type != output_termcap || strcmp (t->display_info.tty->name, DEV_TTY))
return Qnil;
else
return Qt;
if (fd == -1)
error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
- if (strcmp (t->display_info.tty->name, "/dev/tty"))
+ if (strcmp (t->display_info.tty->name, DEV_TTY))
dissociate_if_controlling_tty (fd);
-
+
t->display_info.tty->output = fdopen (fd, "w+");
t->display_info.tty->input = t->display_info.tty->output;
-
+
add_keyboard_wait_descriptor (fd);
if (FRAMEP (t->display_info.tty->top_frame))
#else
#ifdef TIOCNOTTY /* Try BSD ioctls. */
sigblock (sigmask (SIGTTOU));
- fd = emacs_open ("/dev/tty", O_RDWR, 0);
+ fd = emacs_open (DEV_TTY, O_RDWR, 0);
if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
{
no_controlling_tty = 1;
#endif /* ! TIOCNOTTY */
#endif /* ! USG */
}
-#endif
+#endif /* !WINDOWSNT */
}
static void maybe_fatal();
"Unknown terminal type",
"Unknown terminal type");
-#ifndef WINDOWSNT
if (name == NULL)
- name = "/dev/tty";
- if (!strcmp (name, "/dev/tty"))
+ name = DEV_TTY;
+ if (!strcmp (name, DEV_TTY))
ctty = 1;
/* If we already have a terminal on the given device, use that. If
terminal = get_named_tty (name);
if (terminal)
return terminal;
-#endif
-
+
terminal = create_terminal ();
tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
bzero (tty, sizeof (struct tty_display_info));
#ifndef WINDOWSNT
set_tty_hooks (terminal);
-
+
{
int fd;
FILE *file;
tty->input = file;
tty->output = file;
}
-
+
tty->type = xstrdup (terminal_type);
add_keyboard_wait_descriptor (fileno (tty->input));
terminal->delete_frame_hook = &delete_tty_output;
terminal->delete_terminal_hook = &delete_tty;
- /* XXX Can this be non-null? */
- if (name)
- {
- tty->name = xstrdup (name);
- terminal->name = xstrdup (name);
- }
- tty->type = xstrdup (terminal_type);
+ tty->name = xstrdup (name);
+ terminal->name = xstrdup (name);
+ tty->type = xstrdup (terminal_type);
tty->output = stdout;
tty->input = stdin;
Wcm_clear (tty);
buffer = (char *) xmalloc (buffer_size);
-
+
/* On some systems, tgetent tries to access the controlling
terminal. */
sigblock (sigmask (SIGTTOU));
status = tgetent (buffer, terminal_type);
sigunblock (sigmask (SIGTTOU));
-
+
if (status < 0)
{
#ifdef TERMINFO