diff options
author | Yabin Cui <yabinc@google.com> | 2014-11-18 20:19:12 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-18 20:19:12 +0000 |
commit | bd51f58e085c0b2817ab2d3633bea7fab43c9af1 (patch) | |
tree | e7e572ac015d0255ec9567eb0cade3b88f0cd1ce /adb | |
parent | 7320cd61236d86644ec8a420291d7d268a67b6e2 (diff) | |
parent | 0aa45710d5c850bf673b14cf4894cee8eb43ce9b (diff) | |
download | system_core-bd51f58e085c0b2817ab2d3633bea7fab43c9af1.zip system_core-bd51f58e085c0b2817ab2d3633bea7fab43c9af1.tar.gz system_core-bd51f58e085c0b2817ab2d3633bea7fab43c9af1.tar.bz2 |
am 0aa45710: am 6a56ad28: Merge "kill HAVE_TERMIO_H"
* commit '0aa45710d5c850bf673b14cf4894cee8eb43ce9b':
kill HAVE_TERMIO_H
Diffstat (limited to 'adb')
-rw-r--r-- | adb/commandline.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/adb/commandline.c b/adb/commandline.c index a85ce92..903b818 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 @@ -239,7 +239,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) @@ -313,11 +324,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); @@ -344,11 +355,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); } @@ -389,9 +400,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: @@ -423,14 +432,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; } |