summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
authorbernard <[email protected]>2017-10-17 22:24:23 +0800
committerbernard <[email protected]>2017-10-17 22:24:23 +0800
commita437ffbf3eed0f5da0a869b7b960a8f1218176d4 (patch)
treef361bb1bd335bdc4dbec10c0f58d662cc48aecaf /components/libc
parent41f3d1f9de7635200c5341125f81e1b131710d4d (diff)
[libc] code cleanup for termios.
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/termios/SConscript2
-rw-r--r--components/libc/termios/posix_termios.c52
2 files changed, 27 insertions, 27 deletions
diff --git a/components/libc/termios/SConscript b/components/libc/termios/SConscript
index ef05e688bb..381eb5ad8b 100644
--- a/components/libc/termios/SConscript
+++ b/components/libc/termios/SConscript
@@ -7,7 +7,7 @@ src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]
group = DefineGroup('libc', src,
- depend = ['RT_USING_LIBC', 'RT_USING_POSIX_TERMIOS'],
+ depend = ['RT_USING_LIBC', 'RT_USING_POSIX', 'RT_USING_POSIX_TERMIOS'],
CPPPATH = CPPPATH)
Return('group')
diff --git a/components/libc/termios/posix_termios.c b/components/libc/termios/posix_termios.c
index 4e863ea507..4ec513ef1d 100644
--- a/components/libc/termios/posix_termios.c
+++ b/components/libc/termios/posix_termios.c
@@ -32,7 +32,7 @@
int tcgetattr(int fd, struct termios *tio)
{
- /* Get the current serial port settings. */
+ /* Get the current serial port settings. */
if (ioctl(fd, TCGETA, tio))
return -1;
@@ -41,27 +41,27 @@ int tcgetattr(int fd, struct termios *tio)
int tcsetattr(int fd, int act, const struct termios *tio)
{
- switch (act)
- {
- case TCSANOW:
- /* make the change immediately */
- return (ioctl(fd, TCSETA, (void*)tio));
- case TCSADRAIN:
- /*
- * Don't make the change until all currently written data
- * has been transmitted.
- */
- return (ioctl(fd, TCSETAW, (void*)tio));
- case TCSAFLUSH:
- /* Don't make the change until all currently written data
- * has been transmitted, at which point any received but
- * unread data is also discarded.
- */
- return (ioctl(fd, TCSETAF, (void*)tio));
- default:
- errno = EINVAL;
- return (-1);
- }
+ switch (act)
+ {
+ case TCSANOW:
+ /* make the change immediately */
+ return (ioctl(fd, TCSETA, (void*)tio));
+ case TCSADRAIN:
+ /*
+ * Don't make the change until all currently written data
+ * has been transmitted.
+ */
+ return (ioctl(fd, TCSETAW, (void*)tio));
+ case TCSAFLUSH:
+ /* Don't make the change until all currently written data
+ * has been transmitted, at which point any received but
+ * unread data is also discarded.
+ */
+ return (ioctl(fd, TCSETAF, (void*)tio));
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
}
/**
@@ -106,7 +106,7 @@ int cfsetispeed(struct termios *tio, speed_t speed)
int tcsendbreak(int fd, int dur)
{
/* nonzero duration is implementation-defined, so ignore it */
- return 0;
+ return 0;
}
int tcflush(int fd, int queue)
@@ -124,14 +124,14 @@ int tcflow(int fd, int action)
*/
int tcdrain(int fd)
{
- return 0;
+ return 0;
}
int isatty (int fd)
{
- struct termios term;
+ struct termios term;
- return tcgetattr (fd, &term) == 0;
+ return tcgetattr (fd, &term) == 0;
}
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)