summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-09-06 17:27:24 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-09-06 17:29:07 -0700
commit5d2ac7435de679559aae0ede1d8b6f1750c09e68 (patch)
tree8b4059b578a0a2d812b91dc242d507708c00fea2
parent644f77b517180c5f75a9eaac4d76b12a1f334ce6 (diff)
Use DEV_TTY more consistently
* src/conf_post.h (DEV_TTY): Move from here ... * src/keyboard.c, src/keyboard.h: ... to here, as it doesn’t need to be visible everywhere. Make it a constant. * src/keyboard.c (handle_interrupt, Fset_quit_char): * src/process.c (create_process): Prefer DEV_TTY to "/dev/tty".
-rw-r--r--src/conf_post.h9
-rw-r--r--src/keyboard.c10
-rw-r--r--src/keyboard.h2
-rw-r--r--src/process.c2
-rw-r--r--src/term.c2
5 files changed, 12 insertions, 13 deletions
diff --git a/src/conf_post.h b/src/conf_post.h
index bc8b096488..865d0183a5 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -140,10 +140,6 @@ typedef bool bool_bf;
#undef HAVE_RINT
#endif /* HPUX */
-#ifdef WINDOWSNT
-# define DEV_TTY "CONOUT$"
-#endif
-
#ifdef MSDOS
#ifndef __DJGPP__
You lose; /* Emacs for DOS must be compiled with DJGPP */
@@ -246,11 +242,6 @@ extern int emacs_setenv_TZ (char const *);
#include <string.h>
#include <stdlib.h>
-#ifndef DEV_TTY
-# define DEV_TTY "/dev/tty"
-#endif
-
-
#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
#define NO_INLINE __attribute__((noinline))
#else
diff --git a/src/keyboard.c b/src/keyboard.c
index 3ef797c11c..b8bc3610eb 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -75,6 +75,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# pragma GCC diagnostic ignored "-Wclobbered"
#endif
+#ifdef WINDOWSNT
+char const DEV_TTY[] = "CONOUT$";
+#else
+char const DEV_TTY[] = "/dev/tty";
+#endif
+
/* Variables for blockinput.h: */
/* Positive if interrupt input is blocked right now. */
@@ -10310,7 +10316,7 @@ handle_interrupt (bool in_signal_handler)
cancel_echoing ();
/* XXX This code needs to be revised for multi-tty support. */
- if (!NILP (Vquit_flag) && get_named_terminal ("/dev/tty"))
+ if (!NILP (Vquit_flag) && get_named_terminal (DEV_TTY))
{
if (! in_signal_handler)
{
@@ -10609,7 +10615,7 @@ process.
See also `current-input-mode'. */)
(Lisp_Object quit)
{
- struct terminal *t = get_named_terminal ("/dev/tty");
+ struct terminal *t = get_named_terminal (DEV_TTY);
struct tty_display_info *tty;
if (!t)
diff --git a/src/keyboard.h b/src/keyboard.h
index 387378750c..a5ed5e10a9 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -496,6 +496,8 @@ extern void mark_kboards (void);
extern const char *const lispy_function_keys[];
#endif
+extern char const DEV_TTY[];
+
INLINE_HEADER_END
#endif /* EMACS_KEYBOARD_H */
diff --git a/src/process.c b/src/process.c
index 344a886be1..989511967c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1917,7 +1917,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
{
/* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
I can't test it since I don't have 4.3. */
- int j = emacs_open ("/dev/tty", O_RDWR, 0);
+ int j = emacs_open (DEV_TTY, O_RDWR, 0);
if (j >= 0)
{
ioctl (j, TIOCNOTTY, 0);
diff --git a/src/term.c b/src/term.c
index cb684b3aaa..54a97e95b7 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3905,7 +3905,7 @@ dissociate_if_controlling_tty (int fd)
/* Create a termcap display on the tty device with the given name and
type.
- If NAME is NULL, then use the controlling tty, i.e., "/dev/tty".
+ If NAME is NULL, then use the controlling tty, i.e., DEV_TTY.
Otherwise NAME should be a path to the tty device file,
e.g. "/dev/pts/7".