am 6a56ad28: Merge "kill HAVE_TERMIO_H"
* commit '6a56ad28c385ad799f25a1b90213b2367fcb9e22': kill HAVE_TERMIO_H
This commit is contained in:
commit
0aa45710d5
1 changed files with 17 additions and 12 deletions
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include "sysdeps.h"
|
#include "sysdeps.h"
|
||||||
|
|
||||||
#ifdef HAVE_TERMIO_H
|
#if !defined(_WIN32)
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -239,7 +239,18 @@ int usage()
|
||||||
return 1;
|
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 struct termios tio_save;
|
||||||
|
|
||||||
static void stdin_raw_init(int fd)
|
static void stdin_raw_init(int fd)
|
||||||
|
|
@ -313,11 +324,11 @@ static void copy_to_file(int inFd, int outFd) {
|
||||||
long total = 0;
|
long total = 0;
|
||||||
|
|
||||||
D("copy_to_file(%d -> %d)\n", inFd, outFd);
|
D("copy_to_file(%d -> %d)\n", inFd, outFd);
|
||||||
#ifdef HAVE_TERMIO_H
|
|
||||||
if (inFd == STDIN_FILENO) {
|
if (inFd == STDIN_FILENO) {
|
||||||
stdin_raw_init(STDIN_FILENO);
|
stdin_raw_init(STDIN_FILENO);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (inFd == STDIN_FILENO) {
|
if (inFd == STDIN_FILENO) {
|
||||||
len = unix_read(inFd, buf, BUFSIZE);
|
len = unix_read(inFd, buf, BUFSIZE);
|
||||||
|
|
@ -344,11 +355,11 @@ static void copy_to_file(int inFd, int outFd) {
|
||||||
}
|
}
|
||||||
total += len;
|
total += len;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_TERMIO_H
|
|
||||||
if (inFd == STDIN_FILENO) {
|
if (inFd == STDIN_FILENO) {
|
||||||
stdin_raw_restore(STDIN_FILENO);
|
stdin_raw_restore(STDIN_FILENO);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
D("copy_to_file() finished after %lu bytes\n", total);
|
D("copy_to_file() finished after %lu bytes\n", total);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
@ -389,9 +400,7 @@ static void *stdin_read_thread(void *x)
|
||||||
case '.':
|
case '.':
|
||||||
if(state == 2) {
|
if(state == 2) {
|
||||||
fprintf(stderr,"\n* disconnect *\n");
|
fprintf(stderr,"\n* disconnect *\n");
|
||||||
#ifdef HAVE_TERMIO_H
|
|
||||||
stdin_raw_restore(fdi);
|
stdin_raw_restore(fdi);
|
||||||
#endif
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -423,14 +432,10 @@ int interactive_shell(void)
|
||||||
fds[0] = fd;
|
fds[0] = fd;
|
||||||
fds[1] = fdi;
|
fds[1] = fdi;
|
||||||
|
|
||||||
#ifdef HAVE_TERMIO_H
|
|
||||||
stdin_raw_init(fdi);
|
stdin_raw_init(fdi);
|
||||||
#endif
|
|
||||||
adb_thread_create(&thr, stdin_read_thread, fds);
|
adb_thread_create(&thr, stdin_read_thread, fds);
|
||||||
read_and_dump(fd);
|
read_and_dump(fd);
|
||||||
#ifdef HAVE_TERMIO_H
|
|
||||||
stdin_raw_restore(fdi);
|
stdin_raw_restore(fdi);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue