Skip to content

Commit d58e9d6

Browse files
authored
Merge pull request #11959 from hugueskamba/hk-fix-minimal-console
Minimal Console: Fix compilation error
2 parents aa16859 + 240758d commit d58e9d6

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

platform/mbed_retarget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,10 @@ extern "C" {
573573
ssize_t write(int fildes, const void *buf, size_t nbyte);
574574
ssize_t read(int fildes, void *buf, size_t nbyte);
575575
int fsync(int fildes);
576+
int isatty(int fildes);
576577
#if !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
577578
off_t lseek(int fildes, off_t offset, int whence);
578579
int ftruncate(int fildes, off_t length);
579-
int isatty(int fildes);
580580
int fstat(int fildes, struct stat *st);
581581
int fcntl(int fildes, int cmd, ...);
582582
int poll(struct pollfd fds[], nfds_t nfds, int timeout);

platform/source/mbed_retarget.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -948,17 +948,13 @@ extern "C" int PREFIX(_istty)(FILEHANDLE fh)
948948
extern "C" int _isatty(FILEHANDLE fh)
949949
#endif
950950
{
951-
#if !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
952951
return isatty(fh);
953-
#else
954-
// Is attached to an interactive device
955-
return 1;
956-
#endif // !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
957952
}
958953

959-
#if !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
954+
960955
extern "C" int isatty(int fildes)
961956
{
957+
#if !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
962958
FileHandle *fhc = mbed_file_handle(fildes);
963959
if (fhc == NULL) {
964960
errno = EBADF;
@@ -972,8 +968,11 @@ extern "C" int isatty(int fildes)
972968
} else {
973969
return tty;
974970
}
975-
}
971+
#else
972+
// Is attached to an interactive device
973+
return 1;
976974
#endif // !MBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY
975+
}
977976

978977
extern "C"
979978
#if defined(__ARMCC_VERSION)

0 commit comments

Comments
 (0)