| Index: runtime/bin/stdin_android.cc
|
| diff --git a/runtime/bin/stdin_android.cc b/runtime/bin/stdin_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9082deb25c2b5316766f90d864e89621760ac379
|
| --- /dev/null
|
| +++ b/runtime/bin/stdin_android.cc
|
| @@ -0,0 +1,52 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +#include "platform/globals.h"
|
| +#if defined(TARGET_OS_ANDROID)
|
| +
|
| +#include <termios.h> // NOLINT
|
| +
|
| +#include "bin/stdin.h"
|
| +
|
| +
|
| +namespace dart {
|
| +namespace bin {
|
| +
|
| +int Stdin::ReadByte() {
|
| + int c = getchar();
|
| + if (c == EOF) {
|
| + c = -1;
|
| + }
|
| + return c;
|
| +}
|
| +
|
| +
|
| +void Stdin::SetEchoMode(bool enabled) {
|
| + struct termios term;
|
| + tcgetattr(fileno(stdin), &term);
|
| + if (enabled) {
|
| + term.c_lflag |= ECHO|ECHONL;
|
| + } else {
|
| + term.c_lflag &= ~(ECHO|ECHONL);
|
| + }
|
| + tcsetattr(fileno(stdin), TCSANOW, &term);
|
| +}
|
| +
|
| +
|
| +void Stdin::SetLineMode(bool enabled) {
|
| + struct termios term;
|
| + tcgetattr(fileno(stdin), &term);
|
| + if (enabled) {
|
| + term.c_lflag |= ICANON;
|
| + } else {
|
| + term.c_lflag &= ~(ICANON);
|
| + }
|
| + tcsetattr(fileno(stdin), TCSANOW, &term);
|
| +}
|
| +
|
| +} // namespace bin
|
| +} // namespace dart
|
| +
|
| +#endif // defined(TARGET_OS_ANDROID)
|
| +
|
|
|