将unistd.c不再放在common中,分散到各个库中
This commit is contained in:
parent
8a08be6b9e
commit
6eb62a3f9d
@ -11,6 +11,8 @@
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
|
||||
#ifdef RT_USING_POSIX_TERMIOS
|
||||
int isatty(int fd)
|
||||
{
|
||||
@ -23,3 +25,5 @@ char *ttyname(int fd)
|
||||
{
|
||||
return "/dev/tty0"; /*TODO: need to add more specific*/
|
||||
}
|
||||
|
||||
#endif
|
29
components/libc/compilers/dlib/unistd.c
Normal file
29
components/libc/compilers/dlib/unistd.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-09-01 Meco Man First Version
|
||||
*/
|
||||
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
|
||||
#ifdef RT_USING_POSIX_TERMIOS
|
||||
int isatty(int fd)
|
||||
{
|
||||
struct termios ts;
|
||||
return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/
|
||||
}
|
||||
#endif
|
||||
|
||||
char *ttyname(int fd)
|
||||
{
|
||||
return "/dev/tty0"; /*TODO: need to add more specific*/
|
||||
}
|
||||
|
||||
#endif
|
29
components/libc/compilers/newlib/unistd.c
Normal file
29
components/libc/compilers/newlib/unistd.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-09-01 Meco Man First Version
|
||||
*/
|
||||
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
|
||||
#ifdef RT_USING_POSIX_TERMIOS
|
||||
int isatty(int fd)
|
||||
{
|
||||
struct termios ts;
|
||||
return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/
|
||||
}
|
||||
#endif
|
||||
|
||||
char *ttyname(int fd)
|
||||
{
|
||||
return "/dev/tty0"; /*TODO: need to add more specific*/
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user