implemented tcsetattr()
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3175 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,6 +2,7 @@ SubDir OBOS_TOP src kernel libroot posix termios ;
|
|||||||
|
|
||||||
KernelMergeObject posix_termios.o :
|
KernelMergeObject posix_termios.o :
|
||||||
<$(SOURCE_GRIST)>termios.c
|
<$(SOURCE_GRIST)>termios.c
|
||||||
|
<$(SOURCE_GRIST)>tcsetattr.c
|
||||||
:
|
:
|
||||||
-fPIC -DPIC
|
-fPIC -DPIC
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
** Copyright 2003, Daniel Reinhold, [email protected]. All rights reserved.
|
||||||
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* tcsetattr - set the attributes for the tty device at fd
|
||||||
|
* (using the structure in the last arg for the values)
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
tcsetattr(int fd, int opt, const struct termios *tp)
|
||||||
|
{
|
||||||
|
switch (opt) {
|
||||||
|
case TCSANOW:
|
||||||
|
// set the attributes immediately
|
||||||
|
return ioctl(fd, TCSETA, tp);
|
||||||
|
|
||||||
|
case TCSADRAIN:
|
||||||
|
// wait for ouput to finish before setting the attributes
|
||||||
|
return ioctl(fd, TCSETAW, tp);
|
||||||
|
|
||||||
|
case TCSAFLUSH:
|
||||||
|
// wait for ouput to finish and then flush the input buffer
|
||||||
|
// before setting the attributes
|
||||||
|
return ioctl(fd, TCSETAF, tp);
|
||||||
|
|
||||||
|
default:
|
||||||
|
// no other valid options
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user