summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2014-11-17 14:48:25 -0800
committerYabin Cui <yabinc@google.com>2014-11-17 18:19:11 -0800
commitd325e866c438ac63305bf0f48bbaa95d1b6bd8ec (patch)
tree8ba445db1dba7cd5df17ca5e35dc652fc5cfef51 /adb
parent3ef0460e86f2a7c5442bcf424b8e83fdfb8e3669 (diff)
downloadsystem_core-d325e866c438ac63305bf0f48bbaa95d1b6bd8ec.zip
system_core-d325e866c438ac63305bf0f48bbaa95d1b6bd8ec.tar.gz
system_core-d325e866c438ac63305bf0f48bbaa95d1b6bd8ec.tar.bz2
kill HAVE_TERMIO_H
Bug: 18398307 Change-Id: Idbb89a074cdf16869cae3f667e89472781f37a5f
Diffstat (limited to 'adb')
-rw-r--r--adb/commandline.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/adb/commandline.c b/adb/commandline.c
index eea882d..23e9ea4 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -29,7 +29,7 @@
#include "sysdeps.h"
-#ifdef HAVE_TERMIO_H
+#if !defined(_WIN32)
#include <termios.h>
#endif
@@ -235,7 +235,18 @@ int usage()
return 1;
}
-#ifdef HAVE_TERMIO_H
+#if defined(_WIN32)
+
+// Windows does not have <termio.h>.
+static void stdin_raw_init(int fd) {
+
+}
+
+static void stdin_raw_restore(int fd) {
+
+}
+
+#else
static struct termios tio_save;
static void stdin_raw_init(int fd)
@@ -309,11 +320,11 @@ static void copy_to_file(int inFd, int outFd) {
long total = 0;
D("copy_to_file(%d -> %d)\n", inFd, outFd);
-#ifdef HAVE_TERMIO_H
+
if (inFd == STDIN_FILENO) {
stdin_raw_init(STDIN_FILENO);
}
-#endif
+
for (;;) {
if (inFd == STDIN_FILENO) {
len = unix_read(inFd, buf, BUFSIZE);
@@ -340,11 +351,11 @@ static void copy_to_file(int inFd, int outFd) {
}
total += len;
}
-#ifdef HAVE_TERMIO_H
+
if (inFd == STDIN_FILENO) {
stdin_raw_restore(STDIN_FILENO);
}
-#endif
+
D("copy_to_file() finished after %lu bytes\n", total);
free(buf);
}
@@ -385,9 +396,7 @@ static void *stdin_read_thread(void *x)
case '.':
if(state == 2) {
fprintf(stderr,"\n* disconnect *\n");
-#ifdef HAVE_TERMIO_H
stdin_raw_restore(fdi);
-#endif
exit(0);
}
default:
@@ -419,14 +428,10 @@ int interactive_shell(void)
fds[0] = fd;
fds[1] = fdi;
-#ifdef HAVE_TERMIO_H
stdin_raw_init(fdi);
-#endif
adb_thread_create(&thr, stdin_read_thread, fds);
read_and_dump(fd);
-#ifdef HAVE_TERMIO_H
stdin_raw_restore(fdi);
-#endif
return 0;
}