aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2016-09-06 17:27:24 -0700
committerPaul Eggert2016-09-06 17:29:07 -0700
commit5d2ac7435de679559aae0ede1d8b6f1750c09e68 (patch)
tree8b4059b578a0a2d812b91dc242d507708c00fea2 /src
parent644f77b517180c5f75a9eaac4d76b12a1f334ce6 (diff)
downloademacs-5d2ac7435de679559aae0ede1d8b6f1750c09e68.tar.gz
emacs-5d2ac7435de679559aae0ede1d8b6f1750c09e68.zip
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".
Diffstat (limited to 'src')
-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 bc8b0964882..865d0183a57 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -140,10 +140,6 @@ typedef bool bool_bf;
140#undef HAVE_RINT 140#undef HAVE_RINT
141#endif /* HPUX */ 141#endif /* HPUX */
142 142
143#ifdef WINDOWSNT
144# define DEV_TTY "CONOUT$"
145#endif
146
147#ifdef MSDOS 143#ifdef MSDOS
148#ifndef __DJGPP__ 144#ifndef __DJGPP__
149You lose; /* Emacs for DOS must be compiled with DJGPP */ 145You lose; /* Emacs for DOS must be compiled with DJGPP */
@@ -246,11 +242,6 @@ extern int emacs_setenv_TZ (char const *);
246#include <string.h> 242#include <string.h>
247#include <stdlib.h> 243#include <stdlib.h>
248 244
249#ifndef DEV_TTY
250# define DEV_TTY "/dev/tty"
251#endif
252
253
254#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ 245#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
255#define NO_INLINE __attribute__((noinline)) 246#define NO_INLINE __attribute__((noinline))
256#else 247#else
diff --git a/src/keyboard.c b/src/keyboard.c
index 3ef797c11c3..b8bc3610eb0 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/>. */
75# pragma GCC diagnostic ignored "-Wclobbered" 75# pragma GCC diagnostic ignored "-Wclobbered"
76#endif 76#endif
77 77
78#ifdef WINDOWSNT
79char const DEV_TTY[] = "CONOUT$";
80#else
81char const DEV_TTY[] = "/dev/tty";
82#endif
83
78/* Variables for blockinput.h: */ 84/* Variables for blockinput.h: */
79 85
80/* Positive if interrupt input is blocked right now. */ 86/* Positive if interrupt input is blocked right now. */
@@ -10310,7 +10316,7 @@ handle_interrupt (bool in_signal_handler)
10310 cancel_echoing (); 10316 cancel_echoing ();
10311 10317
10312 /* XXX This code needs to be revised for multi-tty support. */ 10318 /* XXX This code needs to be revised for multi-tty support. */
10313 if (!NILP (Vquit_flag) && get_named_terminal ("/dev/tty")) 10319 if (!NILP (Vquit_flag) && get_named_terminal (DEV_TTY))
10314 { 10320 {
10315 if (! in_signal_handler) 10321 if (! in_signal_handler)
10316 { 10322 {
@@ -10609,7 +10615,7 @@ process.
10609See also `current-input-mode'. */) 10615See also `current-input-mode'. */)
10610 (Lisp_Object quit) 10616 (Lisp_Object quit)
10611{ 10617{
10612 struct terminal *t = get_named_terminal ("/dev/tty"); 10618 struct terminal *t = get_named_terminal (DEV_TTY);
10613 struct tty_display_info *tty; 10619 struct tty_display_info *tty;
10614 10620
10615 if (!t) 10621 if (!t)
diff --git a/src/keyboard.h b/src/keyboard.h
index 387378750c8..a5ed5e10a98 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -496,6 +496,8 @@ extern void mark_kboards (void);
496extern const char *const lispy_function_keys[]; 496extern const char *const lispy_function_keys[];
497#endif 497#endif
498 498
499extern char const DEV_TTY[];
500
499INLINE_HEADER_END 501INLINE_HEADER_END
500 502
501#endif /* EMACS_KEYBOARD_H */ 503#endif /* EMACS_KEYBOARD_H */
diff --git a/src/process.c b/src/process.c
index 344a886be19..989511967ce 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)
1917 { 1917 {
1918 /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? 1918 /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
1919 I can't test it since I don't have 4.3. */ 1919 I can't test it since I don't have 4.3. */
1920 int j = emacs_open ("/dev/tty", O_RDWR, 0); 1920 int j = emacs_open (DEV_TTY, O_RDWR, 0);
1921 if (j >= 0) 1921 if (j >= 0)
1922 { 1922 {
1923 ioctl (j, TIOCNOTTY, 0); 1923 ioctl (j, TIOCNOTTY, 0);
diff --git a/src/term.c b/src/term.c
index cb684b3aaa6..54a97e95b79 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3905,7 +3905,7 @@ dissociate_if_controlling_tty (int fd)
3905/* Create a termcap display on the tty device with the given name and 3905/* Create a termcap display on the tty device with the given name and
3906 type. 3906 type.
3907 3907
3908 If NAME is NULL, then use the controlling tty, i.e., "/dev/tty". 3908 If NAME is NULL, then use the controlling tty, i.e., DEV_TTY.
3909 Otherwise NAME should be a path to the tty device file, 3909 Otherwise NAME should be a path to the tty device file,
3910 e.g. "/dev/pts/7". 3910 e.g. "/dev/pts/7".
3911 3911