summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2008-11-01 13:49:23 +0000
committerEli Zaretskii <eliz@gnu.org>2008-11-01 13:49:23 +0000
commitd41784eef44d7c34becb4c35f29ac1215dfb15ab (patch)
tree4a0e1e823a8de16ac217f00e2b619a9720d875fe /lib-src
parent662bea29a515ab931be56f725d29303a48d681b0 (diff)
downloademacs-d41784eef44d7c34becb4c35f29ac1215dfb15ab.tar.gz
(main) [WINDOWSNT]: Don't ifdef away the call to `ttyname'.
(w32_getenv): Treat $TERM specially: if not found in the environment and in the Registry, return "w32console". (ttyname) [WINDOWSNT]: New function.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog8
-rw-r--r--lib-src/emacsclient.c21
2 files changed, 23 insertions, 6 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 228a579c651..2a702b8b719 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-01 Eli Zaretskii <eliz@gnu.org>
+
+ * emacsclient.c (main) [WINDOWSNT]: Don't ifdef away the call to
+ `ttyname'.
+ (w32_getenv): Treat $TERM specially: if not found in the
+ environment and in the Registry, return "w32console".
+ (ttyname) [WINDOWSNT]: New function.
+
2008-10-31 Andreas Schwab <schwab@suse.de>
* emacsclient.c (main): Don't force sending tty when in eval mode.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 921fc2054e3..cac8bce2fd2 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -353,8 +353,13 @@ w32_getenv (envvar)
if (! (value = w32_get_resource (HKEY_CURRENT_USER, envvar, &dwType)) &&
! (value = w32_get_resource (HKEY_LOCAL_MACHINE, envvar, &dwType)))
- /* Not found in the registry. */
- return NULL;
+ {
+ /* "w32console" is what Emacs on Windows uses for tty-type under -nw. */
+ if (strcmp (envvar, "TERM") == 0)
+ return xstrdup ("w32console");
+ /* Found neither in the environment nor in the registry. */
+ return NULL;
+ }
if (dwType == REG_SZ)
/* Registry; no need to expand. */
@@ -435,6 +440,13 @@ w32_execvp (path, argv)
#undef execvp
#define execvp w32_execvp
+/* Emulation of ttyname for Windows. */
+char *
+ttyname (int fd)
+{
+ return "CONOUT$";
+}
+
#endif /* WINDOWSNT */
/* Display a normal or error message.
@@ -570,10 +582,8 @@ decode_options (argc, argv)
if (!tty && display)
window_system = 1;
-#if !defined (WINDOWSNT)
else if (!current_frame)
tty = 1;
-#endif
/* --no-wait implies --current-frame on ttys when there are file
arguments or expressions given. */
@@ -1444,9 +1454,8 @@ main (argc, argv)
{
char *type = egetenv ("TERM");
char *tty_name = NULL;
-#ifndef WINDOWSNT
+
tty_name = ttyname (fileno (stdout));
-#endif
if (! tty_name)
{