| 1 | // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | #include "platform/globals.h" |
| 6 | #if defined(HOST_OS_FUCHSIA) |
| 7 | |
| 8 | #include "bin/stdio.h" |
| 9 | |
| 10 | #include <errno.h> |
| 11 | |
| 12 | #include "platform/signal_blocker.h" |
| 13 | |
| 14 | namespace dart { |
| 15 | namespace bin { |
| 16 | |
| 17 | bool Stdin::ReadByte(intptr_t fd, int* byte) { |
| 18 | unsigned char b; |
| 19 | ssize_t s = TEMP_FAILURE_RETRY(read(fd, &b, 1)); |
| 20 | if (s < 0) { |
| 21 | return false; |
| 22 | } |
| 23 | *byte = (s == 0) ? -1 : b; |
| 24 | return true; |
| 25 | } |
| 26 | |
| 27 | bool Stdin::GetEchoMode(intptr_t fd, bool* enabled) { |
| 28 | errno = ENOSYS; |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | bool Stdin::SetEchoMode(intptr_t fd, bool enabled) { |
| 33 | errno = ENOSYS; |
| 34 | return false; |
| 35 | } |
| 36 | |
| 37 | bool Stdin::GetLineMode(intptr_t fd, bool* enabled) { |
| 38 | errno = ENOSYS; |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | bool Stdin::SetLineMode(intptr_t fd, bool enabled) { |
| 43 | errno = ENOSYS; |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | bool Stdin::AnsiSupported(intptr_t fd, bool* supported) { |
| 48 | *supported = false; |
| 49 | return true; |
| 50 | } |
| 51 | |
| 52 | bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) { |
| 53 | errno = ENOSYS; |
| 54 | return false; |
| 55 | } |
| 56 | |
| 57 | bool Stdout::AnsiSupported(intptr_t fd, bool* supported) { |
| 58 | *supported = false; |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | } // namespace bin |
| 63 | } // namespace dart |
| 64 | |
| 65 | #endif // defined(HOST_OS_FUCHSIA) |
| 66 | |